5

Other than using xdotool is there a way to scroll down by a set amount using a command. In other words, what is the scrolling command?

I'm not looking for a keyboard shortcut, I want a command for scrolling by say 10px in the currently focussed window. I also don't want xdotool because I need the "deeper command", what is "executed" when the wheel is rolled.

Tim
  • 32,861
  • 27
  • 118
  • 178

4 Answers4

6

Not exactly what you asked for, because the OP asked for "10px" scrolling, but since it also asked for "what is executed when the wheel is rolled". In Linux, when the wheel is rolled, it's up to the application to interpret it, but you can still simulate wheel rolling.

Wheel rolling up and down are typically mapped as mouse button 4 and 5 respectively. The following command will simulate scrolling up

xdotool click 4

and the following command will simulate scrolling down

xdotool click 5

Use custom shortcuts or scripts to bind your input events to this command to simulate a wheel roll.

mchid
  • 43,546
  • 8
  • 97
  • 150
mogsie
  • 185
  • while true; do xdotool click 5; sleep 0.1; done will scroll down until you kill the command with CTRL+C – mchid Nov 02 '20 at 19:36
4

xdotool lets you send keyboard keys too so all the standard stuff like:

xdotool key Page_Down
xdotool key Down Down Down  # presses down three times with a 12ms delay
xdotool key --delay 2 Down Down Down  # as above but 2ms

With respect to the "deeper command", there's no one such thing. A window is sent an event (like a mousewheel) and it (the program or —more commonly— its toolkit) decides how to interpret that.

The scrolling isn't directly controllable (unless you're using an application or framework that provides an interface for doing just that). I've explained this a little bit more in your last question.

Oli
  • 293,335
  • I don't want to use xdotool, I want a "deeper" command, not xdotool, which essentially emulates the press. – Tim May 30 '14 at 17:35
  • @Tim Yeah I've added a bit for that. With the exception of really weird circumstances that I've never experienced, I don't think you can do this. – Oli May 30 '14 at 17:40
0
  • Install xdotool:

    sudo apt-get install xdotool
    
  • Get mouse pointer location:

    xdotool getmouselocation
    
  • Scroll using click 4 & 5 (change XXX and YYY from above command):

    xdotool mousemove XXX YYY click 4
    

    xdotool mousemove XXX YYY click 5

Source: https://askubuntu.com/a/329009/536195

ThunderBird
  • 1,955
-1

Scroll backwards:

Shift + Page Up

Scroll Forwards:

Shift + Page Down
Korkel
  • 1,158
  • 1
  • 10
  • 26