aboutsummaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/control-center31
1 files changed, 31 insertions, 0 deletions
diff --git a/.local/bin/control-center b/.local/bin/control-center
new file mode 100755
index 0000000..d0b3320
--- /dev/null
+++ b/.local/bin/control-center
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+LOCK_FILE="$HOME/.cache/eww-control-center.lock"
+EWW_BIN="$HOME/.local/bin/eww"
+ACTIVE_PLAYERS=$(playerctl -l | head -n 1)
+
+run() {
+ ${EWW_BIN} open control-center
+ sleep 0.2
+ xdo raise -N eww-bar
+ ${EWW_BIN} update ccenter=true
+
+ sleep 1 && [[ ! -z "$ACTIVE_PLAYERS" ]] && ${EWW_BIN} update mp=true
+}
+
+# Run eww daemon if not running
+if [[ ! `pidof eww` ]]; then
+ ${EWW_BIN} daemon
+ sleep 1
+else
+ if [[ ! -f "$LOCK_FILE" ]]; then
+ touch "$LOCK_FILE"
+ run
+ else
+ [[ ! -z "$ACTIVE_PLAYERS" ]] && ${EWW_BIN} update mp=false && sleep 0.4
+ ${EWW_BIN} update ccenter=false
+ sleep 0.6
+ ${EWW_BIN} close control-center
+ rm "$LOCK_FILE"
+ fi
+fi