From e1556d9316bd35be04d829cb2c53250ac82e8ce0 Mon Sep 17 00:00:00 2001 From: Candifloss Date: Thu, 1 Aug 2024 18:33:40 +0000 Subject: [PATCH] Add eww/sh/osd/osd.sh --- eww/sh/osd/osd.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 eww/sh/osd/osd.sh 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