I've been trying to map actions in keyboard shortcuts to be triggered by Alt+Scroll up or Alt+Scroll down. However, it looks as if scrolling isn't considered valid as the second part of a shortcut. Is there a solution that will allow me to accomplish this? Preferably one that doesn't require AutoHotkey?

Edit: I'm using Ubuntu 18.04.3 LTS.

  • @PRATAP Sorry, edited to include my os version. And I'm not sure I understand the second part of your question? I'm talking about scrolling with the mouse, not with keys. – bug56 Sep 1 '19 at 13:54
  • 0h thats a good point.. scrolling with mouse buttons cant be assigned from keyboard shortcuts.. you can use xbindkeys to use as combination of alt+mose button 4 and alt+mouse button 5 which are scroll down and scroll up.. – PRATAP Sep 1 '19 at 13:56
  • @PRATAP switching workspaces up/down, thanks for your comment I'm looking into xbindkeys now. – bug56 Sep 1 '19 at 13:59
  • @PRATAP I figured it out, thanks for your help! – bug56 Sep 1 '19 at 14:39

I found the solution! The following will do the trick using xbindkeys:

# Workspace up
"xdotool set_desktop $(expr $(expr $(xdotool get_desktop) + 1) % $(xdotool get_num_desktops))"

# Workspace down
"xdotool set_desktop $(expr $(expr $(xdotool get_desktop) + $(expr $(xdotool get_num_desktops) - 1)) % $(xdotool get_num_desktops))"

Got the commands from here

| improve this answer | |
  • great job!! and s0 quick.. – PRATAP Sep 1 '19 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.