FelixKratz / SketchyBar

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

availability of commands (`brew services start sketchybar` vs `sketchybar`) #433

Closed rwijtvliet closed 9 months ago

rwijtvliet commented 9 months ago

I'm using an external script in my sketchybar config, which is on my path (in /usr/local/bin/), and I've noticed it is working fine when starting the app with sketchybar, but it's failing when using brew services start sketchybar. I can probably work around it, but was wondering if this is a known issue with a known solution.

As an aside, I noticed that yabai and skhd recently changed from using brew services start yabai to yabai --start-service. But this could be for unrelated reasons.

FelixKratz commented 9 months ago

Try placing it in one of the paths included in the brew service search path instead of /usr/local/bin then it should work. The brew service has a limited search path, configured by me in the brew formula here: https://github.com/FelixKratz/homebrew-formulae/blob/5ba77c787b09f918989dec98f953c1d6f2a7c45c/sketchybar.rb#L64

where the search paths are configured as:

{HOMEBREW_PREFIX}/bin:#{HOMEBREW_PREFIX}/sbin:/usr/bin:/bin:/usr/sbin:/sbin

But I could also imagine adding /usr/local/bin to that search path...

rwijtvliet commented 9 months ago

Thanks for the fast reply. I made a typo; the script is actually in /usr/local/bin (I edited the question).

FelixKratz commented 9 months ago

I edited the response too, I could imagine adding /usr/local/bin to the default search paths, I don't see any problems with that.

rwijtvliet commented 9 months ago

Ah, ok - I'll try that and give you a feedback!

rwijtvliet commented 9 months ago

I edited the response too, I could imagine adding /usr/local/bin to the default search paths, I don't see any problems with that.

I think that would be a good idea. The others (/bin/, /sbin/, /usr/bin/, /usr/sbin/) are all read-only file systems, and it's probably not ideal to manually add binaries to the homebrew prefix (but, it does work).

koekeishiya commented 9 months ago

Having the service file installed by running yabai --start-service allows me to set the service path equal to the value of $PATH of the user that runs the command. Not sure if you can access that during brew installation.

FelixKratz commented 9 months ago

On second thought, I think I will leave it as is for now. You can always use the absolute path for any binaries that reside outside of the service search path and I think this makes the configs created for sketchybar a bit better reproducible.