📜 ⬆️ ⬇️

Button to rotate the screen on the X220 tablet

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?



Under the cut - a solution and links to the materials used.


If you adapt to your hardware - consider the following points:


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).

 #!/bin/bash rotation=`xrandr -q | fgrep "left (" ` if [ $? == 1 ] ; then xrandr -o left xsetwacom --set "Wacom ISDv4 E6 Pen stylus" Rotate ccw xsetwacom --set "Wacom ISDv4 E6 Finger touch" Rotate ccw xsetwacom --set "Wacom ISDv4 E6 Pen eraser" Rotate ccw xinput set-prop 13 "Device Enabled" 0 else xrandr -o normal xsetwacom --set "Wacom ISDv4 E6 Pen stylus" Rotate normal xsetwacom --set "Wacom ISDv4 E6 Finger touch" Rotate normal xsetwacom --set "Wacom ISDv4 E6 Pen eraser" Rotate normal xinput set-prop 13 "Device Enabled" 1 fi 


Notes:

I called this script / usr / local / bin / rotate.

Do not forget about chmod + x on it.

Next, we write the config for xbindkeys:
  1. Make a touch ~ / .xbindkeysrc (xbindkeys has a minor bug - in the absence of the config -k does not work).
  2. 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.
  3. We enter in a config (~ / .xbindkeys):
     "rotate" m:0x0 + c:161 

    (it is clear that for different devices the second line will be different)
  4. We start xkbindkeys, we check what works.
  5. Registering xbindkeys launch in ~ / .xsession
  6. PROFIT ??? (see picture at the beginning of the post)

links


Source: https://habr.com/ru/post/105219/


All Articles