Repository navigation
feat(matic): improve power management for lid close and AC power #1140
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -25,8 +25,8 @@ listener { | |||||
| on-resume = hyprctl dispatch dpms on | ||||||
| } | ||||||
|
|
||||||
| # Suspend after 30 minutes | ||||||
| # Suspend after 30 minutes (only on battery) | ||||||
| listener { | ||||||
| timeout = 1800 | ||||||
| on-timeout = systemctl suspend | ||||||
| on-timeout = bash -c 'cat /sys/class/power_supply/AC*/online | grep -q 1 || systemctl suspend' | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This AC-power check only matches Prompt for AI agents
Suggested change
|
||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,6 +132,9 @@ inputs.nixpkgs.lib.nixosSystem { | |
|
|
||
| # Power button behavior - lock screen instead of shutdown | ||
| services.logind.settings.Login.HandlePowerKey = "lock"; | ||
| # Ignore lid close — let hypridle's 30-min idle timer handle suspension | ||
| services.logind.settings.Login.HandleLidSwitch = "ignore"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Delegating lid-close handling entirely to Prompt for AI agents |
||
| services.logind.settings.Login.HandleLidSwitchExternalPower = "ignore"; | ||
|
Comment on lines
+136
to
+137
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
|
||
| # Auto timezone (via geolocation) | ||
| services.geoclue2.enable = true; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command to check for AC power can be simplified by using
grepdirectly on the file, which avoids the need forcatand a pipe. This is slightly more efficient. I've also added2>/dev/nullto suppress potential error messages if the power supply path doesn't exist, making the execution cleaner.