You are not logged in.

#1 2020-04-22 15:49:08

Math3mat1x
Member
Registered: 2020-04-22
Posts: 14

(Solved) How to enable Fn keys in a custom XKB keyboard layout?

Hello everyone,
I recently switched from AZERTY to BÉPO (I'm French). I tried in a first time to switch to the new keyboard layout with setxkbmap, which uses a very dated version in which lots of keys are missing… I then found on the internet a XKB file to set my new keyboard layout.
As I undesrtood, XKB files are description and need to be compiled in order for xorg to use the keyboard layout. Here's a script I've written to switch between layouts:

#!/bin/bash

cd /home/$USER/.config
if [ ! -e config_bepo ]; then
	touch config_bepo && echo '0' > config_bepo
fi

case $(cat config_bepo) in
	'0') echo 1 > config_bepo
	xkbcomp -w0 /usr/local/sbin/bepo.xkb $DISPLAY
	notify-send "Disposition BÉPO."
	;;
	'1') echo 0 > config_bepo
	setxkbmap fr-latin9
	notify-send "Disposition AZERTY."
	;;
esac

The problem is Fn keys are no longer detected when I switch to BÉPO. The Fn key is a "hardware key", correct me if I'm wrong, which is not detected by the kernel. If the combinations match, then a code is sent to the motherboard, allowing the kernel to proceed the information.
When I try to set a random keyboard layout using setxkbmap, the key works. But when I compile the XKB file (using xkbcomp), it doesn't. Do you know how to fix this?

Thanks in advance!

Last edited by Math3mat1x (2020-04-23 14:04:25)

Offline

#2 2020-04-22 16:22:29

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

Re: (Solved) How to enable Fn keys in a custom XKB keyboard layout?

Can you see the key combination with showkey --scancodes    ?

https://wiki.archlinux.org/index.php/Keyboard_input

Note that you need to be on a console -- not in a Window Manager -- to try this.


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

#3 2020-04-22 17:22:19

Math3mat1x
Member
Registered: 2020-04-22
Posts: 14

Re: (Solved) How to enable Fn keys in a custom XKB keyboard layout?

Thanks for the answer!
My keyboard layout only works on X11, as it is a XKB. However, as I was in AZERTY, I saw codes when I typed with the Fn key.
I think an alternative for X11 of the command showed me is xev. So, I saw codes with AZERTY, but when I type in BÉPO, I do get any of those (NoSymbol)... Here's an example:

KeyRelease event, serial 41, synthetic NO, window 0x2200001,
    root 0x5ba, subw 0x0, time 470260, (-468,706), root:(496,744),
    state 0x10, keycode 123 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

For instance I get XF86MonBrightnessUp with AZERTY when I disable the corresponding code in my i3 config (when I bindsym one of those codes, I get:

KeymapNotify event, serial 59, synthetic NO, window 0x0,
    keys:  2   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

Which means it is actally mapped.)

Offline

#4 2020-04-22 20:06:39

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

Re: (Solved) How to enable Fn keys in a custom XKB keyboard layout?

Do you have those problems when just using

setxkbmap -layout fr -variant azerty
setxkbmap -layout fr -variant bepo

?

Offline

#5 2020-04-22 20:16:02

Math3mat1x
Member
Registered: 2020-04-22
Posts: 14

Re: (Solved) How to enable Fn keys in a custom XKB keyboard layout?

When I do that, the Fn key works flawlessly. It think the problem might come from xkbcomp.
I have searched all around the internet, I didn't figured a way to generate a new keyboard layout that can be used with setxkbmap... Maybe I have to use some kind of converter?

Offline

#6 2020-04-22 20:28:13

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

Re: (Solved) How to enable Fn keys in a custom XKB keyboard layout?

switch to the new keyboard layout with setxkbmap, which uses a very dated version in which lots of keys are missing

That's "setxkbmap -layout fr -variant bepo"?
Can you link/upload the file you "found on the internet"?
It simply doesn't map those keycodes, likely because it doesn't include the file that defines them ("inet")

