New backup 2024-04-10 13:00:05
This commit is contained in:
parent
18784afa5e
commit
3440207ce4
1 changed files with 40 additions and 0 deletions
40
de/home/.config/sway/scripts/wallpapera
Executable file
40
de/home/.config/sway/scripts/wallpapera
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
pgrep swaybg
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
output=$(swaymsg -t get_outputs | jq -r '.[] | {name} | "\(.name)"')
|
||||||
|
wsno=$(swaymsg -t get_workspaces | jq -r '.[] | select(.focused) | {name} | "\(.name)"' | awk '{print $1}' | grep -o "^[1-9]*")
|
||||||
|
wpid=$(($(printf "%02d\n" $wsno)-1))
|
||||||
|
wpid=$(echo "${wpid:0:1}")
|
||||||
|
swaybg -i "$HOME/.config/sway/assets/wallpaper/${output}/${wpid}.jpg" -o "${output}" &
|
||||||
|
bgpid=$!
|
||||||
|
|
||||||
|
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))
|
||||||
|
wpid=$(printf "%02d\n" $wsno | cut -c 1)
|
||||||
|
# wpid=$(echo "${wpid:0:1}")
|
||||||
|
echo $wpid
|
||||||
|
echo $output
|
||||||
|
# if ((1<=$wsno && $wsno<=10))
|
||||||
|
# then
|
||||||
|
# echo "480p"
|
||||||
|
# elif ((11<=X && X<=20))
|
||||||
|
# then
|
||||||
|
# echo "720p"
|
||||||
|
# elif ((21<=X && X<=30))
|
||||||
|
# then
|
||||||
|
# echo "1080p"
|
||||||
|
# elif ((31<=$wsno && $wsno<= ))
|
||||||
|
# echo "DVD"
|
||||||
|
# fi
|
||||||
|
echo "$HOME/.config/sway/assets/wallpaper/${output}/${wpid}.jpg"
|
||||||
|
old_bgpid=$bgpid
|
||||||
|
swaybg -i "$HOME/.config/sway/assets/wallpaper/${output}/${wpid}.jpg" -o "${output}" &
|
||||||
|
bgpid=$!
|
||||||
|
# bash -c "sleep 0.5;kill $old_bgpid" &
|
||||||
|
# sleep 0.2
|
||||||
|
kill $old_bgpid & echo "killing $old_bgpid"
|
||||||
|
done
|
Loading…
Add table
Reference in a new issue