mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-21 19:03:12 +00:00
improve default config
This commit is contained in:
parent
8c1971dc85
commit
c6b8aa8288
6 changed files with 61 additions and 75 deletions
|
@ -1,13 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
|
||||
CHARGING=$(pmset -g batt | grep 'AC Power')
|
||||
PERCENTAGE="$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)"
|
||||
CHARGING="$(pmset -g batt | grep 'AC Power')"
|
||||
|
||||
if [ $PERCENTAGE = "" ]; then
|
||||
if [ "$PERCENTAGE" = "" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case ${PERCENTAGE} in
|
||||
case "${PERCENTAGE}" in
|
||||
9[0-9]|100) ICON=""
|
||||
;;
|
||||
[6-8][0-9]) ICON=""
|
||||
|
@ -19,10 +19,10 @@ case ${PERCENTAGE} in
|
|||
*) ICON=""
|
||||
esac
|
||||
|
||||
if [[ $CHARGING != "" ]]; then
|
||||
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}%"
|
||||
sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}%"
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
# the item invoking this script:
|
||||
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
|
||||
|
||||
sketchybar --set $NAME label="$(date '+%d/%m %H:%M')"
|
||||
sketchybar --set "$NAME" label="$(date '+%d/%m %H:%M')"
|
||||
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
|
||||
|
||||
if [ "$SENDER" = "front_app_switched" ]; then
|
||||
sketchybar --set $NAME label="$INFO"
|
||||
sketchybar --set "$NAME" label="$INFO"
|
||||
fi
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
# 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
|
||||
sketchybar --set "$NAME" background.drawing="$SELECTED"
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
# percentage is passed to the script.
|
||||
|
||||
if [ "$SENDER" = "volume_change" ]; then
|
||||
VOLUME=$INFO
|
||||
VOLUME="$INFO"
|
||||
|
||||
case $VOLUME in
|
||||
case "$VOLUME" in
|
||||
[6-9][0-9]|100) ICON=""
|
||||
;;
|
||||
[3-5][0-9]) ICON=""
|
||||
|
@ -16,5 +16,5 @@ if [ "$SENDER" = "volume_change" ]; then
|
|||
*) ICON=""
|
||||
esac
|
||||
|
||||
sketchybar --set $NAME icon="$ICON" label="$VOLUME%"
|
||||
sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%"
|
||||
fi
|
||||
|
|
112
sketchybarrc
112
sketchybarrc
|
@ -1,76 +1,70 @@
|
|||
# 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:
|
||||
# This is a demo config to showcase some of the most important commands.
|
||||
# It is meant to be changed and configured, as it is intentionally kept sparse.
|
||||
# For a (much) more advanced configuration example see my dotfiles:
|
||||
# https://github.com/FelixKratz/dotfiles
|
||||
|
||||
PLUGIN_DIR="$CONFIG_DIR/plugins"
|
||||
|
||||
##### Bar Appearance #####
|
||||
# Configuring the general appearance of the bar, these are only some of the
|
||||
# options available. For all options see:
|
||||
# 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
|
||||
sketchybar --bar position=top height=40 blur_radius=30 color=0x40000000
|
||||
|
||||
##### Changing Defaults #####
|
||||
# We now change some default values that are applied to all further items
|
||||
# We now change some default values, which 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
|
||||
default=(
|
||||
padding_left=5
|
||||
padding_right=5
|
||||
icon.font="Hack Nerd Font:Bold:17.0"
|
||||
label.font="Hack Nerd Font:Bold:14.0"
|
||||
icon.color=0xffffffff
|
||||
label.color=0xffffffff
|
||||
icon.padding_left=4
|
||||
icon.padding_right=4
|
||||
label.padding_left=4
|
||||
label.padding_right=4
|
||||
)
|
||||
sketchybar --default "${default[@]}"
|
||||
|
||||
##### Adding Mission Control Space Indicators #####
|
||||
# Now we add some mission control spaces:
|
||||
# Let's 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
|
||||
# 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 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"
|
||||
sid="$(($i+1))"
|
||||
space=(
|
||||
space="$sid"
|
||||
icon="${SPACE_ICONS[i]}"
|
||||
icon.padding_left=7
|
||||
icon.padding_right=7
|
||||
background.color=0x40ffffff
|
||||
background.corner_radius=5
|
||||
background.height=25
|
||||
label.drawing=off
|
||||
script="$PLUGIN_DIR/space.sh"
|
||||
click_script="yabai -m space --focus $sid"
|
||||
)
|
||||
sketchybar --add space space."$sid" left --set space."$sid" "${space[@]}"
|
||||
done
|
||||
|
||||
##### Adding Left Items #####
|
||||
# We add some regular items to the left side of the bar
|
||||
# We add some regular items to the left side of the bar, where
|
||||
# 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 \
|
||||
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
|
||||
|
||||
##### Adding Right Items #####
|
||||
|
@ -84,22 +78,14 @@ sketchybar --add item space_separator left \
|
|||
# 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 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 \
|
||||
sketchybar --add item clock 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
|
||||
|
||||
##### 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.
|
||||
|
||||
##### Force all scripts to run the first time (never do this in a script) #####
|
||||
sketchybar --update
|
||||
|
|
Loading…
Reference in a new issue