summaryrefslogtreecommitdiffstats
path: root/.local/bin/toggle-tablet
diff options
context:
space:
mode:
authorAmin Bandali <bandali@gnu.org>2019-04-12 23:39:24 -0400
committerAmin Bandali <bandali@gnu.org>2019-04-13 00:40:17 -0400
commita92a01fe479e3b069e23297cb3b541eb273deb58 (patch)
tree092762963a81ac538b16deda8e2e1c7ea3fc1e2b /.local/bin/toggle-tablet
parentec80f07afe6f0985de1aff4d321292c93b3cb4ef (diff)
downloadconfigs-a92a01fe479e3b069e23297cb3b541eb273deb58.tar.gz
configs-a92a01fe479e3b069e23297cb3b541eb273deb58.tar.xz
configs-a92a01fe479e3b069e23297cb3b541eb273deb58.zip
scripts: pull current scripts out of rc.org & clean up
battery-percentage-time: pull out of rc.org scripts my-i3status: pull out of rc.org rofi-light: pull out of rc.org rofi-remmina: pull out of rc.org s: pull out of rc.org sway-ws-util: pull out of rc.org toggle-presentation-mode: pull out of rc.org toggle-tablet: pull out of rc.org volume-info: pull out of rc.org zathura-sync: pull out of rc.org remove Scripts
Diffstat (limited to '.local/bin/toggle-tablet')
-rwxr-xr-x.local/bin/toggle-tablet32
1 files changed, 32 insertions, 0 deletions
diff --git a/.local/bin/toggle-tablet b/.local/bin/toggle-tablet
new file mode 100755
index 0000000..819af42
--- /dev/null
+++ b/.local/bin/toggle-tablet
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# This script toggles between a 'normal' mode and a 'tablet' mode, doing
+# a few things:
+
+# - rotates the screen using =xrandr=, so that rotating the physical
+# display of my X220t would have the laptop's battery on the right
+# hand side,
+# - enables touch screen,
+# - properly rotates the stylus pen and touch screen pointers, and
+# - toggles between RGB and Vertical BGR sub-pixel order.
+
+case $(xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation) in
+ 0) # Screen is not rotated, we should rotate it right (90°)
+ xrandr -o 3
+ xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 1
+ xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 1
+ xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 1
+ xfconf-query -c xsettings -p /Xft/RGBA -s vbgr
+ ;;
+ 1) # Currently top is rotated right, we should set it normal (0°)
+ xrandr -o 0
+ xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 0
+ xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 0
+ xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 0
+ xfconf-query -c xsettings -p /Xft/RGBA -s rgb
+ ;;
+ *)
+ echo "Unknown result from 'xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation'" >&2
+ exit 1
+ ;;
+esac