mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
style: format shell scripts
This commit is contained in:
parent
8c5babe80a
commit
76b5fd4118
18 changed files with 231 additions and 242 deletions
|
|
@ -4,7 +4,7 @@
|
|||
# chmod +x ~/.config/sketchybar/plugins/aerospace.sh
|
||||
|
||||
if [ "$1" = "$FOCUSED_WORKSPACE" ]; then
|
||||
sketchybar --set $NAME background.drawing=on
|
||||
sketchybar --set $NAME background.drawing=on
|
||||
else
|
||||
sketchybar --set $NAME background.drawing=off
|
||||
sketchybar --set $NAME background.drawing=off
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -8,15 +8,19 @@ if [ "$PERCENTAGE" = "" ]; then
|
|||
fi
|
||||
|
||||
case "${PERCENTAGE}" in
|
||||
9[0-9]|100) ICON=""
|
||||
;;
|
||||
[6-8][0-9]) ICON=""
|
||||
;;
|
||||
[3-5][0-9]) ICON=""
|
||||
;;
|
||||
[1-2][0-9]) ICON=""
|
||||
;;
|
||||
*) ICON=""
|
||||
9[0-9] | 100)
|
||||
ICON=""
|
||||
;;
|
||||
[6-8][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
[3-5][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
[1-2][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
*) ICON="" ;;
|
||||
esac
|
||||
|
||||
if [[ "$CHARGING" != "" ]]; then
|
||||
|
|
|
|||
|
|
@ -5,4 +5,3 @@
|
|||
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
|
||||
|
||||
sketchybar --set "$NAME" label="$(date '+%d日周%u %H:%M')"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
music_info=$(curlie GET http://localhost:10767/api/v1/playback/now-playing | jq -r '"\(.info.name) - \(.info.artistName)"')
|
||||
|
||||
|
||||
ICON=""
|
||||
|
||||
sketchybar --set $NAME label="$music_info" icon="$ICON"
|
||||
|
|
|
|||
|
|
@ -7,13 +7,16 @@ if [ "$SENDER" = "volume_change" ]; then
|
|||
VOLUME="$INFO"
|
||||
|
||||
case "$VOLUME" in
|
||||
[6-9][0-9]|100) ICON=""
|
||||
;;
|
||||
[3-5][0-9]) ICON=""
|
||||
;;
|
||||
[1-9]|[1-2][0-9]) ICON=""
|
||||
;;
|
||||
*) ICON=""
|
||||
[6-9][0-9] | 100)
|
||||
ICON=""
|
||||
;;
|
||||
[3-5][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
[1-9] | [1-2][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
*) ICON="" ;;
|
||||
esac
|
||||
|
||||
sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%"
|
||||
|
|
|
|||
|
|
@ -42,9 +42,8 @@ sketchybar --default "${default[@]}"
|
|||
# to indicate active and available mission control spaces.
|
||||
|
||||
SPACE_ICONS=("" "" "" "" "" "" "7" "8" "9" "10")
|
||||
for i in "${!SPACE_ICONS[@]}"
|
||||
do
|
||||
sid="$(($i+1))"
|
||||
for i in "${!SPACE_ICONS[@]}"; do
|
||||
sid="$(($i + 1))"
|
||||
space=(
|
||||
space="$sid"
|
||||
icon="${SPACE_ICONS[i]}"
|
||||
|
|
@ -65,10 +64,10 @@ done
|
|||
# only the properties deviating from the current defaults need to be set
|
||||
|
||||
sketchybar --add item chevron left \
|
||||
--set chevron icon= label.drawing=off \
|
||||
--add item front_app left \
|
||||
--set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \
|
||||
--subscribe front_app front_app_switched
|
||||
--set chevron icon= label.drawing=off \
|
||||
--add item front_app left \
|
||||
--set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \
|
||||
--subscribe front_app front_app_switched
|
||||
|
||||
##### Adding Right Items #####
|
||||
# In the same way as the left items we can add items to the right side.
|
||||
|
|
@ -82,37 +81,36 @@ sketchybar --add item chevron left \
|
|||
# https://felixkratz.github.io/SketchyBar/config/events
|
||||
|
||||
sketchybar --add item clock center \
|
||||
--set clock update_freq=10 icon= script="$PLUGIN_DIR/clock.sh" \
|
||||
--add item volume right \
|
||||
--set volume 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 \
|
||||
--add item apple_music right
|
||||
--set clock update_freq=10 icon= script="$PLUGIN_DIR/clock.sh" \
|
||||
--add item volume right \
|
||||
--set volume 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 \
|
||||
--add item apple_music right
|
||||
|
||||
sketchybar --add item music right
|
||||
sketchybar --set music \
|
||||
script="$PLUGIN_DIR/music.sh" \
|
||||
update_freq=5 \
|
||||
label.color=0xffd7ba7d \
|
||||
background.corner_radius=5
|
||||
script="$PLUGIN_DIR/music.sh" \
|
||||
update_freq=5 \
|
||||
label.color=0xffd7ba7d \
|
||||
background.corner_radius=5
|
||||
|
||||
##### Force all scripts to run the first time (never do this in a script) #####
|
||||
sketchybar --update
|
||||
|
||||
|
||||
sketchybar --add event aerospace_workspace_change
|
||||
|
||||
for sid in $(aerospace list-workspaces --all); do
|
||||
sketchybar --add item space.$sid left \
|
||||
--subscribe space.$sid aerospace_workspace_change \
|
||||
--set space.$sid \
|
||||
background.color=0x44ffffff \
|
||||
background.corner_radius=5 \
|
||||
background.height=20 \
|
||||
background.drawing=off \
|
||||
label="$sid" \
|
||||
click_script="aerospace workspace $sid" \
|
||||
script="$CONFIG_DIR/plugins/aerospace.sh $sid"
|
||||
sketchybar --add item space.$sid left \
|
||||
--subscribe space.$sid aerospace_workspace_change \
|
||||
--set space.$sid \
|
||||
background.color=0x44ffffff \
|
||||
background.corner_radius=5 \
|
||||
background.height=20 \
|
||||
background.drawing=off \
|
||||
label="$sid" \
|
||||
click_script="aerospace workspace $sid" \
|
||||
script="$CONFIG_DIR/plugins/aerospace.sh $sid"
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue