2

I use PaperWM under GNOME on Wayland, which allows me to move windows by holding Alt and clicking and dragging them, and resize windows by doing the same using the right mouse button. There is a similar feature in Sway. I would like to remap my extra mouse buttons, which according to libinput debug-events are BTN_FORWARD and BTN_BACK, to Alt-left click and Alt-right click respectively, so that I can move and resize windows easily, without having to target a small title bar or window corner, or use the keyboard to hold a modifier key.

There are many questions and answers about mapping mouse buttons under Wayland. Significantly, this answer to a question about configuring an extra mouse button as a middle click links to wayland-mouse-mapper, "a small script for mapping mouse buttons to keystrokes on Wayland." But I'm not too sure how to use this script to simulate holding a keyboard modifier and clicking and dragging, before releasing the mouse button and modifier key. Maybe I need to patch PaperWM or Sway, as neither seems to provide a convenient way of mapping these mouse buttons to the window move and resize functions I want.

How can I bind an extra mouse button, under GNOME on Wayland, to simulate holding the Alt key and clicking and dragging using the left or right mouse button?

sjy
  • 826
  • 8
  • 22

0 Answers0