FelixKratz / SketchyBar

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

running sketchybar as a service is not displaying a pomodoro timer #282

Closed NationAdel closed 2 years ago

NationAdel commented 2 years ago

Hi this is my setup

/items

#!/usr/bin/env sh

sketchybar --add item     pomo right                   \
           --set pomo     update_freq=1                \
                          label.width=110              \
                          label.color=$BLACK           \
                          label.drawing=on             \
                          align=center                 \
                          script="$PLUGIN_DIR/pomo.sh" \
                          background.color=0xffb8c0e0  \
                          background.height=26         \
                          background.corner_radius=11

                          # label.padding_right=15       \
                          # icon=🍅                      \
                          # icon.padding_left=10         \
                          # icon.align=left              \

and sketchybar rc

#!/usr/bin/env sh
sketchybar --set  $NAME label="$(pomo)"

so basically i copied the sketchybar default clock:date config. it working fine when a run sketchybar on the command line, but it displays nothing when run as a brew service.

This is the pomo repo https://github.com/rwxrob/pomo

FelixKratz commented 2 years ago

What happens if you give the script the absolute path to your application, i.e. the output of:

which pomo

instead of just pomo?

I think it is likely a problem that the installation is not in a globally available scope and thus it can not be found by the script that runs through sh -c. If it is run through commandline it will inherit all current environment variables, which it will not if started as a service.