LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Need script to autostart xset -dpms Kubuntu 10.04 (https://www.linuxquestions.org/questions/ubuntu-63/need-script-to-autostart-xset-dpms-kubuntu-10-04-a-821882/)

cabman46 07-24-2010 09:10 AM

Need script to autostart xset -dpms Kubuntu 10.04
 
I installed Kubuntu 10.04 on my PC to try it out. I noticed the monitor shuts off (sleep?)after 10 minutes of inactivity. I have tried changing the gui setting for the monitor but no matter what I set them to it still goes to sleep after 10 minutes. I did find that xset -dpms will keep the monitor active throught the entire session. However, after a restart it will go back to sleep after 10 minutes. Could someone explain to me how to create a script to autostart xset. Please be specific. I had Ubuntu 10.04 in this PC just before installing Kubuntu and didn't have this problem? Many thanks.

bathory 07-24-2010 09:52 AM

Hi,

You can go to: System->Preferences->Sessions->Startup Programs, use "Add" and add "xset -dpms"

Regards

cabman46 07-24-2010 10:20 AM

Quote:

Originally Posted by bathory (Post 4043964)
Hi,

You can go to: System->Preferences->Sessions->Startup Programs, use "Add" and add "xset -dpms"

Regards

This looks like Ubuntu? I can't find these in Kubuntu??

bathory 07-24-2010 10:36 AM

Oups, sorry about that.
For KDE, go to ~/.kde/Autostart directory and create a script (give it a name like xset.sh) with the command(s) you want to run:
Code:

#!/bin/sh
xset -dpms

Make it executable:
Code:

chmod +x ~/.kde/Autostart/xset.sh
and restart X.

cabman46 07-24-2010 11:01 AM

Quote:

Originally Posted by bathory (Post 4043983)
Oups, sorry about that.
For KDE, go to ~/.kde/Autostart directory and create a script (give it a name like xset.sh) with the command(s) you want to run:
Code:

#!/bin/sh
xset -dpms

Make it executable:
Code:

chmod +x ~/.kde/Autostart/xset.sh
and restart X.

Thanks, I created a text file called xset.sh. It contains your xset instruction and chmod instructions correct? I put xset.sh in the .kde Autostart folder. I didn't tell .kde where this file is? Does it matter? It's in my home folder.

bathory 07-24-2010 11:18 AM

Sure, it's ok in your homedir.
Now when you login into X, dpms will be disabled

Cheers

cabman46 07-24-2010 11:23 AM

I got an error after restart. Error launching /USR/share/applications/kde4/desktop. Klauncher is not running or it failed to start the application.

cabman46 07-24-2010 11:28 AM

I'm not sure what you mean by log in to X? I just restarted Kubuntu. Doesn't that also restart X?

bathory 07-24-2010 11:35 AM

Quote:

I'm not sure what you mean by log in to X? I just restarted Kubuntu. Doesn't that also restart X?
Yes, it's the same, depends on the runlevel you use.
Anyway are you sure you've done everything correct?
You can go to: System Settings-> Click the Advanced tab and Autostart and check if everything is as it should be

cabman46 07-24-2010 05:15 PM

From system,advanced, autostart. The xset.sh text file is there. Status says enabled and run at startup. This is the actual contents of xset.sh:
Code:

#!/bin/sh
xset -dpms
chmod +x ~/.kde/Autostart/xset.sh

I hope I did this ok?
Is there a way to see if the code is being executed step by step?

cabman46 07-24-2010 05:25 PM

I just noticed something. In that autostart folder when I double click on xset.sh a small window pops up and has 3 tabs. General, Permissions, and Preview. The Permissions tab shows Owner can read and write but the "is executable" box is not checked. Should it be?

cabman46 07-24-2010 05:47 PM

I tried to execute this code from the terminal and got this:
Code:

jim@learn:~$ xset -dpms
jim@learn:~$ chmod +x ~/.kde/Autostart/xset.sh
chmod: cannot access `/home/jim/.kde/Autostart/xset.sh': No such file or directory
jim@learn:~$

I doubt if this doesn't work that autostart wont either?

cabman46 07-24-2010 06:38 PM

I'm not positive yet but I think this is solved. Here's what I did after running in the terminal. I removed xset.sh from the .kde/autostart folder. I had originally added the script (xset.sh) via System settings,advanced, Autostart. This time I used Dolphin to add the file. I rebooted and waited for 15 minutes and the screen is still active. I think I understand that -dpms disables the monitor sleep mode and keeps the monitor active all the time? Is it safe to assume that any settings in the display setting gui from now on wont be used?

Thank you bathory for your help. I really appreciate it. This is a learning system for me and this is just one step. Hopefully I can wean myself from Windows eventually. This is my ultimate goal.

bathory 07-25-2010 03:26 AM

Glad to see you've made it.
Just to clarify some things:

1. The script code is
Code:

#!/bin/sh
xset -dpms

2. The same user that created the script in his homedir should run
Code:

chmod +x ~/.kde/Autostart/xset.sh
to make it executable.

3. To test the script, you can run:
Code:

~/.kde/Autostart/xset.sh
Regards


All times are GMT -5. The time now is 10:47 AM.