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

Make button invisible if plugin returns no output #54

Merged
merged 1 commit into from Nov 11, 2018

Conversation

matthias-g
Copy link
Contributor

This hides the indicator for a plugin if the plugin returns no output (see #49).

@aggsol
Copy link

aggsol commented Oct 11, 2018

This might be counter intuitive as no output would likely be an script error that should be visible.

@tallero
Copy link

tallero commented Oct 14, 2018

I agree with @aggsol
@matthias-g Do you think would be better creating a setting to hide the plugin when there is no output?

@p-e-w
Copy link
Owner

p-e-w commented Oct 17, 2018

Just a quick update: I haven't really made up my mind about this PR yet, but I won't be adding any more settings than there already are.

@matthias-g
Copy link
Contributor Author

What do you think about considering also the exit code of the plugin and hiding the indicator only when the exit code is 0 and the output is empty? In case of an error the plugin should have an exit code != 0.

@aggsol
Copy link

aggsol commented Oct 18, 2018

@matthias-g What are you trying to achieve? It seems that you actually want to create something like a notification.

@matthias-g
Copy link
Contributor Author

What are you trying to achieve?

One of my use cases is showing the battery level of my phone when it is connected. When the phone is not connected I don't want the plugin to take up space in the panel.
screenshot from 2018-10-18 09-59-24

@matthias-g
Copy link
Contributor Author

I didn't verify, but from looking at plugins like the Notmuch inbox & unread counter I assume that BitBar hides the button when there is no output or the first line of the output is "---". If that is true, adopting this behavior would be part of implementing BitBar compatibility.

@p-e-w
Copy link
Owner

p-e-w commented Oct 21, 2018

@matthias-g Hiding the button when there is no output is problematic for the reason mentioned by @aggsol, but I like the idea of hiding it if the first line is a separator. I would merge a PR that implements that.

matthias-g added a commit to matthias-g/argos that referenced this pull request Oct 22, 2018
Hide the button only if there are no lines above the first separator.
(see p-e-w#54)
@matthias-g
Copy link
Contributor Author

OK. I've added a commit that hides the button when the first line is a separator, but keeps showing the button when there is no output at all.

Copy link
Owner

@p-e-w p-e-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After addressing the above comments, please also squash everything into a single commit. Alternatively, I can do a squash when merging.

argos@pew.worldwidemann.com/button.js Outdated Show resolved Hide resolved
argos@pew.worldwidemann.com/button.js Outdated Show resolved Hide resolved
@matthias-g
Copy link
Contributor Author

Thanks for the comments! I've performed the requested changes and squashed the commits.

@p-e-w p-e-w changed the title Make button invisibile if plugin returns no output Make button invisible if plugin returns no output Nov 11, 2018
@p-e-w p-e-w merged commit 7dac45a into p-e-w:master Nov 11, 2018
@p-e-w
Copy link
Owner

p-e-w commented Nov 11, 2018

Merged. Thank you for seeing this through, @matthias-g. This is definitely an improvement!

BlueBoxWare added a commit to BlueBoxWare/Banana that referenced this pull request Nov 17, 2018
@p-e-w p-e-w mentioned this pull request Jun 9, 2019
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

Successfully merging this pull request may close these issues.

None yet

4 participants