feat(darwin): add sketchybar
to yabai
module
This commit is contained in:
parent
7df97750b7
commit
89d280b7af
10 changed files with 288 additions and 9 deletions
modules/nix-darwin/yabai/sketchybar/plugins
34
modules/nix-darwin/yabai/sketchybar/plugins/battery.sh
Executable file
34
modules/nix-darwin/yabai/sketchybar/plugins/battery.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
|
||||
PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
|
||||
CHARGING=$(pmset -g batt | grep 'AC Power')
|
||||
|
||||
if [ ${PERCENTAGE} = "" ]; then
|
||||
exit 0
|
||||
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=""
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ${CHARGING} != "" ]; then
|
||||
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}%"
|
8
modules/nix-darwin/yabai/sketchybar/plugins/clock.sh
Executable file
8
modules/nix-darwin/yabai/sketchybar/plugins/clock.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/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')"
|
||||
|
8
modules/nix-darwin/yabai/sketchybar/plugins/front_app.sh
Executable file
8
modules/nix-darwin/yabai/sketchybar/plugins/front_app.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/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
|
||||
|
||||
sketchybar --set ${NAME} label="${INFO}"
|
23
modules/nix-darwin/yabai/sketchybar/plugins/space.sh
Executable file
23
modules/nix-darwin/yabai/sketchybar/plugins/space.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/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
|
||||
|
||||
BACKGROUND_COLOR=0x502a2d3d
|
||||
HIGHLIGHT_COLOR=0x90faafa6
|
||||
|
||||
appearance=$(defaults read -g AppleInterfaceStyle)
|
||||
|
||||
if [[ ${appearance} != 'Dark' ]]; then
|
||||
BACKGROUND_COLOR=0x50f5f0f5
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "${SELECTED}" == "true" ]; then
|
||||
sketchybar --set ${NAME} background.color=${HIGHLIGHT_COLOR}
|
||||
else
|
||||
sketchybar --set ${NAME} background.color=${BACKGROUND_COLOR} \
|
||||
blur_radius=30
|
||||
fi
|
1
modules/nix-darwin/yabai/sketchybar/plugins/theme.sh
Executable file
1
modules/nix-darwin/yabai/sketchybar/plugins/theme.sh
Executable file
|
@ -0,0 +1 @@
|
|||
#!/bin/sh
|
18
modules/nix-darwin/yabai/sketchybar/plugins/volume.sh
Executable file
18
modules/nix-darwin/yabai/sketchybar/plugins/volume.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
# The volume_change event supplies a ${INFO} variable in which the current volume
|
||||
# percentage is passed to the script.
|
||||
|
||||
VOLUME=${INFO}
|
||||
|
||||
case ${VOLUME} in
|
||||
[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}%"
|
8
modules/nix-darwin/yabai/sketchybar/plugins/wifi.sh
Executable file
8
modules/nix-darwin/yabai/sketchybar/plugins/wifi.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
# The wifi_change event supplies a ${INFO} variable in which the current SSID
|
||||
# is passed to the script.
|
||||
|
||||
WIFI=${INFO:-"Not Connected"}
|
||||
|
||||
sketchybar --set ${NAME} label="${WIFI}"
|
Loading…
Add table
Add a link
Reference in a new issue