Swapping mouse buttons with xbindkeys not working in Nemo / Nautilus

Hi everyone,

I have a new mouse and I don’t like the default mouse button association, so I tried swapping the thumb buttons. They were associated forward and backwards and I want it the other way around. I retrieved the button numbers from xev, created a ~/.xbindkeysrc looking as below and ran xbindkeys. The change immediately worked in Google Chrome but Nemo was very unimpressed. How is that? In the file below you will see two lines per button, one commented out and one not, I tried both versions. Both worked in Chrome and none worked in Nemo.

Also, I put the xbindkeys command in my ~/.xinitrc but it doesn’t load at startup. I attached my .xinitrc below.

I am using Manjaro with Gnome and Wayland on a desktop PC, so no additional keyboard or mouse or touchpad present.

Thanks for your time!

# Mouse Buttons
#"xte "key XF86Back""
"xte "keydown Alt_L" "key Left" "keyup Alt_L""
b:9 + release
#"xte "key XF86Forward""
"xte "keydown Alt_L" "key Right" "keyup Alt_L""
b:8 + release
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

DEFAULT_SESSION=gnome-session

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

# if [ -f $sysmodmap ]; then
#     xmodmap $sysmodmap
# fi

if [ -f "$userresources" ]; then
    xrdb -merge "$userresources"
fi

# if [ -f "$usermodmap" ]; then
#     xmodmap "$usermodmap"
# fi

# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
    for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
        [ -x "$f" ] && . "$f"
    done
    unset f
fi

get_session(){
	local dbus_args=(--sh-syntax --exit-with-session)
	case $1 in
		awesome) dbus_args+=(awesome) ;;
		bspwm) dbus_args+=(bspwm-session) ;;
		budgie) dbus_args+=(budgie-desktop) ;;
		cinnamon) dbus_args+=(cinnamon-session) ;;
		deepin) dbus_args+=(startdde) ;;
		enlightenment) dbus_args+=(enlightenment_start) ;;
		fluxbox) dbus_args+=(startfluxbox) ;;
		gnome) dbus_args+=(gnome-session) ;;
		i3|i3wm) dbus_args+=(i3 --shmlog-size 0) ;;
		jwm) dbus_args+=(jwm) ;;
		kde) dbus_args+=(startplasma-x11) ;;
		lxde) dbus_args+=(startlxde) ;;
		lxqt) dbus_args+=(lxqt-session) ;;
		mate) dbus_args+=(mate-session) ;;
		xfce) dbus_args+=(xfce4-session) ;;
		openbox) dbus_args+=(openbox-session) ;;
		*) dbus_args+=($DEFAULT_SESSION) ;;
	esac

	echo "dbus-launch ${dbus_args[*]}"
}

xbindkeys &

exec $(get_session "$1")

On wayland the xbindkeys and xdotool will not work, but you could try from

like this instead:
"xte 'keydown Alt_L' 'key Left' 'keyup Alt_L'"

Also, for me

is pointless because you already have the keyup command … just make it with b:8 and b:9

Probably best for you would be to use http://aur.archlinux.org/packages/wayland-mouse-mapper-git in your wayland session.
Or even better this http://aur.archlinux.org/packages/key-mapper-git

there is a new tool to switch KEYBOARD (not mouse) buttons, which also works on wayland:

it is in the AUR.
it can distinguish between button press and release. i have used it for the last couple of weeks and it works well.

but i do not know, whether it can also remap MOUSE buttons…


i know there are programs out there to change your mouse settings:

  • piper
  • Solaar
  • Logiops

but i do not know, whether any of those programs let your remap your mouse buttons.
feel free to try them and report back…

1 Like