I'm looking for a way to be able to scroll half a page, preferably by using a key combination like shift page up/down. In Windows, this is doable via autohotkey, for OS there does not seem to be any as easy solution as all I found was this.
I just switch to using Ubuntu 14.04 (from win7). From googling around it seems to me that the easiest way to achieve this is by creating a couple of xdotool/xbindkeys scripts, which emulate half a page worth of mouse scrolling or arrow clicking up and down, respectively. Then I would bind these to custom hotkeys.
However, since I just switched to Ubuntu, I realize that I might be missing something. Therefore I wonder, which is your preferred way to enable half page scrolling in Linux?
Update:
I created a script, which emulates scrolling the mousewheel a few times:
#!/bin/bash
xdotool click 4
xdotool click 4
xdotool click 4
xdotool click 4
It works decently, but two problems remain:
-
It always scrolls the window where the mouse is. I have tried to make it scroll the active window but no luck.
-
Since it sends mouse wheel scrolls, these are interpreted by other programs such that I cannot have control as a hotkey, because then it zooms. This is a problem in programs where all hotkeys are taken so ideally, I would like to specify the scrolling distance without emulating mouse wheel scrolling.
Best Answer
I finally came up with a solution that works very well for most of my use-cases. Using
xdotools
, I created two scripts, one for scrolling in each direction. This is the script for scrolling down (to scroll up, substitute '5' for '4').Basically, xdotools get the activewindow id and then moves the moves there before sending the mouse scroll signal several times. I could not get it to work by directly specifying which window to send the clicks to, so I solved it by moving the mouse cursor instead. Since Linux automatically scrolls the window under the mouse, this solves problem 1 listed in my question. The
--clearmodifiers
parameter releases whatever modifier key used in the hotkey combination so that the only key that is sent is the one from xdotool, this solves problem number 2 for me.The only minor annoyance left is that in some windows, there are multiple panels and with this script I can only scroll the top leftmost panel. This is not a problem when browsing but for IDEs such as spyder. So if someone has a better approach, please share!