services: Add elogind ‘handle-lid-switch-external-power’.

* gnu/services/desktop.scm <elogind-configuration>: Add an
handle-lid-switch-external-power field, mapping to the
HandleLidSwitchExternalPower logind.conf setting.
* doc/guix.texi (Desktop Services): ‘Document’ it.
This commit is contained in:
Tobias Geerinckx-Rice 2020-09-28 15:55:55 +02:00
parent a32c581a1d
commit 4c698cd512
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79
2 changed files with 62 additions and 57 deletions

View file

@ -17262,6 +17262,8 @@ their default values are:
@code{suspend} @code{suspend}
@item handle-lid-switch-docked @item handle-lid-switch-docked
@code{ignore} @code{ignore}
@item handle-lid-switch-external-power
@code{ignore}
@item power-key-ignore-inhibited? @item power-key-ignore-inhibited?
@code{#f} @code{#f}
@item suspend-key-ignore-inhibited? @item suspend-key-ignore-inhibited?

View file

@ -596,64 +596,66 @@ (define* (udisks-service #:key (udisks udisks))
(define-record-type* <elogind-configuration> elogind-configuration (define-record-type* <elogind-configuration> elogind-configuration
make-elogind-configuration make-elogind-configuration
elogind-configuration? elogind-configuration?
(elogind elogind-package (elogind elogind-package
(default elogind)) (default elogind))
(kill-user-processes? elogind-kill-user-processes? (kill-user-processes? elogind-kill-user-processes?
(default #f)) (default #f))
(kill-only-users elogind-kill-only-users (kill-only-users elogind-kill-only-users
(default '())) (default '()))
(kill-exclude-users elogind-kill-exclude-users (kill-exclude-users elogind-kill-exclude-users
(default '("root"))) (default '("root")))
(inhibit-delay-max-seconds elogind-inhibit-delay-max-seconds (inhibit-delay-max-seconds elogind-inhibit-delay-max-seconds
(default 5)) (default 5))
(handle-power-key elogind-handle-power-key (handle-power-key elogind-handle-power-key
(default 'poweroff)) (default 'poweroff))
(handle-suspend-key elogind-handle-suspend-key (handle-suspend-key elogind-handle-suspend-key
(default 'suspend)) (default 'suspend))
(handle-hibernate-key elogind-handle-hibernate-key (handle-hibernate-key elogind-handle-hibernate-key
;; (default 'hibernate) ;; (default 'hibernate)
;; XXX Ignore it for now, since we don't ;; XXX Ignore it for now, since we don't
;; yet handle resume-from-hibernation in ;; yet handle resume-from-hibernation in
;; our initrd. ;; our initrd.
(default 'ignore)) (default 'ignore))
(handle-lid-switch elogind-handle-lid-switch (handle-lid-switch elogind-handle-lid-switch
(default 'suspend)) (default 'suspend))
(handle-lid-switch-docked elogind-handle-lid-switch-docked (handle-lid-switch-docked elogind-handle-lid-switch-docked
(default 'ignore)) (default 'ignore))
(power-key-ignore-inhibited? elogind-power-key-ignore-inhibited? (handle-lid-switch-external-power elogind-handle-lid-switch-external-power
(default #f)) (default 'ignore))
(suspend-key-ignore-inhibited? elogind-suspend-key-ignore-inhibited? (power-key-ignore-inhibited? elogind-power-key-ignore-inhibited?
(default #f)) (default #f))
(hibernate-key-ignore-inhibited? elogind-hibernate-key-ignore-inhibited? (suspend-key-ignore-inhibited? elogind-suspend-key-ignore-inhibited?
(default #f)) (default #f))
(lid-switch-ignore-inhibited? elogind-lid-switch-ignore-inhibited? (hibernate-key-ignore-inhibited? elogind-hibernate-key-ignore-inhibited?
(default #t)) (default #f))
(holdoff-timeout-seconds elogind-holdoff-timeout-seconds (lid-switch-ignore-inhibited? elogind-lid-switch-ignore-inhibited?
(default 30)) (default #t))
(idle-action elogind-idle-action (holdoff-timeout-seconds elogind-holdoff-timeout-seconds
(default 'ignore)) (default 30))
(idle-action-seconds elogind-idle-action-seconds (idle-action elogind-idle-action
(default (* 30 60))) (default 'ignore))
(runtime-directory-size-percent elogind-runtime-directory-size-percent (idle-action-seconds elogind-idle-action-seconds
(default 10)) (default (* 30 60)))
(runtime-directory-size elogind-runtime-directory-size (runtime-directory-size-percent elogind-runtime-directory-size-percent
(default #f)) (default 10))
(remove-ipc? elogind-remove-ipc? (runtime-directory-size elogind-runtime-directory-size
(default #t)) (default #f))
(remove-ipc? elogind-remove-ipc?
(default #t))
(suspend-state elogind-suspend-state (suspend-state elogind-suspend-state
(default '("mem" "standby" "freeze"))) (default '("mem" "standby" "freeze")))
(suspend-mode elogind-suspend-mode (suspend-mode elogind-suspend-mode
(default '())) (default '()))
(hibernate-state elogind-hibernate-state (hibernate-state elogind-hibernate-state
(default '("disk"))) (default '("disk")))
(hibernate-mode elogind-hibernate-mode (hibernate-mode elogind-hibernate-mode
(default '("platform" "shutdown"))) (default '("platform" "shutdown")))
(hybrid-sleep-state elogind-hybrid-sleep-state (hybrid-sleep-state elogind-hybrid-sleep-state
(default '("disk"))) (default '("disk")))
(hybrid-sleep-mode elogind-hybrid-sleep-mode (hybrid-sleep-mode elogind-hybrid-sleep-mode
(default (default
'("suspend" "platform" "shutdown")))) '("suspend" "platform" "shutdown"))))
(define (elogind-configuration-file config) (define (elogind-configuration-file config)
(define (yesno x) (define (yesno x)
@ -705,6 +707,7 @@ (define-syntax-rule (ini-file config file clause ...)
("HandleHibernateKey" (handle-action elogind-handle-hibernate-key)) ("HandleHibernateKey" (handle-action elogind-handle-hibernate-key))
("HandleLidSwitch" (handle-action elogind-handle-lid-switch)) ("HandleLidSwitch" (handle-action elogind-handle-lid-switch))
("HandleLidSwitchDocked" (handle-action elogind-handle-lid-switch-docked)) ("HandleLidSwitchDocked" (handle-action elogind-handle-lid-switch-docked))
("HandleLidSwitchExternalPower" (handle-action elogind-handle-lid-switch-external-power))
("PowerKeyIgnoreInhibited" (yesno elogind-power-key-ignore-inhibited?)) ("PowerKeyIgnoreInhibited" (yesno elogind-power-key-ignore-inhibited?))
("SuspendKeyIgnoreInhibited" (yesno elogind-suspend-key-ignore-inhibited?)) ("SuspendKeyIgnoreInhibited" (yesno elogind-suspend-key-ignore-inhibited?))
("HibernateKeyIgnoreInhibited" (yesno elogind-hibernate-key-ignore-inhibited?)) ("HibernateKeyIgnoreInhibited" (yesno elogind-hibernate-key-ignore-inhibited?))