1

How do I make Fn key work like toggle and Caps Lock sticky?

Currently, I want these two specific keys but I prefer a general solution to the problem.

user.dz
  • 48,105
curusarn
  • 269

1 Answers1

1
  • Changing Fn may not possible only if the its manufacturer added such option to BIOS.

    Why?
    Short answer: Pressing Fn alone does not send a scancode.
    Long answer: See How do Fn keys work?

  • Stiky key for Caps lock alone (not full accessibility sticky modifiers)

    1. Change Caps lock key interpretation

      sudo nano /usr/share/X11/xkb/compat/caps
      

      Change LockMods action to LatchMods

      partial xkb_compatibility "caps_lock"  {
          // Keysym Caps_Lock locks Lock modifier.
          // With this, the keysym Caps_Lock can be used without binding the whole
          // key to a real modifier.
              // This is essential when you don't want to use caps lock on the first
              // level.
              // This should not have any compatibility issues when used together with
              // other layouts which don't utilize this capability.
          interpret Caps_Lock {
              action = LatchMods(modifiers = Lock);
          };
      };
      
    2. Compile the change & update the initramfs images

      sudo dpkg-reconfigure xkb-data
      sudo update-initramfs -u -k all
      
    3. Reboot

    Note, I still don't know how to make keyboard led follow the state.

    To make toggle for other modifiers (ex Alt) change their SetMods action to LockMods. Most virtual modifiers are handled in compat/misc file.

    For references see my answer to other similar question: Letting modifier keys act as toggles under X

user.dz
  • 48,105