SketchyBar
SketchyBar copied to clipboard
Flickering on items with scrolling text enabled
Sometimes (around 40% of the time) I get a weird flickering on items that have scrolling text such as the battery item or the Now Playing item I have.
A restart of the bar clears it most of the time but sometimes it sticks.
Video of the issue:
https://github.com/FelixKratz/SketchyBar/assets/44152511/557ea34e-3c36-43cf-8e4e-0299adacb512
The item file has this:
#!/bin/zsh
sketchybar --add item battery right \
--set battery label.font.size=13.0 \
script="$PLUGIN_DIR/battery.sh" \
update_freq=120 \
--subscribe battery system_woke power_source_change
and the plugin file has the following:
#!/bin/sh
PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
TIME_LEFT=$(pmset -g batt | grep -Eo "\d+:\d+")
CHARGING=$(pmset -g batt | grep 'AC Power')
CALCULATED_TIME="..."
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
if [[ -z $TIME_LEFT ]]; then
echo "Remaining time: $TIME_LEFT"
TIME_LABEL="--:--"
else
TIME_LABEL=$TIME_LEFT
fi
sketchybar --set $NAME label.width=42 label.max_chars=5 scroll_texts=true label.align=center icon="$ICON" label="$TIME_LABEL $PERCENTAGE%"
The bar has the following styles and settings:
BAR_STYLES_BOTTOM=(
position=bottom
sticky=off
topmost=window
height=40
blur_radius=30
padding_left=10
padding_right=10
color=$BAR_COLOR
)