From 6f9696e7918d72521f40c01cfd4f689e379a3aa2 Mon Sep 17 00:00:00 2001 From: dingo Date: Mon, 10 Aug 2026 17:13:34 +0700 Subject: [PATCH] config: stop baking one author's home directory into the autostart template Two lines named /home/dingo outright: waybar's stylesheet and the wallpaper the `current` symlink points at. This file is installed verbatim into every user's config directory, so both worked for exactly one person -- and failed quietly for everyone else, because a waybar whose stylesheet cannot be read still starts and a wallpaper that was never set looks the same as one that failed to load. Nobody would have got an error message; they would have got an unstyled bar over a black screen. The wallpaper line was already a shell invocation, so it only needed $HOME. The bar was not, and this file is deliberately not a shell -- `~` and `$HOME` on a bare command line here are literal text, which is what stops a file that names programs from being escalated into arbitrary execution. So it now goes through `sh -c`, on the same terms the wallpaper line already established: naming `sh` is naming a program, and anyone who can write this file could already name any binary on the system. `exec` keeps the process tree flat, which matters because cosmic-session supervises these -- without it the shell would be what gets supervised, and a waybar that died would never be restarted. Verified that the expansion produces the same two paths that were hardcoded, and that both exist. --- config/autostart | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/config/autostart b/config/autostart index 5d5bd60..ebe82d2 100644 --- a/config/autostart +++ b/config/autostart @@ -17,7 +17,8 @@ # compositor's benefit, not waybar's. # # No --config: the default is derived from XDG_CONFIG_HOME (or HOME) inside the -# process, so unlike the waybar line below this needs no hardcoded home path. +# process, so unlike the waybar line below this needs no shell to find a home +# directory for it. # # A malformed edit is not fatal. It is reported to the session log and the last # good configuration stays in place, so a typo cannot leave you at a broken @@ -28,10 +29,17 @@ cosmic-conf watch # has to be per-user: it imports a sibling theme.css holding the installed HyDE # theme's palette, and a relative @import resolves against the importing file. # -# The style path below is therefore absolute and contains a home directory. -# This file is not a shell, so `~` and `$HOME` are literal text here -- replace -# the path with your own if you are copying this template. -waybar -c /usr/share/hyprcosmic/waybar/config.jsonc -s /home/dingo/.config/hyprcosmic/waybar/style.css +# So the style path has to name a home directory, and this file is not a shell: +# `~` and `$HOME` on a bare command line here are literal text, not expansions. +# `sh -c` is what gets them expanded, for the same reason and under the same +# terms as the wallpaper line below -- naming `sh` is naming a program, which +# this file was always allowed to do. +# +# `exec` matters. Without it sh stays in the process tree as waybar's parent, +# and cosmic-session would be supervising the shell rather than the bar: a +# waybar that died would leave sh alive, so the restart that should have +# happened never would. +sh -c 'exec waybar -c /usr/share/hyprcosmic/waybar/config.jsonc -s "$HOME/.config/hyprcosmic/waybar/style.css"' # rofi is not a daemon. It is launched on demand by a keybinding, which COSMIC # stores in com.system76.CosmicSettings.Shortcuts rather than here. Set those @@ -73,7 +81,7 @@ awww-daemon # # ln -sfn ~/".local/share/wallpapers/hyprcosmic//" \ # ~/.local/share/wallpapers/hyprcosmic/current -sh -c 'until awww query >/dev/null 2>&1; do sleep 0.2; done; exec awww img "/home/dingo/.local/share/wallpapers/hyprcosmic/current"' +sh -c 'until awww query >/dev/null 2>&1; do sleep 0.2; done; exec awww img "$HOME/.local/share/wallpapers/hyprcosmic/current"' # A terminal, unconditionally, as the way back in. #