~/Projects/confbook
git clone https://code.lsong.org/confbook
Commit
- Commit
- 6af9c7b7649f80dedfef4ab8cc7e3082c020917c
- Author
- Lsong <[email protected]>
- Date
- 2023-02-06 20:43:47 +0800 +0800
- Diffstat
sketchybar/plugins/battery.sh | 28 ++++++++ sketchybar/plugins/clock.sh | 8 ++ sketchybar/plugins/front_app.sh | 8 ++ sketchybar/plugins/space.sh | 7 ++ sketchybar/plugins/volume.sh | 18 +++++ sketchybar/plugins/wifi.sh | 8 ++ sketchybar/sketchybarrc | 110 +++++++++++++++++++++++++++++++++++
update
diff --git a/eww/README.md b/eww/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 Binary files /dev/null and b/eww/README.md differ diff --git a/sketchybar/README.md b/sketchybar/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 Binary files /dev/null and b/sketchybar/README.md differ diff --git a/sketchybar/plugins/battery.sh b/sketchybar/plugins/battery.sh new file mode 100755 index 0000000000000000000000000000000000000000..d29768b87bf8978639247669168657f4b94bfb4f --- /dev/null +++ b/sketchybar/plugins/battery.sh @@ -0,0 +1,28 @@ +#!/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}%" diff --git a/sketchybar/plugins/clock.sh b/sketchybar/plugins/clock.sh new file mode 100755 index 0000000000000000000000000000000000000000..1a99c6102da41ebd375100f2f4c5be092dd925f2 --- /dev/null +++ b/sketchybar/plugins/clock.sh @@ -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')" + diff --git a/sketchybar/plugins/front_app.sh b/sketchybar/plugins/front_app.sh new file mode 100755 index 0000000000000000000000000000000000000000..87c0b16eb23a5c06d40dee9bb55ee13b7ffa8b0c --- /dev/null +++ b/sketchybar/plugins/front_app.sh @@ -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" diff --git a/sketchybar/plugins/space.sh b/sketchybar/plugins/space.sh new file mode 100755 index 0000000000000000000000000000000000000000..3ae63f9ae60b1bf17dd4215568098bbad8277c3b --- /dev/null +++ b/sketchybar/plugins/space.sh @@ -0,0 +1,7 @@ +#!/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/sketchybar/plugins/volume.sh b/sketchybar/plugins/volume.sh new file mode 100755 index 0000000000000000000000000000000000000000..982995edffd705504e2e87799413740daa715c8c --- /dev/null +++ b/sketchybar/plugins/volume.sh @@ -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%" diff --git a/sketchybar/plugins/wifi.sh b/sketchybar/plugins/wifi.sh new file mode 100755 index 0000000000000000000000000000000000000000..f016a95170f529c8955698c43046ddfb2f29484a --- /dev/null +++ b/sketchybar/plugins/wifi.sh @@ -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}" diff --git a/sketchybar/sketchybarrc b/sketchybar/sketchybarrc new file mode 100755 index 0000000000000000000000000000000000000000..013369c9e356c02c5c7a29b5a6afcc6edb67f31e --- /dev/null +++ b/sketchybar/sketchybarrc @@ -0,0 +1,110 @@ +# This is a demo config to show some of the most important commands more easily. +# This is meant to be changed and configured, as it is intentionally kept sparse. +# For a more advanced configuration example see my dotfiles: +# https://github.com/FelixKratz/dotfiles + +PLUGIN_DIR="$HOME/.config/sketchybar/plugins" + +##### Bar Appearance ##### +# Configuring the general appearance of the bar, these are only some of the +# options available. For all options see: +# https://felixkratz.github.io/SketchyBar/config/bar +# If you are looking for other colors, see the color picker: +# https://felixkratz.github.io/SketchyBar/config/tricks#color-picker + +sketchybar --bar height=32 \ + blur_radius=30 \ + position=top \ + sticky=off \ + padding_left=10 \ + padding_right=10 \ + color=0x15ffffff + +##### Changing Defaults ##### +# We now change some default values that are applied to all further items +# For a full list of all available item properties see: +# https://felixkratz.github.io/SketchyBar/config/items + +sketchybar --default icon.font="Hack Nerd Font:Bold:17.0" \ + icon.color=0xffffffff \ + label.font="Hack Nerd Font:Bold:14.0" \ + label.color=0xffffffff \ + padding_left=5 \ + padding_right=5 \ + label.padding_left=4 \ + label.padding_right=4 \ + icon.padding_left=4 \ + icon.padding_right=4 + +##### Adding Mission Control Space Indicators ##### +# Now we add some mission control spaces: +# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item +# to indicate active and available mission control spaces + +SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10") + +for i in "${!SPACE_ICONS[@]}" +do + sid=$(($i+1)) + sketchybar --add space space.$sid left \ + --set space.$sid associated_space=$sid \ + icon=${SPACE_ICONS[i]} \ + background.color=0x44ffffff \ + background.corner_radius=5 \ + background.height=20 \ + background.drawing=off \ + label.drawing=off \ + script="$PLUGIN_DIR/space.sh" \ + click_script="yabai -m space --focus $sid" +done + +##### Adding Left Items ##### +# We add some regular items to the left side of the bar +# only the properties deviating from the current defaults need to be set + +sketchybar --add item space_separator left \ + --set space_separator icon= \ + padding_left=10 \ + padding_right=10 \ + label.drawing=off \ + \ + --add item front_app left \ + --set front_app script="$PLUGIN_DIR/front_app.sh" \ + icon.drawing=off \ + --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. +# Additional position (e.g. center) are available, see: +# https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar + +# Some items refresh on a fixed cycle, e.g. the clock runs its script once +# every 10s. Other items respond to events they subscribe to, e.g. the +# volume.sh script is only executed once an actual change in system audio +# volume is registered. More info about the event system can be found here: +# https://felixkratz.github.io/SketchyBar/config/events + +sketchybar --add item clock right \ + --set clock update_freq=10 \ + icon= \ + script="$PLUGIN_DIR/clock.sh" \ + \ + --add item wifi right \ + --set wifi script="$PLUGIN_DIR/wifi.sh" \ + icon=直 \ + --subscribe wifi wifi_change \ + \ + --add item volume right \ + --set volume script="$PLUGIN_DIR/volume.sh" \ + --subscribe volume volume_change \ + \ + --add item battery right \ + --set battery script="$PLUGIN_DIR/battery.sh" \ + update_freq=120 \ + --subscribe battery system_woke power_source_change + +##### Finalizing Setup ##### +# The below command is only needed at the end of the initial configuration to +# force all scripts to run the first time, it should never be run in an item script. + +sketchybar --update diff --git a/yabai/README.md b/yabai/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 Binary files /dev/null and b/yabai/README.md differ