Bind "workspace down" and "workspace up" to mouse buttons using Xbindkeys on Ubuntu 20.04
The standard shortcut to switch workspaces are Ctrl+Alt+Pgdown or Ctrl+Alt+Pgup and I want to bind these commands to buttons in my mouse. Therefore, I can achieve what I want using xbindkeys and xdotool by placing in the .xbindkeysrc the following:
"xdotool key 'Control_L+Alt_L+Up'"
b:9
"xdotool key 'Control_L+Alt_L+Down'"
b:8
The problem is that this setup is quite unresponsive and frequently slow.
So I wonder if there are direct commands to avoid using xdotool. Iḿ using Ubuntu 20.04. Any help would be appreciated!
A way to do this using commands is indicated by Florian Muellner himself in this post. The command you need is
dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'global.workspace_manager.get_active_workspace().get_neighbor(Meta.MotionDirection.DOWN).activate(global.get_current_time());'
Change .DOWN
to .UP
to move upwards. If you are on Gnome 40 or up (Ubuntu 21.10 and up), then use .LEFT
or .RIGHT
.