Candyrice/eww/sh/osd/osd.sh

21 lines
457 B
Bash
Raw Normal View History

2024-08-01 18:33:40 +00:00
#!/bin/bash
2024-08-03 12:10:09 +00:00
pidfile="~/.config/eww/sh/osd/osd.pid"
2024-08-01 18:33:40 +00:00
osd_id="$1"
function close() {
sleep 1.4s;
eww close $osd_id 1> /dev/null;
}
active=$(eww active-windows| grep "osd_" | cut -d":" -f1)
if [[ -n "$active" ]]; then
kill $(cat $pidfile);
if [[ "$active" != "$osd_id" ]]; then
echo $active
eww close "$active" 1> /dev/null;
fi;
else
eww open osd --arg osdtype=$osd_id --id $osd_id > /dev/null;
fi;
close & echo $! > $pidfile;