all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Setxkbmap :: Adding a custom xkb layout/variant :: Issue with specifying custom config path & wiping the cache
@ 2018-06-05 23:36 Alex Dorof
  2018-06-06  8:20 ` Pierre Neidhardt
  2018-06-07 13:03 ` Oleg Pykhalov
  0 siblings, 2 replies; 3+ messages in thread
From: Alex Dorof @ 2018-06-05 23:36 UTC (permalink / raw)
  To: help-guix

So I'm ultimately trying to add a custom layout to my xkb and then set it with setxkbmap. I use a derivation of a carpalx layout -that is very molded to my needs and uses. Layout in question modifies modifier keys and specific keycode definitions.

In the past I had no problem just having a script that I ran upon the first setup of an OS that modified system files in /usr/share/X11/xkb by adding my variant to symbols/us and a variant entry to rules/evdev.xml. It was simple and just worked. Now, enter GuixSD.

On guix I'm forced to think more about the long term scalability of my system so I can't change things nilly-willy like in the past. In lieu of creating a proper package, I found out that I can give setxkbmap a custom directory (~/.config/xkb) as long as it mirrors the system one provided by the `xkeyboard-config` package and add my changes there. This is supposed to work as shown in this example: https://askubuntu.com/questions/876005/what-file-is-the-setxkbmap-option-rules-meant-to-take-and-how-can-i-add-keyboa/896297#896297

I had a lot of problems on my first attempts so now I'm simply modifying a single keycode in 'us/intl' layout to see if setting my layout manually from us(basic) to us(intl) will reflect my change and thus be indicative of my changes being visible to the xorg/xkb. Well this sanity check fails and that's where I'm at right now, not very sane.

