the layouts are in /usr/share/X11/xkb/symbols
i chose to modify the symbolic variant of the US layout, but you can work on any of them.
i would highly advise making a backup copy of the file before you go tinkering with it, just in case it becomes unusable.
from the layout directory
sudo cp us us-bak
i would also save a local copy of the section you intend to modify to your local directory as source document for your changes, then you can surgically cut and paste it in it’s entirety into the root file, rather than do open heart surgery on it while you work things out.
This was the section i worked on
// US Symbolic-Greek and Geek
// Author: droidgoo@proton.me
// based on us(symbolic) with many added symbols and improved organization
// while keeping the unique greek letters for science/engineering work
// paste this section at the end of /usr/share/X11/xkb/symbols/us
// the variant will be the text as shown in xkb_symbols "<variant>"
// GUI listings will show text defined in line name[Group1]= "English (US, Variant Desc Text)"
partial alphanumeric_keys modifier_keys
xkb_symbols "symbolic-geek" {
include "us(symbolic)"
name[Group1]= "English (US, Symbolic-Greek and Geek)";
key <TLDE> { [ NoSymbol, NoSymbol, U2241, approxeq ] }; // ` ~ ≁ ≈
key <AE01> { [ NoSymbol, NoSymbol, U220E, because ] }; // 1 ! ∎ ∵
key <AE02> { [ NoSymbol, NoSymbol, twosuperior, therefore ] }; // 2 @ ² ∴
key <AE03> { [ NoSymbol, NoSymbol, threesuperior, numerosign ] }; // 3 # ³ №
key <AE04> { [ NoSymbol, NoSymbol, U25FE, cent ] }; // 4 $ ◾ ¢
key <AE05> { [ NoSymbol, NoSymbol, dagger, doubledagger ] }; // 5 % † ‡
key <AE06> { [ NoSymbol, NoSymbol, squareroot, infinity ] }; // 6 ^ √ ∞
key <AE07> { [ NoSymbol, NoSymbol, section, paragraph ] }; // 7 & § ¶
key <AE08> { [ NoSymbol, NoSymbol, multiply, division ] }; // 8 * × ÷
key <AE09> { [ NoSymbol, NoSymbol, enfilledcircbullet, periodcentered ] }; // 9 ( • ·
key <AE10> { [ NoSymbol, NoSymbol, degree, U2300 ] }; // 0 ) ° ⌀
key <AE11> { [ NoSymbol, NoSymbol, emdash, endash ] }; // - _ — –
key <AE12> { [ NoSymbol, NoSymbol, notequal, plusminus ] }; // = + ≠ ±
key <AD01> { [ NoSymbol, NoSymbol, U21D1, U21D3 ] }; // q Q ⇑ ⇓
key <AD02> { [ NoSymbol, NoSymbol, U21D2, U21D0 ] }; // w W ⇒ ⇐
key <AD03> { [ NoSymbol, NoSymbol, Greek_epsilon, U22EE ] }; // e E ε ⋮
key <AD05> { [ NoSymbol, NoSymbol, Greek_tau, U156F ] }; // t T τ ᕯ
key <AD08> { [ NoSymbol, NoSymbol, Greek_iota, U2051 ] }; // i I ι ⁑
key <AD09> { [ NoSymbol, NoSymbol, Greek_omicron, U204E ] }; // o O ο ⁎
key <AD11> { [ NoSymbol, NoSymbol, guillemetleft, U2039 ] }; // [ { « ‹
key <AD12> { [ NoSymbol, NoSymbol, guillemetright, U203A ] }; // ] } » ›
key <BKSL> { [ NoSymbol, NoSymbol, U1F6C7, brokenbar ] }; // \ | 🛇 ¦
key <AC01> { [ NoSymbol, NoSymbol, Greek_alpha, U2659 ] }; // a A α ♙
key <AC06> { [ NoSymbol, NoSymbol, Greek_eta, U2656 ] }; // h H η ♖
key <AC08> { [ NoSymbol, NoSymbol, Greek_kappa, U2654 ] }; // k K κ ♔
key <AC10> { [ NoSymbol, NoSymbol, uparrow, downarrow ] }; // ; : ↑ ↓
key <AB01> { [ NoSymbol, NoSymbol, Greek_zeta, U0277 ] }; // z Z ζ ɷ
key <AB02> { [ NoSymbol, NoSymbol, Greek_chi, UA66B ] }; // x X χ ꙫ
key <AB05> { [ NoSymbol, NoSymbol, Greek_beta, U2657 ] }; // b B β ♗
key <AB06> { [ NoSymbol, NoSymbol, Greek_nu, U2658 ] }; // n N ν ♘
key <AB07> { [ NoSymbol, NoSymbol, Greek_mu, U2655 ] }; // m M μ ♕
key <AB08> { [ NoSymbol, NoSymbol, lessthanequal, U2303 ] }; // , < ≤ ⌃
key <AB09> { [ NoSymbol, NoSymbol, greaterthanequal, U2304 ] }; // . > ≥ ⌄
key <AB10> { [ NoSymbol, NoSymbol, U262E, U262D ] }; // / ? ☮ ☭
include "level3(ralt_switch)"
};
the keywords used in the layout definition (i.e. plusminus et.al.) can be found in a file called
keysymdef.h which you should be able to find somewhere on your system (mine was in a flatpak directory)… i just made a local copy so i could easily search it for the keywords i needed, or you can just use the UXXXX number as well.
both will work, and you can paste the actual character behind // comments for your reference… the codes are easy to find using kcharselect which you should have installed, but may need to run from a command line.
—
to get the layout to appear in the plasma settings GUI, you will also need to modify the .xml file
/usr/share/X11/xkb/rules/evdev.xml
which is also owned by root.
copy the format for the variant you are working on and change the details to match your new variant.
this is what i pasted into mine at the appropriate indenture
<?xml version="1.0"?>
<variant>
<configItem>
<name>symbolic-geek</name>
<description>English (US, Symbolic-Greek and Geek)</description>
</configItem>
</variant>
which results in it appearing in the GUI settings
also, i should mention that in order to access the 3rd and 4th charters on a keycap, you will need to assign a 3rd level shift key under the advanced tab…i used the Alt_R key for that and the Ctrl_R key for compose.