matryer / xbar

Put the output from any script or program into your macOS Menu Bar (the BitBar reboot)
https://xbarapp.com
MIT License
17.58k stars 642 forks source link

How to eliminate/hide output when redirection to /dev/null doesn't work? #840

Closed ylluminate closed 2 years ago

ylluminate commented 2 years ago

I have an issue where I'm using xbar to restart a process to control some external monitors. The process has a leak and must be restarted once a day to keep it under control. I thought a simply output redirection should work to prevent xbar from capturing and displaying the output, but it seems to not work, here's what I have in the script:

#!/usr/bin/env zsh

killall -9 "macOS InstantView" 2>&1 1>/dev/null
"/Applications/macOS InstantView.app/Contents/MacOS/macOS InstantView" 2>&1 1>/dev/null

Is there another method to stop output from going to or being displayed by xbar?

emichaud commented 2 years ago

Have you tried: command > /dev/null 2>&1
or ( command ) >/dev/null 2>&1 or command 1>&- 2>&-

hope one of those works for you.

ylluminate commented 2 years ago

Interesting, that worked better @emichaud, thanks.

Any chance there's a method for displaying the xbar icon solely instead of a blank icon in the Menubar? Eg, now when xbar executes and even just sits thee, it is an "empty" icon...

emichaud commented 2 years ago

Sorry, at the moment don't have the knowledge to help with the icon. glad I could help with the cli.