Ubuntu 18.04 64-bit Desktop with Nvidia dedicated Card GPU.
When I set power saving to blank screen on an external monitor to turn off the monitor for power saving, it gets reset to default 100% brightness once power saving is active.
I'm not familiar with Bash, but I wondered if I could write a Bash script to automatically turn off the monitor without going to active blank screen?
I have installed xprintidle
to detect the idle time.
Here is how I wanted it to run:
If idle time is over 600 seconds (10 minutes) then run this power off monitor command xset dpms force off
I want it to load on startup and keep on running like a service which will turn off the monitor if idle for 10 minutes.
How can I achieve this?
You are on the right track with xprintidle. All you need to do is configure a periodic check inside an infinite loop. If the system is idle, you turn the display off.
I created a service that can do this for the purpose of powering down machines after a period of inactivity, but it can be used to run any shell command after a period of inactivity. You can find the script with documentation on my GitHub page.
I am currently using this to do exactly what you describe on a laptop with an NVIDIA card. I have mine set to time out at 300 seconds (5 minutes) with a check every 10 seconds, so it could potentially remain idle for about 310 seconds before blanking the screen, but the variance of 10 seconds doesn't matter to me.