mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
services: xorg: Allow users to specify a list of resolutions.
* gnu/services/xorg.scm (xorg-start-command): Add #:resolutions parameter and 'screen-section' procedure. Use it. * doc/guix.texi (X Window): Adjust accordingly.
This commit is contained in:
parent
f703413e41
commit
d2e59637e3
2 changed files with 33 additions and 4 deletions
|
@ -3954,13 +3954,17 @@ password. When @var{auto-login?} is true, log in automatically as
|
|||
@end deffn
|
||||
|
||||
@deffn {Monadic Procedure} xorg-start-command [#:guile] @
|
||||
[#:drivers '()] [#:xorg-server @var{xorg-server}]
|
||||
[#:drivers '()] [#:resolutions '()] [#:xorg-server @var{xorg-server}]
|
||||
Return a derivation that builds a @var{guile} script to start the X server
|
||||
from @var{xorg-server}. Usually the X server is started by a login manager.
|
||||
|
||||
@var{drivers} must be either the empty list, in which case Xorg chooses a
|
||||
graphics driver automatically, or a list of driver names that will be tried in
|
||||
this order---e.g., @code{("modesetting" "vesa")}.
|
||||
|
||||
Likewise, when @var{resolutions} is the empty list, Xorg chooses an
|
||||
appropriate screen resolution; otherwise, it must be a list of
|
||||
resolutions---e.g., @code{((1024 768) (640 480))}.
|
||||
@end deffn
|
||||
|
||||
@node Setuid Programs
|
||||
|
|
|
@ -31,6 +31,9 @@ (define-module (gnu services xorg)
|
|||
#:use-module (guix gexp)
|
||||
#:use-module (guix monads)
|
||||
#:use-module (guix derivations)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (ice-9 match)
|
||||
#:export (xorg-start-command
|
||||
slim-service))
|
||||
|
||||
|
@ -43,13 +46,17 @@ (define-module (gnu services xorg)
|
|||
(define* (xorg-start-command #:key
|
||||
(guile (canonical-package guile-2.0))
|
||||
(xorg-server xorg-server)
|
||||
(drivers '()))
|
||||
(drivers '()) (resolutions '()))
|
||||
"Return a derivation that builds a @var{guile} script to start the X server
|
||||
from @var{xorg-server}. Usually the X server is started by a login manager.
|
||||
|
||||
@var{drivers} must be either the empty list, in which case Xorg chooses a
|
||||
graphics driver automatically, or a list of driver names that will be tried in
|
||||
this order---e.g., @code{(\"modesetting\" \"vesa\")}."
|
||||
this order---e.g., @code{(\"modesetting\" \"vesa\")}.
|
||||
|
||||
Likewise, when @var{resolutions} is the empty list, Xorg chooses an
|
||||
appropriate screen resolution; otherwise, it must be a list of
|
||||
resolutions---e.g., @code{((1024 768) (640 480))}."
|
||||
|
||||
(define (device-section driver)
|
||||
(string-append "
|
||||
|
@ -58,6 +65,21 @@ (define (device-section driver)
|
|||
Driver \"" driver "\"
|
||||
EndSection"))
|
||||
|
||||
(define (screen-section driver resolutions)
|
||||
(string-append "
|
||||
Section \"Screen\"
|
||||
Identifier \"screen-" driver "\"
|
||||
Device \"device-" driver "\"
|
||||
SubSection \"Display\"
|
||||
Modes "
|
||||
(string-join (map (match-lambda
|
||||
((x y)
|
||||
(string-append "\"" (number->string x)
|
||||
"x" (number->string y) "\"")))
|
||||
resolutions)) "
|
||||
EndSubSection
|
||||
EndSection"))
|
||||
|
||||
(define (xserver.conf)
|
||||
(text-file* "xserver.conf" "
|
||||
Section \"Files\"
|
||||
|
@ -82,7 +104,10 @@ (define (xserver.conf)
|
|||
Option \"AllowMouseOpenFail\" \"on\"
|
||||
EndSection
|
||||
"
|
||||
(string-join (map device-section drivers) "\n")))
|
||||
(string-join (map device-section drivers) "\n")
|
||||
(string-join (map (cut screen-section <> resolutions)
|
||||
drivers)
|
||||
"\n")))
|
||||
|
||||
(mlet %store-monad ((config (xserver.conf)))
|
||||
(define script
|
||||
|
|
Loading…
Reference in a new issue