summaryrefslogtreecommitdiff
path: root/mac/.config/sketchybar.allapp/plugins/front_app.sh
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-08-23 12:42:37 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-08-23 12:42:37 +0900
commit07d294425a98ee5d1e22d03e2b24ae2c76e487c0 (patch)
treea6818f0d64438c5fdb88b00a35d944f80c056213 /mac/.config/sketchybar.allapp/plugins/front_app.sh
parent6fc28cdb3529ca8ee864cb5c41674cb0a4af72a1 (diff)
updates
Diffstat (limited to 'mac/.config/sketchybar.allapp/plugins/front_app.sh')
-rwxr-xr-xmac/.config/sketchybar.allapp/plugins/front_app.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/mac/.config/sketchybar.allapp/plugins/front_app.sh b/mac/.config/sketchybar.allapp/plugins/front_app.sh
new file mode 100755
index 0000000..2426503
--- /dev/null
+++ b/mac/.config/sketchybar.allapp/plugins/front_app.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# Some events send additional information specific to the event in the $INFO
+# variable. E.g. the front_app_switched event sends the name of the newly
+# focused application in the $INFO variable:
+# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
+
+AEROSPACE_FOCUSED_MONITOR_NO=$(aerospace list-workspaces --focused)
+AEROSPACE_LIST_OF_WINDOWS_IN_FOCUSED_MONITOR=$(aerospace list-windows --workspace $AEROSPACE_FOCUSED_MONITOR_NO | awk -F'|' '{gsub(/^ *| *$/, "", $2); print $2}')
+
+if [ "$SENDER" = "front_app_switched" ]; then
+ #echo name:$NAME INFO: $INFO SENDER: $SENDER, SID: $SID >> ~/aaaa
+ sketchybar --set "$NAME" label="$INFO" icon.background.image="app.$INFO" icon.background.image.scale=0.8
+
+ apps=$AEROSPACE_LIST_OF_WINDOWS_IN_FOCUSED_MONITOR
+ icon_strip=" "
+ if [ "${apps}" != "" ]; then
+ while read -r app
+ do
+ icon_strip+=" $($CONFIG_DIR/plugins/icon_map.sh "$app")"
+ done <<< "${apps}"
+ else
+ icon_strip=" —"
+ fi
+ sketchybar --set space.$AEROSPACE_FOCUSED_MONITOR_NO label="$icon_strip"
+fi