You are not logged in.

#1 2021-07-10 10:03:01

MalteseFalcon
Member
Registered: 2021-03-31
Posts: 19

[SOLVED] Simple single key remap in specific layout (\ → ż)

I have a multi-layout keyboard on my laptop working (english and maltese).  However my Maltese layout has the ż and Ż missing.  On other Linux systems, these are correctly mapped to the \ (and its shift) keys - keycode 51.  I want this to work only for the MT layout (and not the US one) and to be persisted across reboots.  I have looked at the wiki and read about xmodmap being deprecated.  However, I am at a loss where to start.  Is setxkbmap the right tool for this?  Many config files posted in forums are missing from my setup.

$ setxkbmap -print -query
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us+mt:2+inet(evdev)+group(alt_shift_toggle)"        };
        xkb_geometry  { include "pc(pc105)"     };
};
rules:      evdev
model:      pc105
layout:     us,mt
variant:    ,
options:    grp:alt_shift_toggle

Many thanks for any pointers/solutions you can provide.

Last edited by MalteseFalcon (2021-07-11 15:08:55)

Offline

#2 2021-07-10 13:52:31

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,374

Re: [SOLVED] Simple single key remap in specific layout (\ → ż)

Why is that thing called "zabovedot"?

The default maltese variant has

    key <LSGT>	{ [ zabovedot,  Zabovedot,    backslash,          bar ]	};

So it's supposed to be on the first two levels of the backslash/bar key - which can vary in position depending on the size of your enter key, https://en.wikipedia.org/wiki/QWERTY (please link the image that fits your layout)

You've us as first layout, alt+shift should™ toggle to mt and offer that key.
What do you get for the key?

xev -event keyboard

Online

#3 2021-07-10 19:46:20

MalteseFalcon
Member
Registered: 2021-03-31
Posts: 19

Re: [SOLVED] Simple single key remap in specific layout (\ → ż)

Yes that thing is called zabovedot (ż) or Zabovedot (Ż).

ALT+SHIFT does toggle between layouts and gives me the following:
[ (us) and ġ (mt)
] (us) and ħ (mt)
\ (us) and # (mt) -- wrong, I wanted zabovedot, ż

In my MT locale, this is what I get for that key.

$ xev -event keyboard
Outer window is 0x3400001, inner window is 0x3400002

KeymapNotify event, serial 24, synthetic NO, window 0x0,
    keys:  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

KeyPress event, serial 25, synthetic NO, window 0x3400001,
    root 0x173, subw 0x0, time 812262, (783,504), root:(784,524),
    state 0x2000, keycode 51 (keysym 0x23, numbersign), same_screen YES,
    XKeysymToKeycode returns keycode: 12
    XLookupString gives 1 bytes: (23) "#"
    XmbLookupString gives 1 bytes: (23) "#"
    XFilterEvent returns: False

So #, and not my zabovedot.  How do I fix this?
May I ask a further question - what is the relationship between locale and keyboards in Linux?


My keyboard is this one: US International I think.  Here it is:
1920px-KB_US-International.svg.png

Offline

#4 2021-07-10 20:18:19

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,374

Re: [SOLVED] Simple single key remap in specific layout (\ → ż)

Well, the z isn't above the dot, is it? tongue

Anyway, you're looking for the maltese-us layout.

setxkbmap -variant ',us' # nb. the empty comma!

You can add that to the xorg configlet, https://wiki.archlinux.org/title/Xorg/K … tion_files

The basic layout only has the zbelowdot on the lesser/greater key that's on the left of the "Z" on non-us qwerty layouts.

what is the relationship between locale and keyboards in Linux?

None. Locale is output.

Last edited by seth (2021-07-10 20:18:37)

Online

#5 2021-07-11 09:10:37

MalteseFalcon
Member
Registered: 2021-03-31
Posts: 19

Re: [SOLVED] Simple single key remap in specific layout (\ → ż)

Wow, so close!  So the setxkbmap command you supplied works exactly as expected (I get the zabovedot).  When I try to set this permanently using:

sudo localectl --no-convert set-x11-keymap us,mt pc105 ,us grp:alt_shift_toggle

The changes don't work on next reboot.  Note that the file "/etc/X11/xorg.conf.d/00-keyboard.conf" is created and looks good:

# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us,mt"
        Option "XkbModel" "pc105"
        Option "XkbVariant" ",us"
        Option "XkbOptions" "grp:alt_shift_toggle"
EndSection

Also after reboot, when try the following the variant is not applied.  Is there some other file somewhere which is perhaps conflicting with this?

$ setxkbmap -print -query
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us+mt:2+inet(evdev)+group(alt_shift_toggle)"        };
        xkb_geometry  { include "pc(pc105)"     };
};
rules:      evdev
model:      pc105
layout:     us,mt
variant:    ,
options:    grp:alt_shift_toggle

The variant line is wrong here (should be ",us" as your command)...  How do I persist this change please?

ps perhaps it's called zabovedot because they wanted to group all different Zs together when sorting the names alphabetically?

Offline

#6 2021-07-11 13:22:15

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,374

Re: [SOLVED] Simple single key remap in specific layout (\ → ż)

How did you previously set the layout?
(Chances are that something™ in your session overrides the server config - you can check the xorg log for whether they're initially applied)

Online

#7 2021-07-11 15:08:07

MalteseFalcon
Member
Registered: 2021-03-31
Posts: 19

Re: [SOLVED] Simple single key remap in specific layout (\ → ż)

I found the Xorg log file (/var/log/Xorg.0.log) and it was clear that the file was being applied (amongst a ton of stuff).

[     6.286] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3"
[     6.286] (II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 6)
[     6.286] (**) Option "xkb_model" "pc105"
[     6.286] (**) Option "xkb_layout" "us,mt"
[     6.286] (**) Option "xkb_variant" ",us"
[     6.286] (**) Option "xkb_options" "grp:alt_shift_toggle"
[     6.307] (II) event3  - Power Button: is tagged by udev as: Keyboard
[     6.307] (II) event3  - Power Button: device is a keyboard
[     6.308] (II) config/udev: Adding input device Video Bus (/dev/input/event11)
[     6.308] (**) Video Bus: Applying InputClass "libinput keyboard catchall"
[     6.308] (**) Video Bus: Applying InputClass "system-keyboard"

But opening the terminal, with the mt keybaord and typing \ still gave me no ż.

So I found the Keyboard and Mouse GUI, deleted my previous MT keyboard and created one with the US variant.  It is working now (for my user at least).

CYubvaI.jpeg

Many thanks for your help with this which highlighted the problem exactly.  I would not have gotten anywhere without your help.  I still don't understand why the Xorg config file doesn't work and persist the change, but that is a problem left for another day.

ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻżżżżżżżżżżżżżżżżżżż

Offline

#8 2021-07-11 15:13:30

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,374

Re: [SOLVED] Simple single key remap in specific layout (\ → ż)

I still don't understand why the Xorg config file doesn't work

It does, but is overridden by (I guess that's) xfce when the session starts.

Online

#9 2021-07-25 18:33:33

Aetnaeus
Member
Registered: 2021-07-25
Posts: 7

Re: [SOLVED] Simple single key remap in specific layout (\ → ż)

Consider using https://github.com/rvaiya/keyd for this. It is a system wide solution and provides fairly granular control.

Offline

#10 2021-07-25 19:30:15

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,374

Re: [SOLVED] Simple single key remap in specific layout (\ → ż)

This thread is about selecting the proper keyboard layout, not some isolated remapping.
Maybe read the stuff you intend to hijack.

Online

#11 2021-07-27 00:53:46

Aetnaeus
Member
Registered: 2021-07-25
Posts: 7

Re: [SOLVED] Simple single key remap in specific layout (\ → ż)

seth wrote:

This thread is about selecting the proper keyboard layout, not some isolated remapping.
Maybe read the stuff you intend to hijack.

Sorry, my intention was to provide a display server agnostic solution for key remapping. I understand the question concerns issues connected with a specific layout but I still thought the author might profit from such a tool. I didn't mean to hijack the thread.

Offline

#12 2021-07-27 01:03:36

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,693

Re: [SOLVED] Simple single key remap in specific layout (\ → ż)

Aetnaeus,
I am guessing we all got off on the wrong foot.  Let's all start anew.  Welcome to the forums.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#13 2021-07-27 01:30:14

Aetnaeus
Member
Registered: 2021-07-25
Posts: 7

Re: [SOLVED] Simple single key remap in specific layout (\ → ż)

ewaller wrote:

Aetnaeus,
I am guessing we all got off on the wrong foot.  Let's all start anew.  Welcome to the forums.

Thanks smile. I will try and post more judiciously moving forward.

Offline

Board footer

Powered by FluxBB