[GH-ISSUE #929] Idle Inhibitor module #4497

Closed
opened 2026-05-23 00:53:53 +01:00 by JakeStanger · 8 comments
Owner

Originally created by @JakeStanger on GitHub (Apr 8, 2025).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/929

Originally assigned to: @slowsage on GitHub.

https://wayland.app/protocols/idle-inhibit-unstable-v1

More detail to be added

Discussed in https://github.com/JakeStanger/ironbar/discussions/928

Originally posted by ildar April 8, 2025
Couldn't find any info if there is the Idle Inhibitor in the ironbar. Could it be implemented?

ref: https://github.com/Alexays/Waybar/wiki/Module:-Idle-Inhibitor

Originally created by @JakeStanger on GitHub (Apr 8, 2025). Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/929 Originally assigned to: @slowsage on GitHub. https://wayland.app/protocols/idle-inhibit-unstable-v1 > More detail to be added ### Discussed in https://github.com/JakeStanger/ironbar/discussions/928 <div type='discussions-op-text'> <sup>Originally posted by **ildar** April 8, 2025</sup> Couldn't find any info if there is the Idle Inhibitor in the ironbar. Could it be implemented? ref: https://github.com/Alexays/Waybar/wiki/Module:-Idle-Inhibitor</div>
JakeStanger 2026-05-23 00:53:53 +01:00
Author
Owner

@RobertMueller2 commented on GitHub (Jun 19, 2025):

Sharing this because I could imagine this is a show stopper for a number of people. Just stumbled across wayhibitor, this can be used until there's a native module. Config example:

    $idle_inhibit = {
        type = "button"
        label = "{{1000:pgrep -u $(id -u) wayhibitor >/dev/null && echo  || echo }}"
        on_click = "!pkill -u $(id -u) wayhibitor || exec wayhibitor"
    }
 
    $idle = {
        type = "custom"
        class = "idle"
        bar = [ $idle_inhibit ]
    }

EDIT: couldn't get it to work yet. Looking at a sway debug log, I'm guessing that it doesn't work without a surface with sway. If that's true, that's a reason for implementing it as a client/module.

<!-- gh-comment-id:2987165682 --> @RobertMueller2 commented on GitHub (Jun 19, 2025): Sharing this because I could imagine this is a show stopper for a number of people. Just stumbled across [wayhibitor](https://github.com/diniamo/wayhibitor), this can be used until there's a native module. Config example: ``` $idle_inhibit = { type = "button" label = "{{1000:pgrep -u $(id -u) wayhibitor >/dev/null && echo  || echo }}" on_click = "!pkill -u $(id -u) wayhibitor || exec wayhibitor" } $idle = { type = "custom" class = "idle" bar = [ $idle_inhibit ] } ``` EDIT: couldn't get it to work yet. Looking at a sway debug log, I'm guessing that it doesn't work without a surface with sway. If that's true, that's a reason for implementing it as a client/module.
Author
Owner

@ildar commented on GitHub (Jul 3, 2025):

I've taken a look into the waybar sources and found it doesn't deal with wayland protocols at all. It is much simpler, using systemd through DBus.

So I've made a little shell script with this functionality: https://gist.github.com/ildar/ef351cdf65e5b00c834fe7a36f75f59f

It is quite ok as the workaound.

<!-- gh-comment-id:3032305394 --> @ildar commented on GitHub (Jul 3, 2025): I've taken a look into the waybar sources and found it doesn't deal with wayland protocols at all. It is much simpler, using systemd through DBus. So I've made a little shell script with this functionality: https://gist.github.com/ildar/ef351cdf65e5b00c834fe7a36f75f59f It is quite ok as the workaound.
Author
Owner

@RobertMueller2 commented on GitHub (Jul 4, 2025):

I also found a custom solution that works well for me within my sway session. I'm using

  • an indicator module that displays idle state based on ext-idle-notify events, with a small C binary, which I want to publish at some point (this should also include systemd-inhibit inhibitors)
  • a module that can start/stop a tool window with app id identified by sway for_window, which then adds idle inhibition flag to the window

ironbar config:
github.com/RobertMueller2/Dotfile-Snippets@b9451e1e4c/ironbar/config.corn (L92)

relevant sway config part:
github.com/RobertMueller2/Dotfile-Snippets@b9451e1e4c/sway/config.d/30_idle.conf (L15)

systemd-inhibit is a possibility as well. AFAICT it is not reported by ext-idle-notify, at least sway does not do it. But of course swayidle respects it.

My main issue about idle inhibition has always been transparency, even with notifications sent from swayidle. I've had too many surprises of unexpected locks, as well as returning to an unlocked screen after hours of afk. My solution works for me now, but I think if there ever is a native module, it should take all of it into account, idle state, systemd-inhibit, management of own idle inhibition, perhaps even allow to choose whether to use protocol or systemd-inhibit for the latter.

<!-- gh-comment-id:3034684081 --> @RobertMueller2 commented on GitHub (Jul 4, 2025): I also found a custom solution that works well for me within my sway session. I'm using - an indicator module that displays idle state based on ext-idle-notify events, with a small C binary, which I want to publish at some point (this should also include systemd-inhibit inhibitors) - a module that can start/stop a tool window with app id identified by sway `for_window`, which then adds idle inhibition flag to the window ironbar config: https://github.com/RobertMueller2/Dotfile-Snippets/blob/b9451e1e4cca3844d1990da172c28bab57c7bf0e/ironbar/config.corn#L92 relevant sway config part: https://github.com/RobertMueller2/Dotfile-Snippets/blob/b9451e1e4cca3844d1990da172c28bab57c7bf0e/sway/config.d/30_idle.conf#L15 systemd-inhibit is a possibility as well. AFAICT it is not reported by ext-idle-notify, at least sway does not do it. But of course swayidle respects it. My main issue about idle inhibition has always been transparency, even with notifications sent from swayidle. I've had too many surprises of unexpected locks, as well as returning to an unlocked screen after hours of afk. My solution works for me now, but I think if there ever is a native module, it should take all of it into account, idle state, systemd-inhibit, management of own idle inhibition, perhaps even allow to choose whether to use protocol or systemd-inhibit for the latter.
Author
Owner

@slowsage commented on GitHub (Aug 27, 2025):

@JakeStanger Please give feedback on this approach when you get a chance.

I think with streaming remaining time, it can work well with ironbar.

<!-- gh-comment-id:3229792553 --> @slowsage commented on GitHub (Aug 27, 2025): @JakeStanger Please give feedback on [this](https://github.com/slowsage/ironhibit) approach when you get a chance. I think with streaming remaining time, it can work well with ironbar.
Author
Owner

@JakeStanger commented on GitHub (Sep 7, 2025):

Sorry I'm a little bit lost here. Can you give some more info please as to what that's doing and what your potential plan for it would be?

<!-- gh-comment-id:3263998734 --> @JakeStanger commented on GitHub (Sep 7, 2025): Sorry I'm a little bit lost here. Can you give some more info please as to what that's doing and what your potential plan for it would be?
Author
Owner

@slowsage commented on GitHub (Sep 7, 2025):

How it works (2-liner):
The solution uses systemd's primitives to setup a timer service that runs for n minutes. While the timer is running, idle is blocked and a socket file is available that outputs the time remaining in a streaming/watch fashion.

Relevant commands that ironbar scripts/custom modules can run:
systemctl --user start ironhibit@90m - idea is to have a menu with 30m, 60m, 90m and 120m - clickable to activate idle inhibition for that time. Instead of menu, you could also specify in config.

nc -U "$XDG_RUNTIME_DIR/ironhibit.sock" - show time remaining in the timer - like music playback etc if someone wanted it.

systemctl --user is-active ironhibit-timer - will check if idle inhibition is active so we can change color of widget/item accordingly.

<!-- gh-comment-id:3264033360 --> @slowsage commented on GitHub (Sep 7, 2025): How it works (2-liner): The solution uses systemd's primitives to setup a timer service that runs for n minutes. While the timer is running, idle is blocked and a socket file is available that outputs the time remaining in a streaming/watch fashion. Relevant commands that ironbar scripts/custom modules can run: `systemctl --user start ironhibit@90m` - idea is to have a menu with 30m, 60m, 90m and 120m - clickable to activate idle inhibition for that time. Instead of menu, you could also specify in config. `nc -U "$XDG_RUNTIME_DIR/ironhibit.sock"` - show time remaining in the timer - like music playback etc if someone wanted it. `systemctl --user is-active ironhibit-timer` - will check if idle inhibition is active so we can change color of widget/item accordingly.
Author
Owner

@JakeStanger commented on GitHub (Sep 8, 2025):

Right gotcha. That sounds like a solid approach for a custom module at least.

With the new ironbar style commands and the ability to dynamically add/remove class names, you might not even need that last check. In theory you can change the style as part of the systemd unit directly.

I also had a quick look at the native protocol approach again last night. It requires you to pass the WlSurface object, which is a problem as GTK3 does not expose it and I cannot imagine it ever will. It means without some serious hacks a solid custom approach is probably the best we'll get.

EDIT: Looks like it might be possible with GTK4. Might.

<!-- gh-comment-id:3265489696 --> @JakeStanger commented on GitHub (Sep 8, 2025): Right gotcha. That sounds like a solid approach for a custom module at least. With the new `ironbar style` commands and the ability to dynamically add/remove class names, you might not even need that last check. In theory you can change the style as part of the systemd unit directly. I also had a quick look at the native protocol approach again last night. It requires you to pass the `WlSurface` object, which is a problem as GTK3 does not expose it ~~and I cannot imagine it ever will~~. It means without some serious hacks a solid custom approach is probably the best we'll get. EDIT: Looks like it might be possible with GTK4. [Might](https://docs.gtk.org/gdk4-wayland/method.WaylandSurface.get_wl_surface.html).
Author
Owner

@slowsage commented on GitHub (Oct 7, 2025):

Figured out a way to do it as a module inside ironbar itself and still be persistent (transient service). Added wayland option as fallback.
PR: #1190

<!-- gh-comment-id:3378312494 --> @slowsage commented on GitHub (Oct 7, 2025): Figured out a way to do it as a module inside ironbar itself and still be persistent (transient service). Added wayland option as fallback. PR: #1190
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#4497
No description provided.