CZ-NIC/run-or-raise

Question || Feature Request: Using <Space> as a modifier key

Closed this issue · 1 comments

Is it possible?

e3rd commented

In theory yes but it requires you to do some work and testing. FIrst you need to register Space as a system modifier.

Take a look at my xmodmap output:

$ xmodmap
xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        ISO_Next_Group (0x5e)
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3        ISO_Level5_Shift (0xcb)
mod4        Super_L (0x85),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c)

The main thing is I put ISO_Level5_Shift at Caps Lock key. How did I do it? An extract from my file in /usr/share/X11/xkb/symbols/`:

// Level5 Modifier
    // Mode_switch = pre-XKB name of AltGr, known as ISO_Level3_Shift by default now)
   replace key <MDSW> {
    type[Group1] = "TWO_LEVEL", // we need two level; Shift + Caps + key would be the same as Caps + Shift + key
    symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift ] }; 
    modifier_map Mod3 { <MDSW> };        
    
    key <CAPS> {
        type[Group1] = "EIGHT_LEVEL",
        symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] 
    };
    
    key.type[Group1] = "ONE_LEVEL";

The definition is somewhat cubersome but works well for years to me.

Now I can use <Mod3> modifier which is the Caps Lock key with run-or-raise.

<Mod3>s,notify-send working

Similar way you can possibly map <Space> to a modifier... If you gain some experience, let us know here!