In return for the one who was killed, the X220i almost bought the X220 tablet. A wonderful piece of hardware - a laptop with a rotating screen, touchscreen and pen (which understands the "pressing force"). However, alas, part of the hardware buttons (including on the rotating screen) did not work.
One of them is the rotation button (in the photo). Very useful for translating a laptop in readmode (with portrait-portrait orientation).
What do we want?
- By pressing rotate the picture by 90 °
- By pressing again to return back
- Rotate the perception of all touchscreens (discovered during the debugging of the solution)
- (upd) disable the touchpad - it sometimes works on the flip cover
Under the cut - a solution and links to the materials used.
If you adapt to your hardware - consider the following points:
- The definition of a turn in the script was made carelessly - a rather coarse grep on the conclusion of xrandr.
- The keycode for your button may be different.
- The name of the touch device may be different
To begin with, we put the xkeybind package, which will allow us to hang arbitrary programs on arbitrary buttons:
apt-get install xkeybind
Next, we write a screen rotation script, it does three things after determining the current position of the screen: turns the screen, rotates the touchscreen orientation, turns off or turns on the touchpad (by number).
- as I warned, grep is very careless
- The list of devices can be viewed using xsetwacom --list
- left = ccw, if you want to turn right, then cw
- The list of devices can be viewed in xinput --list
I called this script / usr / local / bin / rotate.
Do not forget about chmod + x on it.
Next, we write the config for xbindkeys:
- Make a touch ~ / .xbindkeysrc (xbindkeys has a minor bug - in the absence of the config -k does not work).
- Run xbindkey -k. We get a window in which we need to press the button we need - the output will be the line that xbindkeys needs to give to start the program by pressing the button. This path turned out to be the most effective for me, even though I started with magic setkeys, scancodes, keikodes, etc.
- We enter in a config (~ / .xbindkeys):
"rotate" m:0x0 + c:161
(it is clear that for different devices the second line will be different)
- We start xkbindkeys, we check what works.
- Registering xbindkeys launch in ~ / .xsession
- PROFIT ??? (see picture at the beginning of the post)