I use `setxkbmap -I $HOME/.config/xkb -layout us -variant intl -verbose 10' to set my layout, but this command simply sets my layout to the canonical intl layout variant without my canary modification.

This problem naturally makes me think that there is a precompiled cache involved and I need to update it. This answer (https://askubuntu.com/questions/482678/how-to-add-a-new-keyboard-layout-custom-keyboard-layout-definition) instructs that running the command `sudo rm /var/lib/xkb/*.xkm` will wipe xkb's cache. Well, guix is peculiar in many aspects but it does have a /var... but /var/lib/xkb is nowhere to be found! I have talked to the people on freenode@#guix and just manually searched around the system to no success. Since most of the system outside of /var and /home is supposed to be static-ish, there isn't even much for me to look for.

I don't know what to do anymore. I really need this to work, badly. I could try to spend hours to port my config to xmodmap, but I would not like to do that at least at the moment.

I'm helpless and at the mercy of the devs, if anyone has any info about xkb and setxkbmap as seen on GuixSD I would love to get in contact.

--
Alex Dorof
matrix.org: @axd:disroot.org

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

* Re: Setxkbmap :: Adding a custom xkb layout/variant :: Issue with specifying custom config path & wiping the cache
  2018-06-05 23:36 Setxkbmap :: Adding a custom xkb layout/variant :: Issue with specifying custom config path & wiping the cache Alex Dorof
@ 2018-06-06  8:20 ` Pierre Neidhardt
  2018-06-07 13:03 ` Oleg Pykhalov
  1 sibling, 0 replies; 3+ messages in thread
From: Pierre Neidhardt @ 2018-06-06  8:20 UTC (permalink / raw)
  To: Alex Dorof; +Cc: help-guix

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


Ha, I might have the perfect solution for you!

To sum up:
- You can't run at the system level (or even if you could, don't do it,
it's less flexible and more cumbersome to set up).
- If you redefine a keymap from scratch, you need to use xkbcomp, not
setxkbmap!
- If you only want to change some modifiers / options over a system
keymap, you can use a combination of setxkbmap and xmodmap.

See my dotfiles for an example:

	https://github.com/ambrevar/dotfiles

In .xkb, I have defined a new "usim" keymap.  The *.xkb file and the
symbols subfoler are mandatory.

To load the map, I call the following from `.xprofile`:

	xkbcomp -I"$HOME/.xkb" "$HOME/.xkb/usim.xkb" $DISPLAY 2>/dev/null

I have more settings:

	setxkbmap -layout us -variant ""

This resets the keymaps, it's useful when I do some live changes to my
keymap and they I can revert everything by simply sourcing `.xprofile`.

	xcape -e 'Control_L=Escape'

Make Left Control (which is Caps Lock in my keymap) act as Escape when
not used as a modifier.

	numlockx on

Turn on the numpad by default.

	xbindkeys

Set additional keybindings such as the multimedia bindings as par the
`.xbindkeysrc` file.

Hope that helps!

-- 
Pierre Neidhardt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* Re: Setxkbmap :: Adding a custom xkb layout/variant :: Issue with specifying custom config path & wiping the cache
  2018-06-05 23:36 Setxkbmap :: Adding a custom xkb layout/variant :: Issue with specifying custom config path & wiping the cache Alex Dorof
  2018-06-06  8:20 ` Pierre Neidhardt
@ 2018-06-07 13:03 ` Oleg Pykhalov
  1 sibling, 0 replies; 3+ messages in thread
From: Oleg Pykhalov @ 2018-06-07 13:03 UTC (permalink / raw)
  To: Alex Dorof; +Cc: help-guix


[-- Attachment #1.1: Type: text/plain, Size: 5265 bytes --]

Hello Alex,

"Alex Dorof" <axd@disroot.org> writes:

[…]

> In the past I had no problem just having a script that I ran upon the
> first setup of an OS that modified system files in /usr/share/X11/xkb
> by adding my variant to symbols/us and a variant entry to
> rules/evdev.xml. It was simple and just worked. Now, enter GuixSD.

I believe files inside ‘/usr/share/X11/xcb’ are not supposed to be
modified in any distribution.  Nothing stops you from doing this, of
course.

You could do this in Guix Store ‘/gnu/store/…-xkeyboard-config’, too.
It will work until ‘guix system reconfigure’ broke it after ‘guix pull’
someday.  :-)

This should be the same with any distribution upgrade.  Distributions
provide ‘/usr/local’ for user changes to survive *distro upgrade*.

> On guix I'm forced to think more about the long term scalability of my
> system so I can't change things nilly-willy like in the past. In lieu
> of creating a proper package, I found out that I can give setxkbmap a
> custom directory (~/.config/xkb) as long as it mirrors the system one
> provided by the `xkeyboard-config` package and add my changes
> there.

I don't see ‘~/.config/xkb’ directory (in my case expanded
‘/home/natsu/.config/xkb’) mentioned in the ‘strace’ output.
--8<---------------cut here---------------start------------->8---
strace -f -o /tmp/setxkbmap.strace setxkbmap -option keypad:pointerkeys
--8<---------------cut here---------------end--------------->8---

The only file mentioned in ‘/home/natsu’ directory is
‘/home/natsu/.Xauthority’.


Grep inside of Guix Git repository returns:
--8<---------------cut here---------------start------------->8---
./gnu/services/xorg.scm:277:                 "-xkbdir" (string-append #$xkeyboard-config "/share/X11/xkb")
…
--8<---------------cut here---------------end--------------->8---

where ‘#$xkeyboard-config’ is a Gexp, which expands to
‘/gnu/store/…-xkeyboard-config’.

Thats why we have a ‘X’ process with ‘-xkbdir’ command line flag:
--8<---------------cut here---------------start------------->8---
  root           389  0.5  0.2  00:17 03:55 /gnu/store/2qirp3qk8gn8k7dgy93rgssqfrszymfd-xorg-server-1.19.6/bin/X -xkbdir /gnu/store/fpgz8f64dnz7szskjybrwkz4l9yl1kgl-xkeyboard-config-2.23.1/share/X11/xkb -config /gnu/store/6vwrchilrdhp2c8ilj200yqff87zfg1a-xserver.conf -configdir /gnu/store/a97n3rwprlg3rr81b5pncwc909xwxb62-xorg.conf.d -logverbose -verbose -nolisten tcp -terminate :0 vt7 -auth /var/run/slim.auth
--8<---------------cut here---------------end--------------->8---

We could tweak ‘xorg-wrapper’ procedure to allow users to specify a
custom ‘xkeyboard-config’ package (aka Gexp).  But it will require to
modify inherited ‘xkeyboard-config’ package like in Guix blog article
‘gnome-keyring-sans-ssh-agent’ [1].

[…]

> This problem naturally makes me think that there is a precompiled
> cache involved and I need to update it. This answer
> (…)
> instructs that running the command `sudo rm /var/lib/xkb/*.xkm` will
> wipe xkb's cache. Well, guix is peculiar in many aspects but it does
> have a /var... but /var/lib/xkb is nowhere to be found! I have talked
> to the people on freenode@#guix and just manually searched around the
> system to no success.

Yes, no files named with ‘xkm’ in the end:
--8<---------------cut here---------------start------------->8---
find /gnu/store/ | grep 'xkm$' &> /tmp/xkm.txt
--8<---------------cut here---------------end--------------->8---

This means the problem is not with xkb's cache.  :-)

> Since most of the system outside of /var and
> /home is supposed to be static-ish, there isn't even much for me to
> look for.

Plus “outside of ‘/etc’”.

> I don't know what to do anymore. I really need this to work, badly. I
> could try to spend hours to port my config to xmodmap, but I would not
> like to do that at least at the moment.
>
> I'm helpless and at the mercy of the devs, if anyone has any info
> about xkb and setxkbmap as seen on GuixSD I would love to get in
> contact.

You could modify ‘xkeyboard-config’ and raise a version little bit.
E.g. if your ‘xkeyboard-config’ current version is ‘2.23.1’, then you
inherit package and make a ‘2.23.1-2’ or ‘2.23.2’ version.
‘./pre-inst-env guix’ will use it instead of ‘2.23.1’.  This way you
will not need to mess with ‘xorg-wrapper’ from ‘(gnu services xorg)’.
But after you will need to rebuild a lot of packages.


Also, by reading ‘xkeyboard-config-2.23.1/docs/README.config’ file from
a source of ‘xkeyboard-config’, which you could get by invoking ‘tar xf
$(guix build -S xkeyboard-config)’, I see mentioning of ‘/etc/X11/xkb’.

I don't see ‘etc’ directory in ‘find $(guix build xkeyboard-config)’,
but ‘rgrep’ in xkeyboard-config source directory shows ‘sysconfdir’:
--8<---------------cut here---------------start------------->8---
…
./configure:823:sysconfdir='${prefix}/etc'
--8<---------------cut here---------------end--------------->8---

We probably could add this flag to ‘xkeyboard-config’ package recipe:

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: gnu: xkeyboard-config: Add sysconfdir flag. --]
[-- Type: text/x-patch, Size: 509 bytes --]

diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 9b74881e1..600bdf663 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -3839,6 +3839,9 @@ extension to the X11 protocol.  It includes:
     (native-inputs
       `(("intltool" ,intltool)
         ("pkg-config" ,pkg-config)))
+    (arguments
+     `(#:configure-flags
+       (list (string-append "--sysconfdir=/etc"))))
     (home-page "https://www.x.org/wiki/")
     (synopsis "Xorg XKB configuration files")
     (description

[-- Attachment #1.3: Type: text/plain, Size: 258 bytes --]


This patch will allow to use ‘/etc/X11/xkb’ directory in addition to
‘/gnu/store/…-xkeyboard-config/share/X11/xkb’, I guess.

[1]  https://www.gnu.org/software/guix/blog/2018/customize-guixsd-use-stock-ssh-agent-everywhere/

Thanks,
Oleg.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2018-06-07 13:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-05 23:36 Setxkbmap :: Adding a custom xkb layout/variant :: Issue with specifying custom config path & wiping the cache Alex Dorof
2018-06-06  8:20 ` Pierre Neidhardt
2018-06-07 13:03 ` Oleg Pykhalov

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.