Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-08-30 11:15:02

borysj
Member
Registered: 2023-08-30
Posts: 2

Changing keybindings in an existing keyboard layout

Hello,

I am struggling with customizing the keyboard layout. "Customizing" as in "redefining some keys", not as in "changing the layout altogether".

I tried editing /usr/share/X11/xkb/symbols, but it seems that the settings in this file are ignored altogether by the system: After a restart I could see that the file did not revert to default version, but the keys still worked exactly as before. I ran sudo dpkg-reconfigure xkb-data to no avail.

However, when I run
setxkbmap -v no
I am getting an error message:

Warning! Multiple definitions of keyboard layout
Using command line, ignoring X server
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+no+inet(evdev)+group(alt_shift_toggle)
geometry:   pc(pc105)

which I am not sure what means. But then again, I get the same error message for any other keyboard layout too, so maybe this command is not relevant for the problem...

I considered using xmodmap, but I do not understand how to make AltGr-keybindings there, and also I read somewhere that this is an outdated solution.

So, basically, what I am asking is:
Which file should I edit to change some keys (AltGr-bindings, specifically) in a keyboard layout in XFCE? /usr/share/X11/xkb/symbols does not seem to work.

Background: I am working on a Norwegian keyboard, but write often in Polish, so I would like to add Polish letters to their usual AltGr-spots. Switching between Polish and Norwegian layouts is annoying, because all the signs (@;"&? and so on) are placed differently in these two, and using vim gets much harder than necessary. smile

Thank you!

Offline

#2 2023-08-30 12:24:45

borysj
Member
Registered: 2023-08-30
Posts: 2

Re: Changing keybindings in an existing keyboard layout

OK, so I managed to solve the issue using xmodmap anyway.

I have created an .Xmodmap file in my home directory with the following format:

keycode 38 = a A aogonek Aogonek aogonek Aogonek

where the 38 stands for the a-key and the six variables after the equality sign are 1) simple press, 2) press with Shift, 3) ???, 4) ???, 5) press with AltGr, 6) press with AltGr-Shift. I am not sure what the third and fourth variable correspond to, so I just made them into the wanted symbols as well to be on the safe side. I have used xev to identify the keycodes, and added all the keys and bindings I needed (for reference, the polish letters are called cacute, eogonek, lstroke, nacute, oacute, sacute, zabovedot and zacute).

Then I added the line:

xmodmap ~./Xmodmap

to
/etc/X11/init/xinitrc
so the xmodmap-script activates automatically.

It works! However, several people on the web say that using xmodmap is an outdated solution. It would be great if someone told me how I can achieve the same result with xkb. smile

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.022 seconds, 7 queries executed - Memory usage: 521.09 KiB (Peak: 529 KiB) ]