Offline

#7 2020-04-22 20:37:49

Math3mat1x
Member
Registered: 2020-04-22
Posts: 14

Re: (Solved) How to enable Fn keys in a custom XKB keyboard layout?

That's "setxkbmap -layout fr -variant bepo"?

Yes, that's the dated one.
Here the file I'm talking about (I switched some letters, but I don't think this is making any difference):

xkb_keymap        {

xkb_keycodes      { include "evdev+aliases(azerty)" };

xkb_types         { include "complete" };

xkb_compatibility { include "complete" };

partial alphanumeric_keys
xkb_symbols "dvorak" {

	name[Group1]= "France - Bepo, ergonomic, Dvorak way (v1.1rc2)";

	include "pc(pc105)"

	key <TLDE> { type[group1] = "FOUR_LEVEL", [ dollar, numbersign, endash, paragraph ] }; // $ # – ¶
	key <AE01> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ quotedbl, 1, emdash, doublelowquotemark ] }; // " 1 — „
	key <AE02> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ guillemotleft, 2, less, leftdoublequotemark ] }; // « 2 < “
	key <AE03> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ guillemotright, 3, greater, rightdoublequotemark ] }; // » 3 > ”
	key <AE04> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ parenleft, 4, bracketleft, U2A7D ] }; // ( 4 [ ⩽
	key <AE05> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ parenright, 5, bracketright, U2A7E ] }; // ) 5 ] ⩾
	key <AE06> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ at, 6, asciicircum, U262D ] }; // @ 6 ^ ☭
	key <AE07> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ plus, 7, plusminus, notsign ] }; // + 7 ± ¬
	key <AE08> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ minus, 8, U2212, onequarter ] }; // - 8 − ¼
	key <AE09> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ slash, 9, division, onehalf ] }; // / 9 ÷ ½
	key <AE10> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ asterisk, 0, multiply, threequarters ] }; // * 0 × ¾
	key <AE11> { type[group1] = "FOUR_LEVEL", [ equal, degree, notequal, minutes ] }; // = ° ≠ ′
	key <AE12> { type[group1] = "FOUR_LEVEL", [ percent, grave, U2030, seconds ] }; // % ` ‰ ″

	key <AD01> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ b, B, bar, underscore ] }; // b B | _
	key <AD02> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ eacute, Eacute, dead_acute, heart ] }; // é É ´ ♥
	key <AD03> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ p, P, ampersand, section ] }; // p P & §
	key <AD04> { type[group1] = "FOUR_LEVEL_ALPHABETIC", [ o, O, oe, OE ] }; // o O œ Œ
	key <AD05> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ egrave, Egrave, dead_grave, grave ] }; // è È ` `
	key <AD06> { type[group1] = "FOUR_LEVEL", [ dead_circumflex, exclam, exclamdown, U2620 ] }; // ^ ! ¡ ☠
	key <AD07> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ v, V, dead_caron, U2622 ] }; // v V ˇ ☢
	key <AD08> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ d, D, UFDD7, U2623 ] }; // d D ∞ ☣
	key <AD09> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ l, L, dead_stroke, sterling ] }; // l L / £
	key <AD10> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ j, J, U262E, U262F ] }; // j J ☮ ☯
	key <AD11> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ z, Z, UFDD8, U2619 ] }; // z Z ― ☙
	key <AD12> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ w, W, U269C, U267F ] }; // w W ⚜ ♿

	key <AC01> { type[group1] = "FOUR_LEVEL_ALPHABETIC", [ a, A, ae, AE ] }; // a A æ Æ
	key <AC02> { type[group1] = "FOUR_LEVEL_ALPHABETIC", [ u, U, ugrave, Ugrave ] }; // u U ù Ù
	key <AC03> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ i, I, dead_diaeresis, dead_abovedot ] }; // i I ¨ ˙
	key <AC04> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ e, E, EuroSign, dead_currency ] }; // e E € ¤
	key <AC05> { type[group1] = "FOUR_LEVEL", [ comma, semicolon, rightsinglequotemark, dead_belowcomma ] }; // , ; ' ,
	key <AC06> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ c, C, dead_cedilla, copyright ] }; // c C ¸ ©
	key <AC07> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ t, T, UFDD5, trademark ] }; // t T ᵉ ™
	key <AC08> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ s, S, UFDD4, U017F ] }; // s S ß ſ
	key <AC09> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ r, R, dead_breve, registered ] }; // r R ˘ ®
	key <AC10> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ n, N, dead_tilde, U2693 ] }; // n N ~ ⚓
	key <AC11> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ m, M, dead_macron, U26FD ] }; // m M ¯ ⛽
	key <BKSL> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ ccedilla, Ccedilla, U2708, U1F12F ] }; // ç Ç ✈ ?

	key <LSGT> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ ecircumflex, Ecircumflex, slash, asciicircum ] }; // ê Ê / ^
	key <AB01> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ agrave, Agrave, backslash, singlelowquotemark ] }; // à À \ ‚
	key <AB02> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ y, Y, braceleft, leftsinglequotemark ] }; // y Y { ‘
	key <AB03> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ x, X, braceright, rightsinglequotemark ] }; // x X } ’
	key <AB04> { type[group1] = "FOUR_LEVEL", [ period, colon, ellipsis, periodcentered ] }; // . : … ·
	key <AB05> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ k, K, asciitilde, U2011 ] }; // k K ~ ‑
	key <AB06> { type[group1] = "FOUR_LEVEL", [ apostrophe, question, questiondown, dead_hook ] }; // ’ ? ¿ ̉
	key <AB07> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ q, Q, dead_abovering, dead_horn ] }; // q Q ˚ ̛
	key <AB08> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ g, G, dead_greek, dagger ] }; // g G µ †
	key <AB09> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ h, H, dead_belowdot, doubledagger ] }; // h H ̣ ‡
	key <AB10> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", [ f, F, dead_ogonek, U26C4 ] }; // f F ˛ ⛄
	key <SPCE> { type[group1] = "FOUR_LEVEL", [ space, U202F, underscore, nobreakspace ] }; //    _  


	include "level3(ralt_switch)"
};

