Remap keys with modifiers on Ubuntu 18.04 Wayland

I am the (sad) owner of an otherwise-nice ASUS laptop where ASUS decided that it would be a great idea to replace the End key by Power, so you could accidentally poweroff your laptop when mispressing PgDn (see this question for the photo)...

I initially wanted to use the numeric keypad Home/7 and End/1, and it works (when Num lock is off), but when I press Shift + Home, to select the whole line, I get 7 ... unless Num lock is on, but then I get 7 instead of Home.

So I used remapped the keys with xmodmap to get Home and End behaviour with all modifiers:

keycode  79      = Home Home Home Home U2196 U21D6
keycode  87      = End End End End U2199 U21D9

Unfortunately, it's not working anymore since I upgraded to Ubuntu 18.04 with Wayland. Worse: it's actually working in Firefox but not in Eclipse...

I read many posts about different remapping techniques that were either outdated or too complex to put in place. Now that xmodmap is kind of deprecated, is there an equivalent in Wayland to remap keys with modifiers (I would be happy with (Shift+)Fn+key too)?


Just for the record, in case someone needs a quick recipe for swapping keys on Wayland (done on Ubuntu 18.04 LTS).

I've got a dumb layout on my notebook keyboard, and needed to swap the "right shift" and the "?" keys. So, following the advice from https://askubuntu.com/a/1023182/976363 I simply edited /usr/share/X11/xkb/keycodes/evdev as root, swapping the keycodes for both keys.

    <RTSH> = 62;
    ...
    <AB11> = 97;

became

    <RTSH> = 97;
    ...
    <AB11> = 62;

The actual key labels depend on your keyboard layout, which should be looked up in /usr/share/X11/xkb/symbols/.


I stopped using "Ubuntu on Wayland" as the Display Server and chose "Ubuntu" instead (which is on X11, where xmodmap is working fine).

But I would be really glad to switch back to Wayland (or until I change my laptop).