[GH-ISSUE #333] Use cmd exit value for show_if #8555

Closed
opened 2026-05-23 03:52:45 +01:00 by JakeStanger · 2 comments
Owner

Originally created by @kepi on GitHub (Oct 16, 2023).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/333

Is your feature request related to a problem? Please describe.

From what I found in documentation, it seems that show_if can't take exit value from cmd when using script module.

As example, I want to show available updates on my Arch and it seems little wastefull to call checkupdates twice.

  - type: script
    mode: poll
    cmd: checkupdates | wc -l | xargs -n1 echo "󰏕"
    interval: 1800000
    show_if: checkupdates

Describe the solution you'd like

Not sure what best approach would be, but maybe simply receive exit value from cmd as first argument?

Describe alternatives you've considered

Maybe somehow manipulate ironvars? Seem little overkill to me, but maybe its better way.

Originally created by @kepi on GitHub (Oct 16, 2023). Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/333 **Is your feature request related to a problem? Please describe.** From what I found in documentation, it seems that `show_if` can't take exit value from `cmd` when using `script` module. As example, I want to show available updates on my Arch and it seems little wastefull to call `checkupdates` twice. ``` - type: script mode: poll cmd: checkupdates | wc -l | xargs -n1 echo "󰏕" interval: 1800000 show_if: checkupdates ``` **Describe the solution you'd like** Not sure what best approach would be, but maybe simply receive exit value from `cmd` as first argument? **Describe alternatives you've considered** Maybe somehow manipulate ironvars? Seem little overkill to me, but maybe its better way.
Author
Owner

@JakeStanger commented on GitHub (Oct 16, 2023):

Hey, I don't think this would be feasible unfortunately.

The show_if option is handled outside of the module code, runs its own script, and has no visibility into the module itself so it can't easily be shared. I'd be hesitant to refactor the way that works to change that either, since the original behaviour would need to be kept for other module types.

Instead the best option here is definitely to use an ironvar. There's possibly opportunity to make that more elegant, especially since this is (I'd imagine) quite a common scenario, so I'm open to ideas around that.

<!-- gh-comment-id:1765288026 --> @JakeStanger commented on GitHub (Oct 16, 2023): Hey, I don't think this would be feasible unfortunately. The `show_if` option is handled outside of the module code, runs its own script, and has no visibility into the module itself so it can't easily be shared. I'd be hesitant to refactor the way that works to change that either, since the original behaviour would need to be kept for other module types. Instead the best option here is definitely to use an `ironvar`. There's possibly opportunity to make that more elegant, especially since this is (I'd imagine) quite a common scenario, so I'm open to ideas around that.
Author
Owner

@JakeStanger commented on GitHub (Dec 3, 2023):

I'm going to close this as wontfix. If you disagree or have any further thoughts feel free to stick them here and I can always re-open.

<!-- gh-comment-id:1837447618 --> @JakeStanger commented on GitHub (Dec 3, 2023): I'm going to close this as wontfix. If you disagree or have any further thoughts feel free to stick them here and I can always re-open.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#8555
No description provided.