21 lines
457 B
Bash
21 lines
457 B
Bash
#!/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; |