Skip to content

Instantly share code, notes, and snippets.

@ephemient
Last active March 7, 2018 22:28
Show Gist options
  • Save ephemient/3a481a0d8491553ecbd41368d30feeeb to your computer and use it in GitHub Desktop.
Save ephemient/3a481a0d8491553ecbd41368d30feeeb to your computer and use it in GitHub Desktop.
#!/bin/sh
set -euo pipefail
case ${1:-0} in
0|normal) rot=normal mat=( 1 0 0 0 1 0 0 0 1) ;;
1|left) rot=left mat=( 0 -1 1 1 0 0 0 0 1) ;;
2|flip) rot=inverted mat=(-1 0 1 0 -1 1 0 0 1) ;;
3|right) rot=right mat=( 0 1 0 -1 0 1 0 0 1) ;;
*)
echo "Usage: $(basename "$0") [<0|1|2|3>|<normal|left|flip|right>]" >&2
exit
;;
esac
xrandr --output 'eDP-1' --rotate "${rot}"
xinput --set-prop "$(xinput list --id-only '04F3200A:00 04F3:2513')" 'Coordinate Transformation Matrix' "${mat[@]}"
xinput --set-prop "$(xinput list --id-only '04F3200A:00 04F3:2513 Pen Pen (0)')" 'Coordinate Transformation Matrix' "${mat[@]}"
[Desktop Entry]
Type=Application
Categories=System;
Name=Rotate flip
TryExec=rot
Exec=rot flip
Icon=osd-rotate-flip
StartupNotify=false
[Desktop Entry]
Type=Application
Categories=System;
Name=Rotate left
TryExec=rot
Exec=rot left
Icon=osd-rotate-ccw
StartupNotify=false
[Desktop Entry]
Type=Application
Categories=System;
Name=Rotate normal
TryExec=rot
Exec=rot normal
Icon=osd-rotate-normal
StartupNotify=false
[Desktop Entry]
Type=Application
Categories=System;
Name=Rotate right
TryExec=rot
Exec=rot right
Icon=osd-rotate-cw
StartupNotify=false
#!/bin/sh
xinput --map-to-output "$(xinput list --id-only '04F3200A:00 04F3:2513')" eDP-1
xinput --map-to-output "$(xinput list --id-only '04F3200A:00 04F3:2513 Pen Pen (0)')" eDP-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment