unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Mario Forzanini <mf@marioforzanini.com>
To: Rodrigo Morales <moralesrodrigo1100@gmail.com>
Cc: help-guix@gnu.org
Subject: Re: Execute startxbmap at login to map Ctrl Caps to Escape
Date: Fri, 17 Mar 2023 13:40:07 +0100	[thread overview]
Message-ID: <f32afb61-6ba6-3be5-46b9-7a1ec1bb3612@marioforzanini.com> (raw)
In-Reply-To: <CAGxMbPZOwaw8WzOqEXkcjy8sH-94DTSLy1XVK0kZQM0Vb9H01g@mail.gmail.com>

On 3/17/23 4:18 AM, Rodrigo Morales wrote:
> Thanks for the quick answer. After reading your answer and the relevant
> part of the documentation, I understand that this configuration needs to
> be set at the system level (i.e. /etc/config.scm). Wouldn't it be
> possible to set a layout for an user-account?

Well the default layout for the Xserver is set when the server starts, 
so there is no way to know which user is running the system until login. 
After login you might be able to set the keyboard layout autostarting a 
script that runs setxkbmap or xcape, or any other program you might 
need, this depends on the desktop environment/window manager you are 
using; in the case of EXWM you might add something to init.el as you 
were suggesting in your first email. In my setup GDM starts dwm directly 
from ~/.xsession which is analogous to an ~/.xinitrc, you may try 
experimenting with this file if the system configuration fails you.

> The code block below shows my configuration which was generated using
> the graphical installation (besides adding new users, I haven't made any
> modification). As you can see below, I have two users: rdrg20 and
> rdrg21, I would like rdrg20 to have the "us" keyboard layout and I would
> like rdrg21 to have the "fr" (French) keyboard layout.
> 
> ,----
> | (use-modules (gnu))
> | (use-service-modules cups desktop networking ssh xorg)
> |
> | (operating-system
> |   (locale "en_US.utf8")
> |   (timezone "America/Lima")
> |   (keyboard-layout (keyboard-layout "us"))
> |   (host-name "sony")
> |
> |   ;; The list of user accounts ('root' is implicit).
> |   (users (cons* (user-account
> |                   (name "rdrg")
> |                   (comment "This is a comment for user rdrg")
> |                   (group "users")
> |                   (home-directory "/home/rdrg")
> |                   (supplementary-groups '("wheel" "netdev" "audio" 
> "video")))
> | (user-account
> |                   (name "rdrg20")
> |                   (comment "This is a comment for user rdrg20")
> |                   (group "users")
> |                   (home-directory "/home/rdrg20")
> |                   (supplementary-groups '("wheel" "netdev" "audio" 
> "video")))
> | (user-account
> |                   (name "rdrg21")
> |                   (comment "This is a comment for user rdrg21")
> |                   (group "users")
> |                   (home-directory "/home/rdrg21")
> |                   (supplementary-groups '("wheel" "netdev" "audio" 
> "video")))
> | (user-account
> |                   (name "rdrg22")
> |                   (comment "This is a comment for user rdrg22")
> |                   (group "users")
> |                   (home-directory "/home/rdrg22")
> |                   (supplementary-groups '("wheel" "netdev" "audio" 
> "video")))
> |                 %base-user-accounts))
> |
> |   ;; Packages installed system-wide.  Users can also install packages
> |   ;; under their own account: use 'guix search KEYWORD' to search
> |   ;; for packages and 'guix install PACKAGE' to install a package.
> |   (packages (append (list (specification->package "emacs")
> |                           (specification->package "emacs-exwm")
> |                           (specification->package
> |                            "emacs-desktop-environment")
> |                           (specification->package "nss-certs"))
> |                     %base-packages))
> |
> |   ;; Below is the list of system services.  To search for available
> |   ;; services, run 'guix system search KEYWORD' in a terminal.
> |   (services
> |    (append (list
> |
> |                  ;; To configure OpenSSH, pass an 'openssh-configuration'
> |                  ;; record as a second argument to 'service' below.
> |                  (service openssh-service-type)
> |                  (set-xorg-configuration
> |                   (xorg-configuration (keyboard-layout keyboard-layout))))
> |
> |            ;; This is the default list of services we
> |            ;; are appending to.
> |            %desktop-services))
> |   (bootloader (bootloader-configuration
> |                 (bootloader grub-efi-bootloader)
> |                 (targets (list "/boot/efi"))
> |                 (keyboard-layout keyboard-layout)))
> |   (swap-devices (list (swap-space
> |                         (target (uuid
> |                                 
>   "21a4d7a3-b35b-45e1-9d91-e4fa97a593c0")))))
> |
> |   ;; The list of file systems that get "mounted".  The unique
> |   ;; file system identifiers there ("UUIDs") can be obtained
> |   ;; by running 'blkid' in a terminal.
> |   (file-systems (cons* (file-system
> |                          (mount-point "/boot/efi")
> |                          (device (uuid "E04D-B82E"
> |                                        'fat32))
> |                          (type "vfat"))
> |                        (file-system
> |                          (mount-point "/")
> |                          (device (uuid
> |                                   "67aa77a1-4cb4-4cf5-bca6-ea51c4e5632e"
> |                                   'ext4))
> |                          (type "ext4")) %base-file-systems)))
> `----

In your system configuration you can also specify multiple keyboard 
layouts and a key combination to switch between them with an option like 
'grp:alt_shift_toggle', see the relevant docs:

https://guix.gnu.org/en/manual/en/html_node/Keyboard-Layout.html

There may also be some other way I'm not aware of to set the keyboard 
layout per user, if someone else on the mailing list knows how to do 
this, feel free to correct me or suggest other possible ways.
-- 
Mario


  parent reply	other threads:[~2023-03-18 15:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17  2:31 Execute startxbmap at login to map Ctrl Caps to Escape Rodrigo Morales
2023-03-17  2:46 ` Mario Forzanini
     [not found]   ` <CAGxMbPZOwaw8WzOqEXkcjy8sH-94DTSLy1XVK0kZQM0Vb9H01g@mail.gmail.com>
2023-03-17 12:40     ` Mario Forzanini [this message]
2023-03-17 15:05 ` Gary Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f32afb61-6ba6-3be5-46b9-7a1ec1bb3612@marioforzanini.com \
    --to=mf@marioforzanini.com \
    --cc=help-guix@gnu.org \
    --cc=moralesrodrigo1100@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).