Skip to content
Snippets Groups Projects
Unverified Commit 8b9a7b26 authored by Christopher Baines's avatar Christopher Baines
Browse files

services: Improve the upower-service-type.

Add a description and default value. Switch the documentation to mention the
service-type and the configuration record, rather than the upower-service
procedure.

* gnu/services/desktop.scm (upower-service-type)[description, default-value]:
Define these fields.
(%desktop-services): Change (upower-service) to (service upower-service-type).
* doc/guix.texi (Desktop Services): Update the upower service documentation.
parent 6b692e96
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,7 @@ Copyright @copyright{} 2016, 2017 Nils Gillmann@* ...@@ -34,6 +34,7 @@ Copyright @copyright{} 2016, 2017 Nils Gillmann@*
Copyright @copyright{} 2016, 2017, 2018 Jan Nieuwenhuizen@* Copyright @copyright{} 2016, 2017, 2018 Jan Nieuwenhuizen@*
Copyright @copyright{} 2016 Julien Lepiller@* Copyright @copyright{} 2016 Julien Lepiller@*
Copyright @copyright{} 2016 Alex ter Weele@* Copyright @copyright{} 2016 Alex ter Weele@*
Copyright @copyright{} 2016, 2017, 2018, 2019 Christopher Baines@*
Copyright @copyright{} 2017, 2018 Clément Lassieur@* Copyright @copyright{} 2017, 2018 Clément Lassieur@*
Copyright @copyright{} 2017, 2018 Mathieu Othacehe@* Copyright @copyright{} 2017, 2018 Mathieu Othacehe@*
Copyright @copyright{} 2017 Federico Beffa@* Copyright @copyright{} 2017 Federico Beffa@*
...@@ -14291,24 +14292,79 @@ capabilities to ordinary users. For example, an ordinary user can be granted ...@@ -14291,24 +14292,79 @@ capabilities to ordinary users. For example, an ordinary user can be granted
the capability to suspend the system if the user is logged in locally. the capability to suspend the system if the user is logged in locally.
@end deffn @end deffn
   
@deffn {Scheme Procedure} upower-service [#:upower @var{upower}] @ @defvr {Scheme Variable} upower-service-type
[#:watts-up-pro? #f] @ Service that runs @uref{http://upower.freedesktop.org/, @command{upowerd}}, a
[#:poll-batteries? #t] @ system-wide monitor for power consumption and battery levels, with the given
[#:ignore-lid? #f] @ configuration settings.
[#:use-percentage-for-policy? #f] @
[#:percentage-low 10] @ It implements the @code{org.freedesktop.UPower} D-Bus interface, and is
[#:percentage-critical 3] @ notably used by GNOME.
[#:percentage-action 2] @ @end defvr
[#:time-low 1200] @
[#:time-critical 300] @ @deftp {Data Type} upower-configuration
[#:time-action 120] @ Data type representation the configuration for UPower.
[#:critical-power-action 'hybrid-sleep]
Return a service that runs @uref{http://upower.freedesktop.org/, @table @asis
@command{upowerd}}, a system-wide monitor for power consumption and battery
levels, with the given configuration settings. It implements the @item @code{upower} (default: @var{upower})
@code{org.freedesktop.UPower} D-Bus interface, and is notably used by Package to use for @code{upower}.
GNOME.
@end deffn @item @code{watts-up-pro?} (default: @code{#f})
Enable the Watts Up Pro device.
@item @code{poll-batteries?} (default: @code{#t})
Enable polling the kernel for battery level changes.
@item @code{ignore-lid?} (default: @code{#f})
Ignore the lid state, this can be useful if it's incorrect on a device.
@item @code{use-percentage-for-policy?} (default: @code{#f})
Whether battery percentage based policy should be used. The default is to use
the time left, change to @code{#t} to use the percentage.
@item @code{percentage-low} (default: @code{10})
When @code{use-percentage-for-policy?} is @code{#t}, this sets the percentage
at which the battery is considered low.
@item @code{percentage-critical} (default: @code{3})
When @code{use-percentage-for-policy?} is @code{#t}, this sets the percentage
at which the battery is considered critical.
@item @code{percentage-action} (default: @code{2})
When @code{use-percentage-for-policy?} is @code{#t}, this sets the percentage
at which action will be taken.
@item @code{time-low} (default: @code{1200})
When @code{use-time-for-policy?} is @code{#f}, this sets the time remaining in
seconds at which the battery is considered low.
@item @code{time-critical} (default: @code{300})
When @code{use-time-for-policy?} is @code{#f}, this sets the time remaining in
seconds at which the battery is considered critical.
@item @code{time-action} (default: @code{120})
When @code{use-time-for-policy?} is @code{#f}, this sets the time remaining in
seconds at which action will be taken.
@item @code{critical-power-action} (default: @code{'hybrid-sleep})
The action taken when @code{percentage-action} or @code{time-action} is
reached (depending on the configuration of @code{use-percentage-for-policy?}).
Possible values are:
@itemize @bullet
@item
@code{'power-off}
@item
@code{'hibernate}
@item
@code{'hybrid-sleep}.
@end itemize
@end table
@end deftp
   
@deffn {Scheme Procedure} udisks-service [#:udisks @var{udisks}] @deffn {Scheme Procedure} udisks-service [#:udisks @var{udisks}]
Return a service for @uref{http://udisks.freedesktop.org/docs/latest/, Return a service for @uref{http://udisks.freedesktop.org/docs/latest/,
......
...@@ -273,6 +273,11 @@ (define (upower-shepherd-service config) ...@@ -273,6 +273,11 @@ (define (upower-shepherd-service config)
(define upower-service-type (define upower-service-type
(let ((upower-package (compose list upower-configuration-upower))) (let ((upower-package (compose list upower-configuration-upower)))
(service-type (name 'upower) (service-type (name 'upower)
(description
"Run @command{upowerd}}, a system-wide monitor for power
consumption and battery levels, with the given configuration settings. It
implements the @code{org.freedesktop.UPower} D-Bus interface, and is notably
used by GNOME.")
(extensions (extensions
(list (service-extension dbus-root-service-type (list (service-extension dbus-root-service-type
upower-dbus-service) upower-dbus-service)
...@@ -285,7 +290,8 @@ (define upower-service-type ...@@ -285,7 +290,8 @@ (define upower-service-type
;; Make the 'upower' command visible. ;; Make the 'upower' command visible.
(service-extension profile-service-type (service-extension profile-service-type
upower-package)))))) upower-package)))
(default-value (upower-configuration)))))
(define* (upower-service #:key (upower upower) (define* (upower-service #:key (upower upower)
(watts-up-pro? #f) (watts-up-pro? #f)
...@@ -1029,7 +1035,7 @@ (define %desktop-services ...@@ -1029,7 +1035,7 @@ (define %desktop-services
(service wpa-supplicant-service-type) ;needed by NetworkManager (service wpa-supplicant-service-type) ;needed by NetworkManager
(service avahi-service-type) (service avahi-service-type)
(udisks-service) (udisks-service)
(upower-service) (service upower-service-type)
(accountsservice-service) (accountsservice-service)
(service cups-pk-helper-service-type) (service cups-pk-helper-service-type)
(colord-service) (colord-service)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment