From 07d294425a98ee5d1e22d03e2b24ae2c76e487c0 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Sat, 23 Aug 2025 12:42:37 +0900 Subject: updates --- mac/.config/sketchybar.mon/plugins/space.sh | 62 +++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 mac/.config/sketchybar.mon/plugins/space.sh (limited to 'mac/.config/sketchybar.mon/plugins/space.sh') diff --git a/mac/.config/sketchybar.mon/plugins/space.sh b/mac/.config/sketchybar.mon/plugins/space.sh new file mode 100755 index 0000000..70f3ac4 --- /dev/null +++ b/mac/.config/sketchybar.mon/plugins/space.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +source "$CONFIG_DIR/globalstyles.sh" + +if [ "$SELECTED" = "true" ]; then + COLOR=$HIGHLIGHT + OFFSET=-12 # under line + WIDTH="dynamic" +else + COLOR=$TRANSPARENT +fi + +sketchybar --animate tanh 10 \ + --set $NAME icon.highlight=$SELECTED \ + label.highlight=$SELECTED \ + background.color=$COLOR \ + background.y_offset=$OFFSET + +update() { + source "$CONFIG_DIR/colors.sh" + COLOR=$BACKGROUND_2 + WIDTH="dynamic" + + sketchybar --set $NAME icon.highlight=$SELECTED \ + label.highlight=$SELECTED \ + background.border_color=$COLOR \ + sketchybar --animate tanh 8 \ + label.width=$WIDTH \ +} + +set_space_label() { + sketchybar --set $NAME icon="$@" +} + +mouse_clicked() { + if [ "$BUTTON" = "right" ]; then + yabai -m space --destroy $SID + sketchybar --trigger space_change --trigger windows_on_spaces + else + if [ "$MODIFIER" = "shift" ]; then + SPACE_LABEL="$(osascript -e "return (text returned of (display dialog \"Give a name to space $NAME:\" default answer \"\" with icon note buttons {\"Cancel\", \"Continue\"} default button \"Continue\"))")" + if [ $? -eq 0 ]; then + if [ "$SPACE_LABEL" = "" ]; then + set_space_label "${NAME:6}" + else + set_space_label "${NAME:6} ($SPACE_LABEL)" + fi + fi + else + yabai -m space --focus $SID 2>/dev/null + fi + fi +} + +case "$SENDER" in +"mouse.clicked") + mouse_clicked + ;; +*) + update + ;; +esac -- cgit v1.2.3