Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin can't call itself #908

Open
AlexisMaizel opened this issue Dec 13, 2023 · 2 comments
Open

Plugin can't call itself #908

AlexisMaizel opened this issue Dec 13, 2023 · 2 comments

Comments

@AlexisMaizel
Copy link

Hi,
I have been using xbar for a while to easily connect/disconnect from a VPN.
Lately, the script stopped functioning.
I'm on macOS 13.6.2.

The following dummy plugin reproduces the problem; it is supposed to toggle a variable but does not work:

#!/usr/bin/env bash
STATUS=NA

case "$1" in
    on)
        STATUS=1
        ;;
    off)
        STATUS=0
        ;;
esac

if [ "$STATUS" == "1" ]; then 
    echo "Status: $STATUS"
    echo '---'
    echo "Turn off | bash='$0' param1=off terminal=false refresh=true"
    exit
else
    echo "Status: $STATUS"
    echo '---'
    echo "Turn on | bash='$0' param1=on terminal=false refresh=true"
    exit
fi

The issue seems to be that the plugin fails to call itself for action (bash=$0).

Any help on how to solve this would be appreciated. :-)

@AlexisMaizel AlexisMaizel changed the title Plugin can't call iself Plugin can't call itself Dec 14, 2023
@moritztim
Copy link

Try using shell instead of bash, according to the docs that's the correct keyword. I don't know if it used to be bash, argos has bash instead of shell, maybe it changed in xbar in a recent release.

@AlexisMaizel
Copy link
Author

Thanks for the input. Unfortunately, that did not solve the problem.
I tried with both bash= and shell=
Here is the current version of the dummy script I'm using:

#!/usr/bin/env bash
STATUS=NA

case "$1" in
    on)
        STATUS=1
        ;;
    off)
        STATUS=0
        ;;
esac

if [ "$STATUS" -eq 1 ]; then 
    echo "Status: $STATUS"
    echo '---'
    echo "Turn off | shell=\"$(realpath "$0")\" param1=off terminal=false refresh=true"
    exit
else
    echo "Status: $STATUS"
    echo '---'
    echo "Turn on | shell=\"$(realpath "$0")\" param1=on terminal=false refresh=true"
    exit
fi

I am completely clueless about what is going on :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants