From 36544f8606b525437316bfc5819bc28fa58dcee3 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Fri, 7 Jun 2024 16:44:53 -0700 Subject: [PATCH] sketchybar --- .config/sketchybar/plugins/battery.sh | 14 +++--- .config/sketchybar/plugins/clock.sh | 8 ---- .config/sketchybar/plugins/space.sh | 7 --- .config/sketchybar/plugins/volume.sh | 8 ++-- .../plugins/{network.sh => wifi.sh} | 0 .config/sketchybar/sketchybarrc | 47 +++++++++++-------- 6 files changed, 38 insertions(+), 46 deletions(-) delete mode 100755 .config/sketchybar/plugins/clock.sh delete mode 100755 .config/sketchybar/plugins/space.sh rename .config/sketchybar/plugins/{network.sh => wifi.sh} (100%) diff --git a/.config/sketchybar/plugins/battery.sh b/.config/sketchybar/plugins/battery.sh index 9dd9627..72bee5f 100755 --- a/.config/sketchybar/plugins/battery.sh +++ b/.config/sketchybar/plugins/battery.sh @@ -8,21 +8,21 @@ if [ "$PERCENTAGE" = "" ]; then fi case "${PERCENTAGE}" in - 9[0-9]|100) ICON="" + 9[0-9]|100) ICON=􀛨 ;; - [6-8][0-9]) ICON="" + [6-8][0-9]) ICON=􀺸 ;; - [3-5][0-9]) ICON="" + [3-5][0-9]) ICON=􀺶 ;; - [1-2][0-9]) ICON="" + [1-2][0-9]) ICON=􀛩 ;; - *) ICON="" + *) ICON=􀛪 esac if [[ "$CHARGING" != "" ]]; then - ICON="" + ICON=􀢋 fi # The item invoking this script (name $NAME) will get its icon and label # updated with the current battery status -sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}%" +sketchybar --set "$NAME" icon="$ICON" label="$PERCENTAGE%" diff --git a/.config/sketchybar/plugins/clock.sh b/.config/sketchybar/plugins/clock.sh deleted file mode 100755 index 6cc739b..0000000 --- a/.config/sketchybar/plugins/clock.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# The $NAME variable is passed from sketchybar and holds the name of -# the item invoking this script: -# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting - -sketchybar --set "$NAME" label="$(date '+%d/%m %H:%M')" - diff --git a/.config/sketchybar/plugins/space.sh b/.config/sketchybar/plugins/space.sh deleted file mode 100755 index b8602b5..0000000 --- a/.config/sketchybar/plugins/space.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# The $SELECTED variable is available for space components and indicates if -# the space invoking this script (with name: $NAME) is currently selected: -# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item - -sketchybar --set "$NAME" background.drawing="$SELECTED" diff --git a/.config/sketchybar/plugins/volume.sh b/.config/sketchybar/plugins/volume.sh index 6e69a5d..0f21e36 100755 --- a/.config/sketchybar/plugins/volume.sh +++ b/.config/sketchybar/plugins/volume.sh @@ -7,13 +7,13 @@ if [ "$SENDER" = "volume_change" ]; then VOLUME="$INFO" case "$VOLUME" in - [6-9][0-9]|100) ICON="󰕾" + [6-9][0-9]|100) ICON=􀊩 ;; - [3-5][0-9]) ICON="󰖀" + [3-5][0-9]) ICON=􀊧 ;; - [1-9]|[1-2][0-9]) ICON="󰕿" + [1-9]|[1-2][0-9]) ICON=􀊥 ;; - *) ICON="󰖁" + *) ICON=􀊣 esac sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%" diff --git a/.config/sketchybar/plugins/network.sh b/.config/sketchybar/plugins/wifi.sh similarity index 100% rename from .config/sketchybar/plugins/network.sh rename to .config/sketchybar/plugins/wifi.sh diff --git a/.config/sketchybar/sketchybarrc b/.config/sketchybar/sketchybarrc index a74c2f3..f0fb213 100755 --- a/.config/sketchybar/sketchybarrc +++ b/.config/sketchybar/sketchybarrc @@ -26,26 +26,26 @@ default=( label.font="SauceCodePro Nerd Font:Regular:14.0" icon.color=0xffffffff label.color=0xffffffff - icon.padding_left=4 - icon.padding_right=4 - label.padding_left=4 - label.padding_right=4 + icon.padding_left=3 + icon.padding_right=3 + label.padding_left=3 + label.padding_right=3 ) sketchybar --default "${default[@]}" ### Aerospace sketchybar --add event aerospace_workspace_change -sketchybar --add item focused_workspace left \ - --subscribe focused_workspace aerospace_workspace_change \ - --set focused_workspace \ - background.color=0x44ffffff \ - background.corner_radius=5 \ - background.height=20 \ - background.drawing=off \ - icon.drawing=off \ - label="$(aerospace list-workspaces --focused)" \ - script="$CONFIG_DIR/plugins/aerospace.sh" +sketchybar --add item aerospace left \ + --subscribe aerospace aerospace_workspace_change \ + --set aerospace \ + background.color=0x44ffffff \ + background.corner_radius=5 \ + background.height=20 \ + background.drawing=off \ + icon.drawing=off \ + label="$(aerospace list-workspaces --focused)" \ + script="$CONFIG_DIR/plugins/aerospace.sh" ##### Adding Left Items ##### # We add some regular items to the left side of the bar, where @@ -71,15 +71,22 @@ sketchybar --add item datetime right \ --add item wifi right \ --subscribe wifi wifi_change \ --set wifi \ - label.drawing=off \ - update_freq=30 \ - script="$PLUGIN_DIR/network.sh" \ + label.drawing=off \ + update_freq=30 \ + script="$PLUGIN_DIR/wifi.sh" \ --add item volume right \ - --set volume script="$PLUGIN_DIR/volume.sh" \ + --set volume \ + label.drawing=off \ + click_script="sketchybar -m --set \$NAME label.drawing=toggle" \ + script="$PLUGIN_DIR/volume.sh" \ --subscribe volume volume_change \ --add item battery right \ - --set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \ - --subscribe battery system_woke power_source_change \ + --set battery \ + label.drawing=off \ + update_freq=120 \ + click_script="sketchybar -m --set \$NAME label.drawing=toggle" \ + script="$PLUGIN_DIR/battery.sh" \ + --subscribe battery system_woke power_source_change ##### Force all scripts to run the first time (never do this in a script) ##### sketchybar --update