hi all. I am using 65 keyboard and the arrow key is on the down right, I kind of have to move my wrist to press the arrow key, thus I want to do some keyboard layout like
Ctrl + hjkl -> Left Down Up Right
After searching the internet, seems xmodmap is the tool to achieve it. Nixos also have a wiki regarding it keyboard layout.
I mimic the code and wrote down the following:
{ config, lib, pkgs, ... }:
let
myCustomLayout = pkgs.writeText "xkb-layout" ''
keycode 37 = Mode_switch
keysym h = h H Left
keysym l = l L Right
keysym k = k K Up
keysym j = j J Down
'';
in {
services.xserver.displayManager.sessionCommands = "${pkgs.xorg.xmodmap}/bin/xmodmap ${myCustomLayout}";
}
My question is:
In the very bottom the wiki mentioned suspend/resume, suspend and resume what? xserver? what’s the command should I use?
the suspend/resume needs to be done every time I restart the computer? or start a new window?
is there any solution which can be done once and forever?
It refers to suspending the machine to RAM (i.e. sleep mode). It says that the solution works even after resuming from sleep (unlike some other methods, which require manually loading the custom layout).
services.xserver.displayManager.sessionCommands
Shell commands executed just before the window or desktop manager is started. These commands are not currently sourced for Wayland sessions.
however, the xmodmap does not work even after reboot
to print the keymap table and check if xmodmap command works or not.
If using xmodmap in command line, the cusomization keymap works, and I can using Mode_switch + hjkl as arrows.
However, the
{ config, lib, pkgs, ... }:
let
myCustomLayout = pkgs.writeText "xkb-layout" ''
keycode 37 = Mode_switch
keysym h = h H Left
keysym l = l L Right
keysym k = k K Up
keysym j = j J Down
'';
in {
services.xserver.displayManager.sessionCommands = "${pkgs.xorg.xmodmap}/bin/xmodmap ${myCustomLayout}";
}
does not work.
I tried to mimic the command line command by: