You are not logged in.

#1 2021-01-02 21:40:46

VDmvKcW9JamBSir5fNfehqpG
Member
From: Earth
Registered: 2019-12-30
Posts: 59

Remapping my numpad: Cannot remap just the minus key

My laptop lacks discrete Home/End/Page Up/Page Down keys. It uses Fn+Arrows for media controls, and uses the three-column number pad to provide these functions. However, they are too spread out. I want them all consolidated on the left edge of the number pad, right next to the main area of the keyboard, to make them easier to reach while typing. I also want the keys to function as normal when Num Lock is pressed, so I can still use the numpad. If it's possible, I'd like to make this a separate keyboard layout rather than a modification of an existing one so I can leave external keyboards unmodified. If it helps, here's a visual comparison of what I have now vs what I want.

I've tried doing two things: I tried copying /usr/share/X11/xkb/symbols/us into a new file, adding

    key <KPSU> {	[KP_Prior,	KP_Subtract	]	};
    key <KOSU> {	[KP_Prior,	KP_Subtract	]	};
    key <KP4>  {	[KP_End, 	KP_4		]	};
    key <KP1>  {	[KP_Next, 	KP_1		]	};
    key <KP5>  {	[KP_Left, 	KP_5		]	};
    key <KP9>  {	[KP_9, 		KP_9		]	};
    key <KP3>  {	[KP_3, 		KP_3		]	};

into the xkb_symbols "basic" section, and loading the new layout. I also tried adding

xkb_symbols "laptop" {
    key <KPDV> {	[	KP_Divide	]	};
    key <KPMU> {	[	KP_Multiply	]	};
    key <KPSU> {	[  KP_Prior,	KP_Subtract ]	};
    key <KPAD> {	[  	KP_Add		]	};

    key  <KP7> {	[  KP_Home,	KP_7	]	};
    key  <KP8> {	[  KP_Up,	KP_8	]	};
    key  <KP9> {	[  KP_9, 	KP_9	]	};

    key  <KP4> {	[  KP_End,	KP_4	]	};
    key  <KP5> {	[  KP_Left,	KP_5	]	};
    key  <KP6> {	[  KP_Right,	KP_6	]	};

    key  <KP1> {	[  KP_Next,	KP_1	]	};
    key  <KP2> {	[  KP_Down,	KP_2	]	};
    key  <KP3> {	[  KP_3,	KP_3	]	};

    key  <KP0> {	[  KP_Insert,	KP_0	]	};
    key <KPPT> {	[  KP_Delete,	KP_Decimal ]	};
    key <KPEN> {	[  	KP_Enter	]	};
};

to the /usr/share/X11/xkb/symbols/keypad and loading "us+keypad(laptop)" as the keyboard layout. In both cases, my modifications to 4, 5, and 1 worked correctly. (4 became end, 5 became left arrow, and 1 became page down.) However, the minus key does not become Page Up. I would also prefer for 9 and 3 to stop functioning as Page Up and Page Down (preferably just inserting 9 and 3 even when numlock is off) because having duplicate keys that close together feels weird to me, but that isn't as important. As of right now, 9 and 3 are still page up and page down.

I tried to look around, but the rest of the file confuses me. These keys seem to be defined many slightly different times throughout both the us and the keypad files, and there are only sometimes include statements, and I feel like they are pointing me in the wrong direction, for example towards definitions for behavior with nonexistent higher-level modifier keys or towards definitions for legacy non-PC hardware or device-specific layouts. Plus, it seems difficult to find any clear explanation of where exactly I should be operating. If I replace every instance of KP_Subtract with KP_Prior, it makes the key work as page up, but it remains page up when numlock is on, and trying every replacement individually sounds quite tedious. Does anyone know of any easy to follow resources that can point me to where I can modify that key?

Also, I'm using Wayland. (Sway if it matters.) While this works, editing Xorg keyboard maps feels a little unwaylandy. Is there a more waylandy way to do this, or is this the official way?

Offline

Board footer

Powered by FluxBB