Ubuntu 16.04: restore screen refresh rate after suspend/resume - Ask Ubuntu
even after googling, cannot find answer maybe easy question. 1 of computers connected home main tv dp/hdmi cable. works fine. screen resolution detected right way, 1920x1080, if refresh rate set 50hz (50 hz interlaced). can run xrandr -r 60
, display nice 1920x1080@60hz desktop. (60 hz progressive).
however, when stop using computer while, automatically goes sleep and, when wake up, resolution set bad 50 hz interlaced refresh rate.
i added 15_screen-resume script in /etc/pm/sleep.d follow :
#!/bin/sh case "$1" in resume) xrandr -r 60 date > /tmp/resume.txt ;; esac
i can check if script ran date > /tmp/resume.txt
command. know works if run pm-suspend
shell, wait computer sleep , wake up. script not called if computer enters sleep mode on own after period of inactivity.
question is: how call custom script @ wake after computer running ubuntu 16.04 entered sleep mode after period of inactivity?
thanks help.
it can confusing many different ways can put computer sleep acpi, gnome's gsettings, pm-utils, power management (or that) , systemd.
in case need create script in /lib/systemd/system-sleep
looks this:
#!/bin/sh case $1/$2 in pre/*) echo "going $2..." # place pre suspend commands here, or `exit 0` if no pre suspend action required exit 0 ;; post/*) echo "waking $2..." # place post suspend (resume) commands here, or `exit 0` if no post suspend action required sleep 2 xrandr -r 60 date > /tmp/resume.txt ;; esac
to ensure script created right permissions, copy , existing script , edit it:
cd /lib/systemd/system-sleep sudo cp wpasupplicant tv_refresh gksu gedit tv_refresh
the sleep 2
pause may unnecessary setup necessary restoring sound laptop hdmi tv.
the echo
lines optional handy because show in /var/log/syslog
.
Comments
Post a Comment