I have checked other posts about randomly rotating screens, and screens that rotate after sleep. I have tried the following to no avail:
Lock screen rotation:
Problem persists.
Disable GNOME orientation plugin:
gsettings set org.gnome.settings-daemon.plugins.orientation active falseProblem persists.
Disable/Uninstall
iio-sensor-proxy:sudo systemctl stop iio-sensor-proxy.service sudo systemctl disable iio-sensor-proxy.service sudo apt-get remove iio-sensor-proxyProblem persists.
Every time I close the lid, the laptop wakes up sideways and I have to run:
xrandr -o normalIs there a bug somewhere? Have I missed something?
How can I make xrandr -o normal run every time the laptop wakes from suspend? Maybe a hackish solution, but it might work, right?
1 Answer
I don't know if what you describe is a bug, but you can run xrandr -o normal at wake-up from suspend by doing the following (based on this answer and the comment below it):
Create a shell script named
xrandr_normal.sh(you can use another name if you wish) that runs yourxrandrcommand:nano /path/to/script/xrandr_normal.shPut the following inside:
#!/bin/bash DISPLAY=:0.0 ; export DISPLAY xrandr -o normalGive execution rights to your script:
chmod u+x /path/to/script/xrandr_normal.shCreate a service file that will run your script after suspend (you can use whatever name you wish for the service file):
sudo nano /etc/systemd/system/xrandr_normal.servicePut the following inside:
[Unit] Description=Some description Before=sleep.target StopWhenUnneeded=yes [Service] User=YOUR_USERNAME Type=oneshot RemainAfterExit=yes ExecStop=/path/to/script/xrandr_normal.sh [Install] WantedBy=sleep.targetMake sure to replace
YOUR_USERNAMEin the first line below[Service]with your actual username and put the correct path to your script inExecStop.Enable the service you created:
sudo systemctl enable xrandr_normalStart the service:
sudo systemctl start xrandr_normalAs the author of the answer that this one is based on suggests, you can check for errors if the service does not work after suspend with the following command:
journalctl -u xrandr_normal.service