unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* SLiM graphical login manager and keyboard layout
@ 2019-10-18 12:33 Tanguy Le Carrour
  2019-10-18 14:40 ` Joshua Branson
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Tanguy Le Carrour @ 2019-10-18 12:33 UTC (permalink / raw)
  To: Guix

Hi Guix!

I'm not a Gnome user and I would like to get rid of GDM and use SLiM
instead.

I'm struggling to set the keyboard layout as, apparently,
slim-service-type is not supposed to be extended as gdm-service-type is.

I guess it's only a matter of copying (and adapting) the `(extend …)` and
`(compose …)` blocks from `gdm-service-type` to `slim-service-type`. But it's
just a guess. I've tried to define `my-slim-service-type` in my system config,
but failed!

Any help will be welcome!

-- 
Tanguy

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: SLiM graphical login manager and keyboard layout
  2019-10-18 12:33 SLiM graphical login manager and keyboard layout Tanguy Le Carrour
@ 2019-10-18 14:40 ` Joshua Branson
  2019-10-18 15:36   ` Tanguy Le Carrour
  2019-10-18 14:55 ` Alex Griffin
  2019-10-18 16:03 ` Diego Nicola Barbato
  2 siblings, 1 reply; 11+ messages in thread
From: Joshua Branson @ 2019-10-18 14:40 UTC (permalink / raw)
  To: guix-devel

Tanguy Le Carrour <tanguy@bioneland.org> writes:

> Hi Guix!
>
> I'm not a Gnome user and I would like to get rid of GDM and use SLiM
> instead.

This kind of question is best asked on help-guix mailing list. :)

>
> I'm struggling to set the keyboard layout as, apparently,
> slim-service-type is not supposed to be extended as gdm-service-type is.

When I last tried sddm, I was able to swap my layout like so:

(service sddm-service-type
 (sddm-configuration
  (xorg-configuration
   (xorg-configuration
    (keyboard-layout (keyboard-layout "us" "dvorak"))))))

>
> I guess it's only a matter of copying (and adapting) the `(extend …)` and
> `(compose …)` blocks from `gdm-service-type` to `slim-service-type`. But it's
> just a guess. I've tried to define `my-slim-service-type` in my system config,
> but failed!
>
> Any help will be welcome!

--
Joshua Branson
Sent from Emacs and Gnus

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: SLiM graphical login manager and keyboard layout
  2019-10-18 12:33 SLiM graphical login manager and keyboard layout Tanguy Le Carrour
  2019-10-18 14:40 ` Joshua Branson
@ 2019-10-18 14:55 ` Alex Griffin
  2019-10-18 15:57   ` Tanguy Le Carrour
  2019-10-18 16:03 ` Diego Nicola Barbato
  2 siblings, 1 reply; 11+ messages in thread
From: Alex Griffin @ 2019-10-18 14:55 UTC (permalink / raw)
  To: guix-devel

For security reasons, GDM is highly recommended even if you don't use GNOME. As far as I know, it's the only currently maintained display manager that doesn't run X as root.

-- 
Alex Griffin

On Fri, Oct 18, 2019, at 7:33 AM, Tanguy Le Carrour wrote:
> Hi Guix!
> 
> I'm not a Gnome user and I would like to get rid of GDM and use SLiM
> instead.
> 
> I'm struggling to set the keyboard layout as, apparently,
> slim-service-type is not supposed to be extended as gdm-service-type is.
> 
> I guess it's only a matter of copying (and adapting) the `(extend …)` and
> `(compose …)` blocks from `gdm-service-type` to `slim-service-type`. But it's
> just a guess. I've tried to define `my-slim-service-type` in my system config,
> but failed!
> 
> Any help will be welcome!
> 
> -- 
> Tanguy
> 
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: SLiM graphical login manager and keyboard layout
  2019-10-18 14:40 ` Joshua Branson
