Score:2

Bind "workspace down" and "workspace up" to mouse buttons using Xbindkeys on Ubuntu 20.04

br flag

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!

vanadium avatar
cn flag
@TBr note that this is exactly the approach OP is currently using. The question is if there is an alternative because this approach is quite unresponsive. Anyway, indeed this approach only works on Xorg whereas Wayland is increasingly replacing Xorg.
Score:1
cn flag

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.

fmakoto avatar
br flag
Thanks! That is precisely what I was looking for!
fmakoto avatar
br flag
And in fact, the buttons get completely responsive using this approach. Regards!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.