Skip to content

Commit

Permalink
Add a new option (GH-139)
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-ueding committed Nov 6, 2017
1 parent 64638d2 commit a81a752
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
Changelog
#########

v4.11.0
Released: 2017-11-06 20:50:08 +0100

- Add a configuration option ``input.use_xsetwacom_if_available`` in order
to let the user choose whether to use ``xsetwacom`` or ``xinput``
(GH-139)

v4.10.0
Released: 2017-03-19 18:40:09 +0100

Expand Down
12 changes: 11 additions & 1 deletion doc/man/thinkpad-rotate.1.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. Copyright © 2012-2015 Martin Ueding <dev@martin-ueding.de>
.. Copyright © 2012-2015, 2017 Martin Ueding <dev@martin-ueding.de>
Licensed under The GNU Public License Version 2 (or later)
###############
Expand Down Expand Up @@ -114,6 +114,16 @@ You can set the following option:
Executable file to run before rotation.
*Default: ~/.config/thinkpad-scripts/hooks/prerotate*

``input.use_xsetwacom_if_available``
When an input device has a Wacom rotation property, we will use
``xsetwacom`` to rotate it. Desktop environments like GNOME 3 might also
rotate the input devices, but by applying a rotation matrix via ``xinput``.
This results in a double rotation, effectively no rotation at all. `We have
decided <https://github.com/martin-ueding/thinkpad-scripts/issues/139>`_
that we cannot reliably guess what the desktop environment does. Therefore
we offer an option for the user to override the default behavior. *Default:
true*

``rotate.default_rotation``
Default rotation if device is in normal rotation and no arguments are
given. *Default: right*
Expand Down
1 change: 1 addition & 0 deletions tps/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ prerotate = ~/.config/thinkpad-scripts/hooks/prerotate
trackpoint_device = TrackPoint
touchpad_device = TouchPad
touchscreen_device = Wacom ISDv4 E6 Finger.*?
use_xsetwacom_if_available = true

[logging]
syslog = true
Expand Down
5 changes: 4 additions & 1 deletion tps/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,16 @@ def map_rotate_all_input_devices(output, orientation):
'''
Maps all Wacom® devices.
'''
config = tps.config.get_config()

matrix = generate_xinput_coordinate_transformation_matrix(output,
orientation)
wacom_device_ids = get_wacom_device_ids()

logger.info('Mapping and rotating all input devices.')
for device in wacom_device_ids:
if has_device_property(device, 'Wacom Rotation'):
if has_device_property(device, 'Wacom Rotation') \
and config['input'].getboolean('use_xsetwacom_if_available'):
logger.info('Device %d has “Wacom Rotation” property, use xsetwacom.', device)
map_rotate_wacom_device(device, output, orientation)
else:
Expand Down

0 comments on commit a81a752

Please sign in to comment.