XMonad: Difference between revisions
imported>Zach-hill m Added to "Window managers" and "Applications" categories |
imported>Milnet2 Add: Suspend system after inactivity |
||
| Line 68: | Line 68: | ||
I try to manually run "haskell-language-server" in the directory with `xmonad.hs`, `hie.yaml` and `hie-bios.sh` | I try to manually run "haskell-language-server" in the directory with `xmonad.hs`, `hie.yaml` and `hie-bios.sh` | ||
when there are no errors, my editor also successfully starts lsp | when there are no errors, my editor also successfully starts lsp | ||
== Power management == | |||
While other DEs come with built-in functionality, ''xmonad'' does not. | |||
However, there are several ways of still adding this functionality. | |||
=== Suspend system after inactivity === | |||
The approach goes through the following steps: | |||
* Let the XServer detect idle-situation | |||
* Inform "logind" (i.e. "systemd") about the situation | |||
* Let "logind" make the system sleep | |||
We'll configure the XServers screensaver-settings to pick up inactivity: | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
services.xserver.displayManager.sessionCommands = '' | |||
xset -dpms # Disable Energy Star, as we are going to suspend anyway and it may hide "success" on that | |||
xset s blank # `noblank` may be useful for debugging | |||
xset s 300 # seconds | |||
${pkgs.lightlocker}/bin/light-locker --idle-hint & | |||
''; | |||
</nowiki>}} | |||
You'll have to re-login for the settings above to be applied. | |||
The settings above will toggle the flag "IdleHint" within logind through [https://github.com/the-cavalry/light-locker#light-locker light-locker] (will work with "'lightdm'", there are alternatives). | |||
Next we'll have to pick-up the information within logindand select an [https://www.freedesktop.org/software/systemd/man/logind.conf.d.html#IdleAction= action to take]: | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
systemd.targets.hybrid-sleep.enable = true; | |||
services.logind.extraConfig = '' | |||
IdleAction=hybrid-sleep | |||
IdleActionSec=20s | |||
''; | |||
</nowiki>}} | |||
The configuration above will let the system go to "hybrid-sleep" `20s` after the screen-saver triggered. | |||
==== Troubleshooting ==== | |||
Check if the values of "IdleSinceHint" and "IdleSinceHintMonotonic" update using the command: | |||
<syntaxhighlight lang="console"> | |||
$ watch "loginctl show-session | grep Idle" | |||
</syntaxhighlight> | |||
Try setting the flag manually (also need to disable manually): | |||
<syntaxhighlight lang="console"> | |||
$ dbus-send --system --print-reply \ | |||
--dest=org.freedesktop.login1 /org/freedesktop/login1/session/self \ | |||
"org.freedesktop.login1.Session.SetIdleHint" boolean:true | |||
</syntaxhighlight> | |||
Check if the xset-settings have been applied properly and activate the screensaver manually: | |||
<syntaxhighlight lang="console"> | |||
$ xset q | |||
$ sleep 1s && xset s activate | |||
</syntaxhighlight> | |||
[[Category:Window managers]] | [[Category:Window managers]] | ||
[[Category:Applications]] | [[Category:Applications]] | ||