xkb_geometry { include "pc(pc105)" };

};

Thanks a lot for your answers!

Offline

#8 2020-04-23 08:07:30

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

Re: (Solved) How to enable Fn keys in a custom XKB keyboard layout?

You could copy that file to /usr/share/X11/xkb/symbols/bepo and run "setxkbmap -layout bepo -varian dvorak"

Also look into /usr/share/X11/xkb/symbols/bepo - there's
- bepo
- bepo_latin1
- bepo_afnor <= that one looks like yours on a glimpse
- dvorak (French dvorak, though doesn't look like your file at all)

Ils sont fous, ces Gaulois!

Offline

#9 2020-04-23 12:25:58

Math3mat1x
Member
Registered: 2020-04-22
Posts: 14

Re: (Solved) How to enable Fn keys in a custom XKB keyboard layout?

I tried to do what you said but it didn't work, instead, I get this error:

Error loading new keyboard description

Ils sont fous, ces Gaulois!

Nice touch smile

Offline

#10 2020-04-23 12:58:44

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

Re: (Solved) How to enable Fn keys in a custom XKB keyboard layout?

Does "setxkbmap -layout fr -variant bepo_afnor" get you the desired result?

I grew up with the variations of that line cool

Offline

#11 2020-04-23 13:32:53

Math3mat1x
Member
Registered: 2020-04-22
Posts: 14

Re: (Solved) How to enable Fn keys in a custom XKB keyboard layout?

Par Toutatis!
That was it... problem solved!

Offline

#12 2020-04-23 13:43:11

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

Re: (Solved) How to enable Fn keys in a custom XKB keyboard layout?

Heureka!

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB