-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
[Feature] set power source type on listener for laptops #67
Comments
I've actually thought about this before, and I plan to implement it (though I don't have as much time as I'd like to do that). listener {
timeouts = 600, 1800 # BATT, AC
command = systemctl suspend
} or listener {
timeout-battery = 600
timeout-ac = 1800
command = systemctl suspend
} in which case |
I think the second syntax is better, also it should to be considered that for example someone may not want to set any So something like this behavior could be efficient :
Which means a listener can have only one of AC or battery timeouts, or both of them. |
I have a practical usecase for setting both ac and bat, and that is DPMS. |
Hello, Quick question in the meantime: FYI atm i do it like this:
|
@stinobook
for switching to pkill hypridle
hypridle -c ~/.config/hypr/hypridle-ac.conf also, this tricky way to start the process in background would be useful (which means you can close your terminal after that): nohup hypridle -c hypridle-ac.conf & |
I'm not sure if this is a good idea, but it would be convenient to have different timings for one or another percentage of the battery something like # base listener that works for battery < 100%
listener {
timeout-battery = 600
command = systemctl suspend
}
# listener that works for battery < 60%
listener {
timeout-battery-60 = 300
command = systemctl suspend
}
# listener that works for battery < 10%
listener {
timeout-battery-10 = 120
command = systemctl suspend
} |
If you're using hyprland, it's better to do hyprctl dispatch exec hypridle -c hypridle-ac.conf to start new hypridle instance. That way it's started in the same fashion as it's started on login using Also if you'd like to reload some executable on config file change, I recommend using watchexec program. For example, I run waybar from hyprland like this:
The watchexec starts waybar and monitors the waybar config directory. If it detects any changes to the files in that directory, it restarts the waybar process. The |
@yawor Also, i didn't know about the |
There's some further things to consider here. Consider the following config and scenario:
What should happen? A "dumb" mode switch to "battery state" would not do anything because the 600s timeout would have already happened. Such behaviour must be avoided IMHO since it represents an illegal state; a state after the event should have fired but didn't actually fire. I think the least surprising behaviour would be to fire the event immediately after plugging out eventhough it's overdue. Another interpretation could however be to expect it to wait another 600s after plugging out and basically consider the plugging in/out itself to be an event that should reset the timeout. Which of these two interpretations should be used should perhaps be user-configurable on a per-listener level with a global default. |
Regarding battery levels: Behaving differently based on battery percentage is also a feature I think hypridle should have. I'd like to propose this option and semantics instead:
Everything >60% battery would then be considered the same as AC. This too would be quite limited in some regards and may not necessarily cover all use-cases. A better solution would perhaps be to have a generic event listening system where the user can declare their own events to listen/poll for in addition to the absence of user input (which hypridle produces itself). |
@Atemu doing dynamic timeouts depending on some external state is not really doable in current approach to timeouts in hypridle. It doesn't create its own timers directly. Instead it registers all configured timeouts in the compositor (using idle notification Wayland API) when it starts and just wait for for callbacks. |
Maybe just have hypridle re-set itself and re-register with the new set of timers whenever the power status changes? |
Oh wow I just thought of a cursed setup where you'd have two hypridle systemd services that point at separate configs where the AC/battery differences are taken care of. Both would That's so stupid it might actually work. |
Hi,
thanks for your nice program, I think it could be so helpful to add a parameter on
listener
configuration for laptops to define different listeners for AC power or Battery power.For example, I want to set more time to go to sleep on AC power :
The text was updated successfully, but these errors were encountered: