New backup 2024-04-15 21:00:02

This commit is contained in:
Penelope Gwen 2024-04-15 21:00:02 -06:00
parent 98b5529ef7
commit 4bafe8cc04
3 changed files with 10 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 KiB

View file

@ -5,15 +5,16 @@ getpids() {
}
killpids() {
sleep 5
# sleep 5
for i in ${pids[@]};do
kill "${i}" && echo "killed ${i}"
done
}
getwpno() {
wpno_last="${wpno}"
# 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')
echo "${wpno}" | tee "$HOME/.cache/sway-wallpaper/${2}"
}
setbg() {
@ -21,21 +22,25 @@ setbg() {
swaymsg output "${output}" bg "$HOME/.config/sway/assets/wallpaper/${output}/${wpno}.jpg" fill
}
wpno_last="9"
#wpno_last="9"
getpids
output=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | {name} | "\(.name)"')
workspace=$(swaymsg -t get_workspaces | jq -r '.[] | select(.focused) | {name} | "\(.name)"')
getwpno "${workspace}"
getwpno "${workspace}" "${output}"
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))
echo $name
echo $output
getpids
getwpno "${name}"
wpno_last=$(cat "$HOME/.cache/sway-wallpaper/${output}")
getwpno "${name}" "${output}"
echo "${wpno_last}"
if [[ "${wpno}" -ne "${wpno_last}" ]];then
echo "hi"