New backup 2024-04-10 15:30:03
This commit is contained in:
parent
fb795c3d01
commit
4aacbde6a4
2 changed files with 43 additions and 1 deletions
|
@ -5,4 +5,4 @@ output eDP-1 {
|
||||||
# bg $HOME/.config/sway/assets/wallpaper/eDP-1/_default.jpg fill
|
# bg $HOME/.config/sway/assets/wallpaper/eDP-1/_default.jpg fill
|
||||||
}
|
}
|
||||||
|
|
||||||
exec_always $HOME/.config/sway/scripts/wallpaper
|
exec_always "killall sway-wallpaper;$HOME/.config/sway/scripts/sway-wallpaper"
|
||||||
|
|
42
de/home/.config/sway/scripts/sway-wallpaper
Executable file
42
de/home/.config/sway/scripts/sway-wallpaper
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
getpids() {
|
||||||
|
pids=( $(pgrep swaybg) )
|
||||||
|
}
|
||||||
|
|
||||||
|
killpids() {
|
||||||
|
for i in ${pids[@]};do
|
||||||
|
kill "${i}" && echo "killed ${i}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
getwpno() {
|
||||||
|
wpno_last="${wpno}"
|
||||||
|
wpno=$(printf "%02d\n" $(($(echo "$1" | awk '{print $1}' | grep -o "^[1-9]*")-1)) | cut -c 1 | sed 's/[^0-9]*//g')
|
||||||
|
}
|
||||||
|
|
||||||
|
setbg() {
|
||||||
|
swaybg -i "$HOME/.config/sway/assets/wallpaper/${output}/${wpno}.jpg" -o "${output}" &
|
||||||
|
}
|
||||||
|
|
||||||
|
wpno_last="9"
|
||||||
|
|
||||||
|
getpids
|
||||||
|
|
||||||
|
output=$(swaymsg -t get_outputs | jq -r '.[] | {name} | "\(.name)"')
|
||||||
|
workspace=$(swaymsg -t get_workspaces | jq -r '.[] | select(.focused) | {name} | "\(.name)"')
|
||||||
|
getwpno "${workspace}"
|
||||||
|
setbg "${output}" "${wpno}"
|
||||||
|
|
||||||
|
killpids
|
||||||
|
|
||||||
|
swaymsg -r -t subscribe -m '["workspace"]' | jq -rc --unbuffered 'select(.change == "focus") | .current | "\(.name) \(.output)"' | while read name output;do
|
||||||
|
wsno=$(($(echo "$name" | awk '{print $1}' | grep -o "^[1-9]*")-1))
|
||||||
|
getpids
|
||||||
|
getwpno "${name}"
|
||||||
|
|
||||||
|
if [[ "${wpno}" -ne "${wpno_last}" ]];then
|
||||||
|
setbg "${output}" "${wpno}"
|
||||||
|
killpids
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Add table
Reference in a new issue