[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Execute startxbmap at login to map Ctrl Caps to Escape

From: Mario Forzanini
Subject: Re: Execute startxbmap at login to map Ctrl Caps to Escape
Date: Fri, 17 Mar 2023 13:40:07 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2

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:

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]