* Execute startxbmap at login to map Ctrl Caps to Escape
@ 2023-03-17 2:31 Rodrigo Morales
2023-03-17 2:46 ` Mario Forzanini
2023-03-17 15:05 ` Gary Johnson
0 siblings, 2 replies; 4+ messages in thread
From: Rodrigo Morales @ 2023-03-17 2:31 UTC (permalink / raw)
To: help-guix
Table of Contents
_________________
1. The context
2. The question
3. Additional information
1 The context
=============
I've been using Guix for around 1 month. I'd previously used Arch
Linux. In Arch Linux, I mapped Caps Lock to Ctrl by inserting the
following statement in my ~/.xinitrc file (see code block below)
,----
| #!/bin/bash
|
| setxkbmap -option 'ctrl:nocaps' -layout us
|
| exec i3
`----
The `~/.xinitrc' file was read by `startx', as you can see in the last
line of the file `~/.profile' (see code block below)
,----
| (...)
|
| startx ~/.xinitrc
`----
In Guix, I'm using Emacs with EXWM and I want to map Caps Lock to
Escape as I did in Arch in Linux. I don't necessarily want to execute
`startx' or `xinitrc'. I'm happy with whatever solution that guarantee
that the `setxbmap' command is executed.
2 The question
==============
What's the Guix way to map Caps Lock to Escape?
3 Additional information
========================
I found [this(1)] message in help-guix from 22 Mar 2021, someone
states that it has never been simple to use `xinit' or `startx' in
Guix.
I also found [this(2)] thread in help-guix started in 21 Aug 2021,
where someone reports that startx was not working.
To me, all seems to indicate that I shouldn't try to use `startxkbmap'
in `~/.xinitrc' (so that it can be read by `startx' or `xinitrc'), so
I'm sure there must be a more proper way.
I could also insert the following statement in my `init.el' file (see
code block below), but this solution doesn't look clean to me. When I
switch to i3, this solution wouldn't work.
,----
| (start-process "*foo*" nil "setxkbmap" "-option" "ctrl:nocaps"
"-layout" "us")
`----
[this(1)] <https://www.mail-archive.com/help-guix@gnu.org/msg11418.html>
[this(2)] <https://www.mail-archive.com/help-guix@gnu.org/msg12256.html>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Execute startxbmap at login to map Ctrl Caps to Escape
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 15:05 ` Gary Johnson
1 sibling, 1 reply; 4+ messages in thread
From: Mario Forzanini @ 2023-03-17 2:46 UTC (permalink / raw)
To: Rodrigo Morales; +Cc: help-guix
Hi!
On 3/17/23 3:31 AM, Rodrigo Morales wrote:
> What's the Guix way to map Caps Lock to Escape?
I actually have some similar setting mapping Caps Lock to Control in my
operating system configuration, I think this may work:
<snip>
(operating-system
(keyboard-layout (keyboard-layout "us" #:options '("caps:escape")))
; ...
<snap>
Then you can use this configuration for Xorg by adding the
'set-xorg-configuration' service:
<snip>
(service
(set-xorg-configuration
(xorg-configuration (keyboard-layout keyboard-layout)))
<snap>
Note that this approach also applies this setting to TTYs, if you only
want to modify the keyboard layout in Xorg you can modify the second
snippet:
<snip>
(service
(set-xorg-configuration
(xorg-configuration
(keyboard-layout
(keyboard-layout "us" #:option '("ctrl:escape")))))
; ...
<snap>
Then rebuild the system
--
Mario
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Execute startxbmap at login to map Ctrl Caps to Escape
2023-03-17 2:31 Execute startxbmap at login to map Ctrl Caps to Escape Rodrigo Morales
2023-03-17 2:46 ` Mario Forzanini
@ 2023-03-17 15:05 ` Gary Johnson
1 sibling, 0 replies; 4+ messages in thread
From: Gary Johnson @ 2023-03-17 15:05 UTC (permalink / raw)
To: Rodrigo Morales; +Cc: help-guix
Rodrigo Morales <moralesrodrigo1100@gmail.com> writes:
> 1 The context
> =============
>
> 8<---------------------------------------------------------------->8
> ...TEXT ELIDED...
> 8<---------------------------------------------------------------->8
>
> In Guix, I'm using Emacs with EXWM and I want to map Caps Lock to
> Escape as I did in Arch in Linux. I don't necessarily want to
> execute `startx' or `xinitrc'. I'm happy with whatever solution that
> guarantee that the `setxbmap' command is executed.
>
>
> 2 The question
> ==============
>
> What's the Guix way to map Caps Lock to Escape?
Hi Rodrigo,
A thoroughly Guix way to do this would probably be to just set the
`keyboard-layout` property in your operating system record like so:
```system.scm
(operating-system
...
(keyboard-layout (keyboard-layout "emacs"))
...)
```
This should update the keymap at your tty sessions, but I'm not sure if
it will propagate into your X session. Perhaps someone else here has
tried it?
I also run EXWM as my window manager on Guix System, and I've addressed
this keymapping issue by just inserting it into my $HOME/.xsession file
like so:
```.xsession
# Change cursor to left arrow
xsetroot -cursor_name left_ptr
# Set keyboard repeat rate
xset r rate 200 60
# Change Caps Lock to Ctrl
setxkbmap -option "ctrl:nocaps"
setxkbmap -option "terminate:ctrl_alt_bksp"
# Start Emacs with the exwm script:
exwm
```
Have fun and happy hacking!
Gary
--
=======================================================================
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
Why is HTML email a security nightmare? See https://useplaintext.email/
Please avoid sending me MS-Office attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-18 15:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2023-03-17 15:05 ` Gary Johnson
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).