Jas-SinghFSU / HyprPanel

A Bar/Panel for Hyprland with extensive customizability.
MIT License
852 stars 59 forks source link

Idle Inhibitor Widget With Dynamic Icon #276

Open dotaxis opened 1 month ago

dotaxis commented 1 month ago

Is your feature request related to a problem? Please describe. Waybar has an idle inhibitor widget which is very nice when on Zoom meetings or watching videos. AGS does not have an equivalent.

Describe the solution you'd like I would very much like to see the ability to replace one of the buttons in the dashboard with one that toggles idle inhibiting with matcha

Describe alternatives you've considered A widget that goes along the top bar is fine too but I'd really like it in the dashboard

Additional context This is kind of what I'm hoping to have, with an icon that reflects whether the inhibitor is active or not image

Jas-SinghFSU commented 1 month ago

Is this meant to prevent hypridle from triggering?

Jas-SinghFSU commented 1 month ago

Reason I ask is that matcha isn't easily installable as a package. You have to build it yourself from what I understand. So if we plan to integrate with swayidle or hypridle, we can do so without matcha and handle inhibiting rules.

dotaxis commented 1 month ago

Is this meant to prevent hypridle from triggering?

Yes

dotaxis commented 1 month ago

Reason I ask is that matcha isn't easily installable as a package. You have to build it yourself from what I understand. So if we plan to integrate with swayidle or hypridle, we can do so without matcha and handle inhibiting rules.

Even a script that kills/launches hypridle would be fine.

I'm just struggling to make the icon/widget properly reflect the state of that which is why I made the feature request. The only reason I suggested matcha is that it already exists and has the ability to run as a daemon. It also does so in a way that uses wayland protocols rather than dbus which is neat but not that important to me.

anotherhadi commented 1 month ago

A solution would be to add an option where we can define commands that return a label (as in waybar) So we could do something like if pidof ...; then ... else ... in bash and dynamically change the button label

rubiin commented 2 weeks ago

@dotaxis

you can use something like this

#!/usr/bin/env bash

check_idle(){
pid=$(pgrep hypridle)
if [[ "$pid" == "" ]]; then echo 'stopped'; else echo 'running'; fi
}

toggle(){
pkill hypridle || hypridle&
}

if [[ "$1" == "toggle" ]]; then
    toggle
else
    check_idle
fi
dotaxis commented 2 weeks ago

I know how to write a bash script that toggles hypridle.

I want a widget that has a different icon depending on whether it is running or not.

rubiin commented 2 weeks ago

I guess you have to wait till we have something like user custom modules which is what I have been looking forward to. I did have a rough implementation for the idle inhibitor with the above script but it still lacks proper testing

Lurgrid commented 1 week ago

It would be amazing to be able to make custom modules