I want to emulate horizontal scrolling when I use my (vertical) scroll wheel and pressing Shift.
In some applications (Chrom{e,ium}) this already works, but I'm looking for a generic solution for X applications.
The closest I got so far is xbindkeys
+ xdotool
.
# ~/.xbindkeysrc
"xdotool click 6"
shift + b:4
"xdotool click 7"
shift + b:5
The Problem is that xbindkeys
seems to miss some events, and occasionally a vertical scroll "gets through". This is very annoying. It looks like xbindkeys
is using some kind of polling?
Also I don't like spawning hundreds of shell commands per seconds.
I got a small screen and have to scroll horizontally a lot.
How can I achieve generic horizontal scrolling?
UPDATE:
There is another way that does mostly what I want with xbindkeys
and xmodmap
.
"xmodmap -e 'pointer = 1 2 3 6 7 4 5 8 9 10'"
c:50
"xmodmap -e 'pointer = default'"
release + shift + c:50
When Shift is held, the pointer buttons 4 and 5 are mapped to 6 and 7. (Buttons 4/5 are fore vertical scrolling and 6/7 for horizontal scrolling). c:50
is the left Shift key. On key release the default pointer mapping is restored.
This solves the "too many events" Problem nicely. However, the Shift key doesn't work as normal modifier anymore. I tried to re-issue the Shift press/release events with xdotool
like this:
"xmodmap -e 'pointer = 1 2 3 6 7 4 5 8 9 10'; xdotool keydown Shift_L"
c:50
"xmodmap -e 'pointer = default'; xdotool keyup Shift_L"
release + shift + c:50
According to xev
the Shift events get through, but I think it's not recognized as a modifier any more. For example, pressing Shift+A wouldn't produce an uppercase A
.
~/.xbindkeysrc.scm
. At some point it failed, but it might work on your system. – Sparhawk Aug 20 '14 at 15:22