sway: Wrap swaybg in systemd-run
...to work around swaybg crashes
This commit is contained in:
parent
f50cfd0deb
commit
bba37860d7
2 changed files with 27 additions and 0 deletions
|
@ -222,6 +222,11 @@ bindsym $mod+r mode "resize"
|
|||
include /etc/sway/config.d/*
|
||||
include /home/peter/.config/sway/local.d/*
|
||||
|
||||
# Wrap swaybg in systemd-run to allow swaybg to be automatically restarted
|
||||
# if it ever crashes. The wrapper script will also automatically purge old
|
||||
# processes of swaybg as needed.
|
||||
swaybg_command /home/peter/.local/bin/swaybg-systemd-wrapper
|
||||
|
||||
output "*" bg $wallpaper fill
|
||||
|
||||
# Lockscreen - requires jirutka/swaylock-effects
|
||||
|
|
22
sway/.local/bin/swaybg-systemd-wrapper
Executable file
22
sway/.local/bin/swaybg-systemd-wrapper
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
args=()
|
||||
output_arg=
|
||||
|
||||
while [ ! -z "$1" ]; do
|
||||
if [ "$1" == "-o" ]; then
|
||||
output_arg="$2"
|
||||
fi
|
||||
args+=("$1")
|
||||
shift
|
||||
done
|
||||
|
||||
[ -z "$output_arg" ] && exit 1
|
||||
|
||||
if [ "$output_arg" == '*' ]; then
|
||||
output_arg="all"
|
||||
fi
|
||||
|
||||
systemctl --user stop "swaybg-$output_arg" >& /dev/null 2>&1 || true
|
||||
|
||||
systemd-run --user --unit="swaybg-$output_arg" --property=Restart=on-failure --property=RestartSec=1 swaybg "${args[@]}"
|
Loading…
Reference in a new issue