LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Laptop and Netbook (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/)
-   -   Map ctl left/right to pgup/pgdown on laptop with no pgup/down keys (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/map-ctl-left-right-to-pgup-pgdown-on-laptop-with-no-pgup-down-keys-4175736260/)

Bonz0 04-20-2024 10:39 AM

Map ctl left/right to pgup/pgdown on laptop with no pgup/down keys
 
My Asus G14 has no pageup/down keys so I would like to map ctl left/right to pgup/down. I'm mostly concerned with X not the console. I assume that it would work in a terminal emulator? The documentation I've read on this looks pretty mind numbing but maybe there's a simple way to do it that I'm missing?

I've noticed that ctl up/down is mapped to home/end. Where would this be configured?

michaelk 04-20-2024 11:22 AM

Welcome to LinuxQuestions.

On my old Asus laptop:
home = ctrl + left arrow
end = ctrl + right arrow
page up = ctrl + up arrow
page down = ctrl + down arrow.

Granted there are different models of the G14 but the pictures of the keyboard I found it looks the same and marked accordingly. I guess I don't know why it would change?

Bonz0 04-20-2024 12:02 PM

Quote:

Originally Posted by michaelk (Post 6497330)
Welcome to LinuxQuestions.

On my old Asus laptop:
home = ctrl + left arrow
end = ctrl + right arrow
page up = ctrl + up arrow
page down = ctrl + down arrow.

Granted there are different models of the G14 but the pictures of the keyboard I found it looks the same and marked accordingly. I guess I don't know why it would change?

I don't think I'm mistaken about this. There are no marks on the arrow keys except arrows and on the up/down there's a keyboard symbol because keyboard backlight is set with fn up/down. I saw a post on a forum that said that ctl up/down was mapped to home end and when I tried it out it was. ctl left/right is not mapped to anything as far as I can tell. I saw a post on a forum where an Asus person admitted there was no pgup/down on some Asus G14's.

michaelk 04-20-2024 04:00 PM

It may help to know what distribution you are running and if it is Xorg or Wayland.

Bonz0 04-20-2024 04:45 PM

Quote:

Originally Posted by michaelk (Post 6497374)
It may help to know what distribution you are running and if it is Xorg or Wayland.

It's Debian testing. Xorg. I assume that a generic UK QWERTY keyboard configuration doesn't cover the platform specific quirks? If not where is that configured?

From what I've seen setxkbmap can be used but it's not straightforward.


See this review where he says "there are no Home/End/PgUP/PgDn keys with this layout, not even with key combos".

There is home and end but I'm not sure it's documented.

https://www.ultrabookreview.com/3608...a401iv-review/

Bonz0 04-22-2024 03:17 PM

I figured out something that works but not quite in the way that I wanted. I have pgup/pgdown working with AltGr right/left.

Apparently I can put a file called "custom" under /usr/share/X11/xkb/symbols and it won't be overwritten. In that file I have this:

default partial alphanumeric_keys
xkb_symbols "gb_custom" {

include "gb(basic)"

name[Group1]="English (UK) custom";

key <LEFT> { [ Left, Left, Next ] };
key <RGHT> { [ Right, Right, Prior ] };

include "level3(ralt_switch)"
};

By including gb(basic) I only have to include the keys that I want to modify. Prior/Next mean pgup/pgdown. The fact that Prior/Next are third in the list means that they are the result of pressing AltGr. First on the list is the key with no modifier. Second is shift. Third AltGr and fourth shift+AltGr.

The keymap can be loaded with "setxkbmap custom" and in /etc/default/keyboard XKBLAYOUT="custom".

A picture of the physical keyboard model with the key names (pc105 in my case) can be produced with xkbprint -label name -o names.ps $DISPLAY; ps2pdf names.ps.

I was thrown off by the fact that in the layout image the right arrow key was called RIGHT but in the file /usr/share/X11/xkb/keycodes/evdev it's called RGHT.

It's quite easy to have keys output any character you want once you know how to do it but I still don't know how to include the cntl key to do cntl left/right. I haven't found where cntl up/down is mapped to home/end. Having said that home/end doesn't work in a terminal emulator but my mapping of pgup/down does.

The layout is set with a xfce startup script that executes when you log on.

I've left my xfce keyboard config as it it for now. I don't know if there will be any conflicts. Something shows up in xfce's keyboard settings called "A user-defined custom layout" but it's not clear whether this is my custom layout.

Bonz0 04-23-2024 12:01 PM

I found another way to do it that's allot simpler and doesn't seem to reset when resuming from sleep.

Fn left/right give out key codes that seem to be mapped to XF86Launch2 and XF86Launch3. I found the keycodes with xev. When I tried to map these to pgup/down using the setxkbmap method it didn't work. However mapping with xmodmap did work and doesn't involve making a custom layout.

I put the following in a file caled ~/.Xmodmap

keycode 157 = Next
keycode 210 = Prior

Then execute xmodmap ~/.Xmodmap. Apparently using xmodmap is the old way to do it so I don't know how long it will be before it breaks but for now it works a treat.


All times are GMT -5. The time now is 09:01 PM.