diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-23 12:42:37 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-23 12:42:37 +0900 |
| commit | 07d294425a98ee5d1e22d03e2b24ae2c76e487c0 (patch) | |
| tree | a6818f0d64438c5fdb88b00a35d944f80c056213 /mac/.config/sketchybar.allapp/plugins/space.sh | |
| parent | 6fc28cdb3529ca8ee864cb5c41674cb0a4af72a1 (diff) | |
updates
Diffstat (limited to 'mac/.config/sketchybar.allapp/plugins/space.sh')
| -rwxr-xr-x | mac/.config/sketchybar.allapp/plugins/space.sh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/mac/.config/sketchybar.allapp/plugins/space.sh b/mac/.config/sketchybar.allapp/plugins/space.sh new file mode 100755 index 0000000..978fc38 --- /dev/null +++ b/mac/.config/sketchybar.allapp/plugins/space.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +#echo space.sh $'FOCUSED_WORKSPACE': $FOCUSED_WORKSPACE, $'SELECTED': $SELECTED, NAME: $NAME, SENDER: $SENDER >> ~/aaaa + +update() { + # 처음 시작에만 작동하기 위해서 + # 현재 forced, space_change 이벤트가 동시에 발생하고 있다. + if [ "$SENDER" = "space_change" ]; then + #echo space.sh $'FOCUSED_WORKSPACE': $FOCUSED_WORKSPACE, $'SELECTED': $SELECTED, NAME: $NAME, SENDER: $SENDER, INFO: $INFO >> ~/aaaa + #echo $(aerospace list-workspaces --focused) >> ~/aaaa + source "$CONFIG_DIR/colors.sh" + COLOR=$BACKGROUND_2 + if [ "$SELECTED" = "true" ]; then + COLOR=$GREY + fi + # sketchybar --set $NAME icon.highlight=$SELECTED \ + # label.highlight=$SELECTED \ + # background.border_color=$COLOR + + sketchybar --set space.$(aerospace list-workspaces --focused) icon.highlight=true \ + label.highlight=true \ + background.border_color=$GREY + fi +} + +set_space_label() { + sketchybar --set $NAME icon="$@" +} + +mouse_clicked() { + if [ "$BUTTON" = "right" ]; then + # yabai -m space --destroy $SID + echo '' + 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 + #echo space.sh BUTTON: $BUTTON, $'SELECTED': $SELECTED, MODIFIER: $MODIFIER, NAME: $NAME, SENDER: $SENDER, INFO: $INFO, TEST: ${NAME#*.}, ${NAME:6} >> ~/aaaa + aerospace workspace ${NAME#*.} + fi + fi +} + +# echo plugin_space.sh $SENDER >> ~/aaaa +case "$SENDER" in + "mouse.clicked") mouse_clicked + ;; + *) update + ;; +esac |
