import-theme: say when the file it wrote is inert

Keeping the imported theme in its own file, sourced from cosmic.conf, is what
stops a re-import from clobbering the keybindings. But a sourced file only
does anything if something sources it, and until now `import-theme --out`
reported "Wrote ..." whether or not anything did -- which looks like success
while the desktop stays exactly as it was.

It now checks the sibling cosmic.conf and prints the line to add when the file
is unreachable. The match is by filename and deliberately loose: it is looking
for evidence the user already knows about the file, not parsing the config.

The shipped template carries that `source` line commented out rather than
live, because `source` naming a file that does not exist is a hard error, and
a fresh checkout has no theme.conf yet. Copying the template and running
`apply` has to work before any theme is imported.
This commit is contained in:
2026-08-10 09:16:04 +07:00
parent e46514cbab
commit a32596216a
2 changed files with 55 additions and 0 deletions
+14
View File
@@ -4,6 +4,20 @@
# every key here overwrites whatever COSMIC's own settings UI last stored, so
# edit this rather than the GUI for anything it covers.
# --- Theme --------------------------------------------------------------
#
# `cosmic-conf import-theme <theme>/hypr.theme --out ~/.config/hyprcosmic/theme.conf`
# turns a HyDE theme into conf keys. Sourcing it rather than pasting it in
# keeps the two apart: re-importing overwrites theme.conf and cannot touch the
# keybindings below, and anything you want to override can simply be repeated
# later in this file, since the last assignment to a key wins.
#
# Commented out because a `source` pointing at a file that does not exist is a
# hard error, and no theme is imported yet. Uncomment it once you have run the
# command above -- import-theme will remind you.
#
# source = ~/.config/hyprcosmic/theme.conf
$mainMod = SUPER
# --- Launcher -----------------------------------------------------------