My notebook is a convertible and also has a stylus as input. When using the pen, I like to use the laptop screen in portrait format instead of landscape. Then the screen format is more similar to A4 paper, which helps a lot if you're taking hand-written notes on PDFs. Here's how to easily change the screen orientation via script.
xrandr
is a linux command line tool for managing screen output (e.g. size, orientation).
Set the screen direction with xrandr --orientation <normal, inverted, left or right>
e.g.
xrandr --orientation left`
Short notation is -o
:
xrandr -o left
Here's a small bash script to toggle the screen orientation between normal
and left
.
Note
eDP-1
in the script is the identifier of my notebook screen and you probably have to replace that with you own screen's identifier (you can get that e.g. withxrandr --listmonitors
)
#!/bin/bash
orientation=`xrandr --query --verbose | grep eDP-1 | awk '{ print $6; }'`
if [ $orientation = 'normal' ]; then
`xrandr --orientation left`
else
`xrandr --orientation normal`
fi
You may add a keyboard shortcut that runs the script. Super
+R
(like "rotate") works well for me.
If you're using a touchpad, rotating the screen will not rotate the input from the touchpad, which makes it hard to use.
Here's a variant of the script which also configures the touchpad via xinput
to match the rotation of the screen.
Note
You will have to replace the device name with your device's name which you can find out with
xinput list
.
#!/bin/bash
orientation=`xrandr --query --verbose | grep eDP-1 | awk '{ print $6; }'`
if [ $orientation = 'normal' ]; then
`xrandr --orientation left`
`xinput set-prop "MSFT0001:00 06CB:CD3E Touchpad" --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1`
else
`xrandr --orientation normal`
`xinput set-prop "MSFT0001:00 06CB:CD3E Touchpad" --type=float "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1`
fi