diff --git a/eww/sh/osd/osd.sh b/eww/sh/osd/osd.sh new file mode 100644 index 0000000..ae5b516 --- /dev/null +++ b/eww/sh/osd/osd.sh @@ -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; \ No newline at end of file