@ 2019-10-18 15:36   ` Tanguy Le Carrour
  0 siblings, 0 replies; 11+ messages in thread
From: Tanguy Le Carrour @ 2019-10-18 15:36 UTC (permalink / raw)
  To: guix-devel

Hi Joshua!


Le 10/18, Joshua Branson a écrit :
> Tanguy Le Carrour <tanguy@bioneland.org> writes:
> > I'm not a Gnome user and I would like to get rid of GDM and use SLiM
> > instead.
> This kind of question is best asked on help-guix mailing list. :)

Yeah, I thought so, but then I figured out that this could be solved by
modifying the code for slim-service-type and posted it on "dev".
If it's just a matter of configuring the service-type, then you're
right, I should have posted it on "help".


> > I'm struggling to set the keyboard layout as, apparently,
> > slim-service-type is not supposed to be extended as gdm-service-type is.
> 
> When I last tried sddm, I was able to swap my layout like so:
> 
> (service sddm-service-type
>  (sddm-configuration
>   (xorg-configuration
>    (xorg-configuration
>     (keyboard-layout (keyboard-layout "us" "dvorak"))))))

I tried something a bit different with SLiM:

```
    (service slim-service-type
     (slim-configuration
      (xorg-configuration
       (xorg-configuration
        (keyboard-layout keyboard-layout)
```

I don't now why, but `(keyboard-layout (keyboard-layout "us" "dvorak"))`
was throwing an error.

It seems to work… actually, it's been building linux-libre for half
an hour now, so I cannot really tell right now! ^_^'

Thanks for the help!
I'll post to "help" if this does not solve my problem!


-- 
Tanguy

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: SLiM graphical login manager and keyboard layout
  2019-10-18 14:55 ` Alex Griffin
@ 2019-10-18 15:57   ` Tanguy Le Carrour
  0 siblings, 0 replies; 11+ messages in thread
From: Tanguy Le Carrour @ 2019-10-18 15:57 UTC (permalink / raw)
  To: Alex Griffin; +Cc: guix-devel

Hi Alex!


Le 10/18, Alex Griffin a écrit :
> For security reasons, GDM is highly recommended even if you don't use GNOME.
> As far as I know, it's the only currently maintained display manager
> that doesn't run X as root.

That's a very good point. Thanks for raising it to my attention!

The thing is, I've nothing against GDM, but I keep on having problems
with it. It's the second (maybe third) time in 6 months that I run into
some weird problems when I upgrade my system, leaving me unable to login!
So, last time, instead of investigating and fixing the problem…
… I changed for SLiM!

Considering what you've just said… I'll switch back to GDM. But I'll
keep the SLiM+bépo solution at hand!

Regards,

-- 
Tanguy

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: SLiM graphical login manager and keyboard layout
  2019-10-18 12:33 SLiM graphical login manager and keyboard layout Tanguy Le Carrour
  2019-10-18 14:40 ` Joshua Branson
  2019-10-18 14:55 ` Alex Griffin
@ 2019-10-18 16:03 ` Diego Nicola Barbato
  2019-10-18 16:11   ` Tanguy Le Carrour
  2 siblings, 1 reply; 11+ messages in thread
From: Diego Nicola Barbato @ 2019-10-18 16:03 UTC (permalink / raw)
  To: Tanguy Le Carrour; +Cc: Guix

[-- Attachment #1: Type: text/plain, Size: 949 bytes --]

Hello Tanguy,

Tanguy Le Carrour <tanguy@bioneland.org> writes:

[...]

> I'm struggling to set the keyboard layout as, apparently,
> slim-service-type is not supposed to be extended as gdm-service-type is.

You can set the keyboard layout directly in the slim-configuration like
this:

--8<---------------cut here---------------start------------->8---
(service slim-service-type
         (slim-configuration
          (xorg-configuration
           (keyboard-layout keyboard-layout))))
--8<---------------cut here---------------end--------------->8---

> I guess it's only a matter of copying (and adapting) the `(extend …)` and
> `(compose …)` blocks from `gdm-service-type` to `slim-service-type`. But it's
> just a guess. I've tried to define `my-slim-service-type` in my system config,
> but failed!

It's a good guess: I tried this a while back and it works, if there is
only one instance of slim-service-type:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-services-slim-Allow-using-set-xorg-configuration-wit.patch --]
[-- Type: text/x-patch, Size: 1637 bytes --]

From be8f7e45384bb0676ea88f4cb488dd23114436f5 Mon Sep 17 00:00:00 2001
From: Diego Nicola Barbato <dnbarbato@posteo.de>
Date: Fri, 27 Sep 2019 11:24:38 +0200
Subject: [PATCH] services: slim: Allow using 'set-xorg-configuration' with
 SLiM.

Fixes <https://bugs.gnu.org/37422>.

* gnu/services/xorg.scm (slim-service-type)[compose, extend]: New fields.
---
 gnu/services/xorg.scm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 1d55e388a1..1b78550825 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -589,6 +589,21 @@ reboot_cmd " shepherd "/sbin/reboot\n"
                        ;; avoid bad surprises.
                        (service-extension profile-service-type
                                           (const (list xterm)))))
+
+                ;; For convenience, this service can be extended with an
+                ;; <xorg-configuration> record.  Take the first one that
+                ;; comes.
+                (compose (lambda (extensions)
+                           (match extensions
+                             (() #f)
+                             ((config . _) config))))
+                (extend (lambda (config xorg-configuration)
+                          (if xorg-configuration
+                              (slim-configuration
+                               (inherit config)
+                               (xorg-configuration xorg-configuration))
+                              config)))
+
                 (default-value (slim-configuration))))
 
 (define-deprecated (slim-service #:key (slim slim)
-- 
2.23.0


[-- Attachment #3: Type: text/plain, Size: 444 bytes --]


If there are multiple SLiM services, it doesn't work, because "[t]here
can be only one instance of an extensible service type" (according to
'Service Types and Services' in the manual).

Because of that I believe making slim-service-type extensible would be
more confusing than useful, which is why I didn't pursue this further.
Maybe it should be mentioned in the manual that 'set-xorg-configuration'
doesn't work with SLiM?

Regards,

Diego

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: SLiM graphical login manager and keyboard layout
  2019-10-18 16:03 ` Diego Nicola Barbato
@ 2019-10-18 16:11   ` Tanguy Le Carrour
  2019-10-18 16:57     ` Diego Nicola Barbato
  0 siblings, 1 reply; 11+ messages in thread
From: Tanguy Le Carrour @ 2019-10-18 16:11 UTC (permalink / raw)
  To: Diego Nicola Barbato; +Cc: Guix

Hi Diego!


Le 10/18, Diego Nicola Barbato a écrit :
> You can set the keyboard layout directly in the slim-configuration like
> this:
> --8<---------------cut here---------------start------------->8---
> (service slim-service-type
>          (slim-configuration
>           (xorg-configuration
>            (keyboard-layout keyboard-layout))))
> --8<---------------cut here---------------end--------------->8---

I have a slightly different version that works!

--8<---------------cut here---------------start------------->8---
           (service slim-service-type
             (slim-configuration
              (xorg-configuration
               (xorg-configuration
                (keyboard-layout keyboard-layout))))))
--8<---------------cut here---------------end--------------->8---


I don't understand the "double" `xorg-configuration`, though! ^_^'

-- 
Tanguy

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: SLiM graphical login manager and keyboard layout
  2019-10-18 16:11   ` Tanguy Le Carrour
@ 2019-10-18 16:57     ` Diego Nicola Barbato
  2019-10-21  7:24       ` Tanguy Le Carrour
  0 siblings, 1 reply; 11+ messages in thread
From: Diego Nicola Barbato @ 2019-10-18 16:57 UTC (permalink / raw)
  To: Tanguy Le Carrour; +Cc: Guix

Tanguy Le Carrour <tanguy@bioneland.org> writes:

> Hi Diego!
>
>
> Le 10/18, Diego Nicola Barbato a écrit :
>> You can set the keyboard layout directly in the slim-configuration like
>> this:
>> --8<---------------cut here---------------start------------->8---
>> (service slim-service-type
>>          (slim-configuration
>>           (xorg-configuration
>>            (keyboard-layout keyboard-layout))))
>> --8<---------------cut here---------------end--------------->8---
>
> I have a slightly different version that works!

That's because mine doesn't make sense (sorry!).  I've messed it up when
adapting it from my own config.scm.

>            (service slim-service-type
>              (slim-configuration
>               (xorg-configuration
>                (xorg-configuration
>                 (keyboard-layout keyboard-layout))))))
>
>
> I don't understand the "double" `xorg-configuration`, though! ^_^'

The outer 'xorg-configuration' is a field of the 'slim-configuration'
data type.  The inner 'xorg-configuration' is itself a data type
representing the Xorg configuration (with its 'keyboard-layout' field
set to the value of 'keyboard-layout').

If you look at the section 'X Window' in the Guix manual, you'll see
that the default value for the 'xorg-configuration' field (of the
'slim-configuration' data type) is '(xorg-configuration)', which is
simply the 'xorg-configuration' data type with all its fields set to
their respective default values.

HTH,

Diego

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: SLiM graphical login manager and keyboard layout
  2019-10-18 16:57     ` Diego Nicola Barbato
@ 2019-10-21  7:24       ` Tanguy Le Carrour
  2019-10-22 12:36         ` Ludovic Courtès
  0 siblings, 1 reply; 11+ messages in thread
From: Tanguy Le Carrour @ 2019-10-21  7:24 UTC (permalink / raw)
  To: Diego Nicola Barbato; +Cc: Guix

Le 10/18, Diego Nicola Barbato a écrit :
> Tanguy Le Carrour <tanguy@bioneland.org> writes:
> >            (service slim-service-type
> >              (slim-configuration
> >               (xorg-configuration
> >                (xorg-configuration
> >                 (keyboard-layout keyboard-layout))))))
> >
> >
> > I don't understand the "double" `xorg-configuration`, though! ^_^'
> 
> The outer 'xorg-configuration' is a field of the 'slim-configuration'
> data type.  The inner 'xorg-configuration' is itself a data type
> representing the Xorg configuration (with its 'keyboard-layout' field
> set to the value of 'keyboard-layout').

Thanks for the clarification!
All of this LISP/Scheme/Guile is still a bit magical to me! How does one makes
the difference between field assignment and data type "instanciation"? ^_^'
How does the interpreter know that the same "word" means two different
things?!

Regards,

-- 
Tanguy

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: SLiM graphical login manager and keyboard layout
  2019-10-21  7:24       ` Tanguy Le Carrour
@ 2019-10-22 12:36         ` Ludovic Courtès
  2019-10-23  7:32           ` Tanguy Le Carrour
  0 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2019-10-22 12:36 UTC (permalink / raw)
  To: Tanguy Le Carrour; +Cc: Guix, Diego Nicola Barbato

Hello Tanguy,

Tanguy Le Carrour <tanguy@bioneland.org> skribis:

> Le 10/18, Diego Nicola Barbato a écrit :
>> Tanguy Le Carrour <tanguy@bioneland.org> writes:
>> >            (service slim-service-type
>> >              (slim-configuration
>> >               (xorg-configuration
>> >                (xorg-configuration
>> >                 (keyboard-layout keyboard-layout))))))
>> >
>> >
>> > I don't understand the "double" `xorg-configuration`, though! ^_^'
>> 
>> The outer 'xorg-configuration' is a field of the 'slim-configuration'
>> data type.  The inner 'xorg-configuration' is itself a data type
>> representing the Xorg configuration (with its 'keyboard-layout' field
>> set to the value of 'keyboard-layout').
>
> Thanks for the clarification!
> All of this LISP/Scheme/Guile is still a bit magical to me! How does one makes
> the difference between field assignment and data type "instanciation"? ^_^'
> How does the interpreter know that the same "word" means two different
> things?!

There are several rules.  The most important one is lexical scope: when
you see an identifier, it always refers to the binding in its lexical
scope.  So there are no bad surprises:

  (let ((* +) (x 42))  ;here ‘+’ is a “free variable”—i.e., not in scope
    (let ((x 7))
      (* x x)))
  => 14

Then there are “special forms” (macros) that can introduce new bindings
like ‘let’.  Macros are always* “referentially transparent” (or
“hygienic”), which means notably that they only introduce bindings that
you explicitly typed in, and they cannot capture bindings that you did
not explicitly provide them as an argument:

  (let ((x 3))
    ;; Here ‘x’ is defined.
    …)

  (operating-system
    (keyboard-layout …)
    ;; Here ‘keyboard-layout’ is defined, because ‘operating-system’
    ;; expands to something like:
    ;;
    ;;  (let* ((keyboard-layout …) (next-field …) …) …)
    )

The rules are unambiguous.  I understand it takes some getting used to
it, but the general idea is that scoping behaves “like you’d expect.”

HTH!

Ludo’.

* It’s possible to write so-called “unhygienic” macros that would, for
  instance, forcefully create bindings that don’t appear in the source,
  but that’s considered bad practice and we don’t do that in the Guix
  code base.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: SLiM graphical login manager and keyboard layout
  2019-10-22 12:36         ` Ludovic Courtès
@ 2019-10-23  7:32           ` Tanguy Le Carrour
  0 siblings, 0 replies; 11+ messages in thread
From: Tanguy Le Carrour @ 2019-10-23  7:32 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix, Diego Nicola Barbato

Hi Ludovic,

Thanks for taking the time to clarify all this!
… but I have to confess that I had to read it several times! ^_^'


Le 10/22, Ludovic Courtès a écrit :
> Tanguy Le Carrour <tanguy@bioneland.org> skribis:
> > Le 10/18, Diego Nicola Barbato a écrit :
> >> Tanguy Le Carrour <tanguy@bioneland.org> writes:
> >> >            (service slim-service-type
> >> >              (slim-configuration
> >> >               (xorg-configuration
> >> >                (xorg-configuration
> >> >                 (keyboard-layout keyboard-layout))))))
> >> >
> >> >
> >> > I don't understand the "double" `xorg-configuration`, though! ^_^'
> >> 
> >> The outer 'xorg-configuration' is a field of the 'slim-configuration'
> >> data type.  The inner 'xorg-configuration' is itself a data type
> >> representing the Xorg configuration (with its 'keyboard-layout' field
> >> set to the value of 'keyboard-layout').
> >
> > Thanks for the clarification!
> > All of this LISP/Scheme/Guile is still a bit magical to me! How does one makes
> > the difference between field assignment and data type "instanciation"? ^_^'
> > How does the interpreter know that the same "word" means two different
> > things?!
> 
> There are several rules.  The most important one is lexical scope: when
> you see an identifier, it always refers to the binding in its lexical
> scope.  So there are no bad surprises:
> 
>   (let ((* +) (x 42))  ;here ‘+’ is a “free variable”—i.e., not in scope
>     (let ((x 7))
>       (* x x)))
>   => 14

So a variable name can **really** be anything! "*", "+", "specification->package"…
I think I'll get used to it! :-)


> Then there are “special forms” (macros) that can introduce new bindings
> like ‘let’.  Macros are always* “referentially transparent” (or
> “hygienic”), which means notably that they only introduce bindings that
> you explicitly typed in, and they cannot capture bindings that you did
> not explicitly provide them as an argument:
> 
>   (let ((x 3))
>     ;; Here ‘x’ is defined.
>     …)
> 
>   (operating-system
>     (keyboard-layout …)
>     ;; Here ‘keyboard-layout’ is defined, because ‘operating-system’
>     ;; expands to something like:
>     ;;
>     ;;  (let* ((keyboard-layout …) (next-field …) …) …)
>     )
> 
> The rules are unambiguous.  I understand it takes some getting used to
> it, but the general idea is that scoping behaves “like you’d expect.”

OK… this one I'll have to read again! … maybe even sleep on it… several
nights! ^_^'


> HTH!

Definitivly! Thanks!


-- 
Tanguy

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-10-23  7:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 12:33 SLiM graphical login manager and keyboard layout Tanguy Le Carrour
2019-10-18 14:40 ` Joshua Branson
2019-10-18 15:36   ` Tanguy Le Carrour
2019-10-18 14:55 ` Alex Griffin
2019-10-18 15:57   ` Tanguy Le Carrour
2019-10-18 16:03 ` Diego Nicola Barbato
2019-10-18 16:11   ` Tanguy Le Carrour
2019-10-18 16:57     ` Diego Nicola Barbato
2019-10-21  7:24       ` Tanguy Le Carrour
2019-10-22 12:36         ` Ludovic Courtès
2019-10-23  7:32           ` Tanguy Le Carrour

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).