FelixKratz / SketchyBar

A highly customizable macOS status bar replacement
https://felixkratz.github.io/SketchyBar/
GNU General Public License v3.0
5.2k stars 82 forks source link

Add feature for TeXLive Manager and outdated packages #524

Closed LukasCBossert closed 3 months ago

LukasCBossert commented 3 months ago

Very similar to the homebrew-module I like to have an overview of outdated TeXLive packages.

I added two files in items and plugins folder and made them executable. But the number is always 0 and therefore it says, no outdated package:

Screenshot 2024-03-23 at 16 15 00

The tlmgr.sh in the plugins-folder

#!/opt/homebrew/bin/bash
# plugins

source "$CONFIG_DIR/colors.sh"

COUNT=$(tlmgr update --list --all --self | grep -c 'local:')
#sleep 5

COLOR=$RED

case "$COUNT" in
  [6-9][0-9]) COLOR=$RED
  ;;
  [3-5][0-9]) COLOR=$ORANGE
  ;;
  [1-2][0-9]) COLOR=$YELLOW
  ;;
  [1-9]) COLOR=$WHITE
  ;;
  0) COLOR=$GREEN
     COUNT=
  ;;
esac

sketchybar     \
  --set $NAME  \
  label=$COUNT \
  icon.color=$COLOR

and the file tlmgr.sh in the folder items:

#!/opt/homebrew/bin/bash
## items
#

tlmgr=(
  icon="" # <-- using Nerd-Font-Icon for TeX
  icon.font="$FONT:normal:30.0"
  label=?
  padding_right=15
    update_freq=20
  script="$PLUGIN_DIR/tlmgr.sh"
)

sketchybar --add event tlmgr_update \
           --add item tlmgr right   \
           --set tlmgr "${tlmgr[@]}" \
           --subscribe tlmgr tlmgr_update

Bonus points: I also like to get the list of outdated packages when I mouse over the TeX icon. Same goes for the outdated packages of homebrew. But I couldnt figure that out.