Candyrice/eww/sh/osd/osd.sh
2024-08-08 21:13:44 +05:30

21 lines
457 B
Bash
Executable File

#!/bin/bash
pidfile="~/.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;