[GH-ISSUE #335] Respect interval in show_if or add show_if_interval #124

Closed
opened 2026-05-22 21:51:19 +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/335

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

While trying to handle checkupdates script as mentioned in #333 I tried to add show_if with simple checkupdates, as it returns 0 when there are some updates. I have interval for script set to 30 minutes.

I would like whole updates module to be hidden when there are no updates.

Problem is, that check_if ignores interval and runs constantly.

Describe the solution you'd like

I would like for show_if to honor interval, or add something like show_if_interval.

Describe alternatives you've considered

With script module, I can simply set some ironvar when there are updates. It might be even more efficitent, but it seems to me that I have to offload a lot of work to scripts, which seems little fragile to me.

Additional context

Btw. all three issues are just ideas, feel free to reject them if you think it is better to use little heavier scripts leveraging ironvars feature.

Originally created by @kepi on GitHub (Oct 16, 2023). Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/335 **Is your feature request related to a problem? Please describe.** While trying to handle `checkupdates` script as mentioned in #333 I tried to add `show_if` with simple `checkupdates`, as it returns 0 when there are some updates. I have `interval` for `script` set to 30 minutes. I would like whole updates module to be hidden when there are no updates. Problem is, that `check_if` ignores `interval` and runs constantly. **Describe the solution you'd like** I would like for `show_if` to honor `interval`, or add something like `show_if_interval`. **Describe alternatives you've considered** With `script` module, I can simply set some ironvar when there are updates. It might be even more efficitent, but it seems to me that I have to offload a lot of work to scripts, which seems little fragile to me. **Additional context** Btw. all three issues are just ideas, feel free to reject them if you think it is better to use little heavier scripts leveraging ironvars feature.
Author
Owner

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

I think what you're asking for can be done. The important thing to keep in mind here is that show_if is effectively its own script, independent of the module (when not using an ironvar). This means you can use shorthand script syntax to set the module and interval.

Using your example from #333:

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

(I think you can also omit the poll and just use 1800000:checkupdates to keep things a bit tidier from memory)

<!-- gh-comment-id:1765296274 --> @JakeStanger commented on GitHub (Oct 16, 2023): I think what you're asking for can be done. The important thing to keep in mind here is that `show_if` is effectively its own script, independent of the module (when not using an ironvar). This means you can use [shorthand script syntax](https://github.com/JakeStanger/ironbar/wiki/scripts#shorthand-string) to set the module and interval. Using your example from #333: ```yaml - type: 'script' cmd: 'checkupdates | wc -l | xargs -n1 echo "󰏕"' interval: 1800000 show_if: 'poll:1800000:checkupdates' ``` (I think you can also omit the `poll` and just use `1800000:checkupdates` to keep things a bit tidier from memory)
Author
Owner

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

I didn't realize that I can use shorthand form in show_if. That is definitelly sufficient.

Thanks!

<!-- gh-comment-id:1765309310 --> @kepi commented on GitHub (Oct 16, 2023): I didn't realize that I can use shorthand form in `show_if`. That is definitelly sufficient. Thanks!
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#124
No description provided.