refactor: move swww daemon and wallpaper init to systemd user services

This commit is contained in:
Price Hiller 2023-09-04 22:40:31 -05:00
parent a0ff849551
commit 4dedd9d613
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8
5 changed files with 49 additions and 9 deletions

View File

@ -14,6 +14,6 @@ exec-once = blueman-applet
# We have to sleep to ensure clightd is actually good to go
exec-once = clight-gui --tray
exec-once = opensnitch-ui --background
exec-once = timeout 5s ~/.config/hypr/scripts/init-wallpapers.bash
exec = systemd-run --user -u wallpaper-manager ~/.config/hypr/scripts/init-wallpapers.bash || systemctl --user restart wallpaper-manager
exec-once = systemctl --user start compositor.target
exec-once = xwaylandvideobridge

View File

@ -25,10 +25,10 @@
"csharpls-extended-lsp.nvim": { "branch": "master", "commit": "865ace7f8f4069b4965e86005392dc78eec0858f" },
"diffview.nvim": { "branch": "main", "commit": "7e5a85c186027cab1e825d018f07c350177077fc" },
"dressing.nvim": { "branch": "master", "commit": "b1c7b70e1e0875243ed38f51fe7a61d08e11607e" },
"flatten.nvim": { "branch": "main", "commit": "b362e13e22a452db913aab1fb2ee2d8546526d90" },
"formatter.nvim": { "branch": "master", "commit": "44c89f09dcc220dc2a9b056e93c3a87c86e79804" },
"friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" },
"fuzzy.nvim": { "branch": "master", "commit": "67a42ad2fa6d5ff41f0ef3cf69bb247410da5d7a" },
"gh.nvim": { "branch": "main", "commit": "2b5551656c1b896bf4ae06546eaaab00311f9a18" },
"gitsigns.nvim": { "branch": "main", "commit": "d927caa075df63bf301d92f874efb72fd22fd3b4" },
"gx.nvim": { "branch": "main", "commit": "b78478ce851f3e8bfaf828421316122e88d12cee" },
"headlines.nvim": { "branch": "master", "commit": "74a083a3c32a08be24f7dfcc6f448ecf47857f46" },
@ -42,7 +42,6 @@
"kanagawa.nvim": { "branch": "master", "commit": "0a24e504a3a278849ad0aef31cd6dd24c73ca3db" },
"keymap-layer.nvim": { "branch": "master", "commit": "e46840f9f377766e856964a49d7f351de3188a38" },
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
"litee.nvim": { "branch": "main", "commit": "bf366a1414fd0f9401631ac8884f2f9fa4bf18d2" },
"live-command.nvim": { "branch": "main", "commit": "d460067d47948725a6f25b20f31ea8bbfdfe4622" },
"lsp_lines.nvim": { "branch": "main", "commit": "f53af96d4789eef39a082dbcce078d2bfc384ece" },
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
@ -85,6 +84,7 @@
"nvim-ts-context-commentstring": { "branch": "main", "commit": "9bff161dfece6ecf3459e6e46ca42e49f9ed939f" },
"nvim-ufo": { "branch": "main", "commit": "890b94870f052773d77175d07a51f2e083210632" },
"nvim-web-devicons": { "branch": "master", "commit": "bc11ee2498de2310de5776477dd9dce65d03b464" },
"octo.nvim": { "branch": "master", "commit": "d1e52f9b3c755fcebb93d635821663a2c0f53281" },
"omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "53edfb413a54c9e55dcddc9e9fa4977a897e4425" },
"playground": { "branch": "master", "commit": "429f3e76cbb1c59fe000b690f7a5bea617b890c0" },
"plenary.nvim": { "branch": "master", "commit": "0dbe561ae023f02c2fb772b879e905055b939ce3" },
@ -96,7 +96,6 @@
"statuscol.nvim": { "branch": "main", "commit": "0944234914438695050eec6f83b4669864680c1a" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "ad7b637c72549713b9aaed7c4f9c79c62bcbdff0" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
"telescope-media-files.nvim": { "branch": "master", "commit": "0826c7a730bc4d36068f7c85cf4c5b3fd9fb570a" },
"telescope-smart-history.nvim": { "branch": "master", "commit": "81a4cceaa54d65d5f7c7c26178ee63b634d3e26d" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" },
"telescope-undo.nvim": { "branch": "main", "commit": "3dec002ea3e7952071d26fbb5d01e2038a58a554" },
@ -108,7 +107,6 @@
"trouble.nvim": { "branch": "main", "commit": "3f85d8ed30e97ceeddbbcf80224245d347053711" },
"typescript-tools.nvim": { "branch": "master", "commit": "98165e3cd9d8b1cd0aa7635f1d81a337ae780b55" },
"venn.nvim": { "branch": "main", "commit": "c114563960b8fb1197695d42798d1f3e7190b798" },
"vim-fugitive": { "branch": "master", "commit": "572c8510123cbde02e8a1dafcd376c98e1e13f43" },
"vim-log-highlighting": { "branch": "master", "commit": "1037e26f3120e6a6a2c0c33b14a84336dee2a78f" },
"vim-move": { "branch": "master", "commit": "244a2908ffbca3d09529b3ec24c2c090f489f401" },
"vim-nftables": { "branch": "master", "commit": "26f8a506c6f3e41f1e4a8d6aa94c9a79a666bbff" },

View File

@ -49,10 +49,20 @@ set-wallpapers() {
}
main() {
if swww init >/dev/null 2>&1; then
log "Initialized swww daemon"
fi
set-wallpapers
until systemctl --user is-active swww --quiet; do
sleep .1
done
log "swww daemon running, setting wallpapers"
while :; do
while IFS= read -r line
do
if grep "color: 000000" <<< "${line}"; then
set-wallpapers
fi
sleep .1
done < <(swww query)
sleep .1
done
}
main

View File

@ -0,0 +1,14 @@
[Unit]
Description=Wayland Wallpaper Service
PartOf=swww.service
After=swww.service
[Service]
ExecStart=bash %h/.config/systemd/user/scripts/init-wallpapers.bash
ExecStop=kill -SIGTERM $MAINPID
TimeoutSec=5sec
Restart=on-failure
RestartSec=3
[Install]
WantedBy=swww.service

View File

@ -0,0 +1,18 @@
[Unit]
Description=Wayland Wallpaper Service
PartOf=compositor.target
After=compositor.target
ConditionEnvironment=WAYLAND_DISPLAY
ConditionEnvironment=HOME
ConditionEnvironment=XDG_RUNTIME_DIR
[Service]
ExecStart=swww-daemon
# ExecStartPost=sh -c 'bash %h/.config/systemd/user/scripts/init-wallpapers.bash || true'
ExecStop=kill -SIGTERM $MAINPID
TimeoutSec=5sec
Restart=on-failure
RestartSec=3
[Install]
WantedBy=compositor.target