emacs: change my prefix from a/ to mab/
[~bandali/configs] / .local / bin / toggle-tablet
CommitLineData
a92a01fe
AB
1#!/bin/sh
2
3# This script toggles between a 'normal' mode and a 'tablet' mode, doing
4# a few things:
5
6# - rotates the screen using =xrandr=, so that rotating the physical
7# display of my X220t would have the laptop's battery on the right
8# hand side,
9# - enables touch screen,
10# - properly rotates the stylus pen and touch screen pointers, and
11# - toggles between RGB and Vertical BGR sub-pixel order.
12
13case $(xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation) in
14 0) # Screen is not rotated, we should rotate it right (90°)
15 xrandr -o 3
16 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 1
17 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 1
18 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 1
19 xfconf-query -c xsettings -p /Xft/RGBA -s vbgr
20 ;;
21 1) # Currently top is rotated right, we should set it normal (0°)
22 xrandr -o 0
23 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 0
24 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 0
25 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 0
26 xfconf-query -c xsettings -p /Xft/RGBA -s rgb
27 ;;
28 *)
29 echo "Unknown result from 'xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation'" >&2
30 exit 1
31 ;;
32esac