xbar: Terminal param is not working on latest xbar

The following xbar plugin will not work on version 2.0.35-beta

#!/bin/bash
echo "terminal | shell=/bin/bash terminal=true"

When clicking on the menu it doesn’t do anything.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 26 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I have moved Run in terminal into the xbar folder, and next up we need to add support for terminal=true param, which should do the same (or a very similar) thing.

for now you can work around it with echo "What I want to run | shell=osascript param1=-e param2='tell application \"Terminal\" to do script \"my script\"' | ...

Thanks everyone.

@dperfect @bluescreen10 thanks, you’re both right. terminal=true should open it in a terminal. terminal=false will run it as a background task.

This isn’t currently working as expected, and needs a little more work, so I’m going to mark it as a bug.

@matryer Working perfectly, thanks!!

@matryer Thanks for your work on this! There is an improvement with the beta, but I get two terminal windows appearing in the foreground instead of one.

To recap: if I use the “osascript/tell application terminal” workaround method I posted above, this causes a single terminal window to appear, but in the background. Therefore I can simply click the terminal icon on the dock to get to it.

With this new beta, I can successfully use terminal=true instead of the osascript workaround, and a terminal window does appear in the foreground. However, two terminals are displayed in the foreground. One is a regular terminal with an interactive prompt. The second terminal window is the one that launches my bash script and allows me to provide input, such as a sudo password.

@hdp-sami This worked for me:

echo "command_description_here|shell=osascript param1=-e param2='tell application \"terminal\" to do script \"/path/to/my/script.sh my_param1  my_param2\"' refresh=true"

Sometimes this causes xbar to crash, so I just need to restart xbar and try again. Also note that triggering the command from the xbar menu will cause the terminal app to appear in the background somewhere so you can provide input, but it won’t be on top so you’ll need to click the terminal icon on your dock to see it.

Has there been any movement on this issue? It’s something I used heavily in BitBar and would love to see it back in Xbar.

Thanks for looking into this issue. FYI, my use case is: I was previously using bitbar to run certain commands that require sudo password input (such as for mounting certain types of drive via FUSE). Something changed when I upgraded to xbar, and now a terminal no longer pops up when password entry is required.

@bluescreen10 Thanks for reporting. What do you expect that to do? Open the terminal?

The current README includes this (in the Parameters section):

terminal=.. start bash script without opening Terminal. true or false

Shouldn’t the use of Terminal work without extra configuration (e.g., appleScriptTemplate)? I appreciate the option to customize appleScriptTemplate, but it seems to make sense for the default behavior to be something (I believe) most people would expect – i.e., opening Terminal.app with the script, when terminal=true.

Side note: as it’s currently worded, it’s also ambiguous whether the terminal option is disabling or enabling the use of Terminal when set to true.

FYI - in my use case, I’m trying to get it to work with the “SSH Menu” plugin (adapted for xbar). In BitBar, it would open Terminal with ssh and the given parameters so you could quickly open an SSH connection to a list of hosts.