LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 07-24-2010, 09:10 AM   #1
cabman46
Member
 
Registered: Mar 2010
Posts: 42

Rep: Reputation: 15
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.
 
Old 07-24-2010, 09:52 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,895

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Hi,

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

Regards
 
Old 07-24-2010, 10:20 AM   #3
cabman46
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
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??
 
Old 07-24-2010, 10:36 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,895

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
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.
 
Old 07-24-2010, 11:01 AM   #5
cabman46
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bathory View Post
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.
 
Old 07-24-2010, 11:18 AM   #6
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,895

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

Cheers
 
Old 07-24-2010, 11:23 AM   #7
cabman46
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
I got an error after restart. Error launching /USR/share/applications/kde4/desktop. Klauncher is not running or it failed to start the application.
 
Old 07-24-2010, 11:28 AM   #8
cabman46
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
I'm not sure what you mean by log in to X? I just restarted Kubuntu. Doesn't that also restart X?
 
Old 07-24-2010, 11:35 AM   #9
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,895

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
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
 
Old 07-24-2010, 05:15 PM   #10
cabman46
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
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?
 
Old 07-24-2010, 05:25 PM   #11
cabman46
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
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?
 
Old 07-24-2010, 05:47 PM   #12
cabman46
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
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?
 
Old 07-24-2010, 06:38 PM   #13
cabman46
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
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.
 
Old 07-25-2010, 03:26 AM   #14
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,895

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
KDE 4 Autostart Program Bash Script to Write Autostart Bash Scripts for You! jdmcdaniel3 Suse/Novell 1 05-03-2010 06:17 AM
xset dpms force on lowers my backlight redjokerx Linux - Laptop and Netbook 1 11-13-2007 10:55 PM
xset dpms force off does'nt turn off screen anirudh.iitm Linux - General 3 02-24-2007 01:54 PM
xset -dpms and xset s off ericcarlson Fedora 1 10-01-2004 07:45 AM
Slackware 8.1 and xset dpms problem. tchang Slackware 0 04-28-2003 10:53 AM


All times are GMT -5. The time now is 07:17 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration