Add eww/sh/osd/osd.sh

This commit is contained in:
Candifloss 2024-08-01 18:33:40 +00:00
parent a156c8cf45
commit e1556d9316

21
eww/sh/osd/osd.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/bash
pidfile="/home/lcm/.config/eww/sh/osd/osd.pid"
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;