LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-04-2015, 10:14 AM   #1
zetrotrack000
Member
 
Registered: Dec 2011
Posts: 223

Rep: Reputation: Disabled
Autoload Python Script at Cinnamon Login


Hi
I am using Cinnamon desktop on the top of arch linux. I wanted to load a python script at desktop login which informs me about battery stats, so I created a batterymonitor.desktop entry under ~/.config/autostart. The contents of batterymonitor.desktop are:
Code:
[Desktop Entry]
Type=Application
Exec=python /home/<myusername>/scripts/battery_monitor.py
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=BatteryMonitor
Name=BatteryMonitor
Comment[en_US]=
Comment=
X-GNOME-Autostart-Delay=0
But the problem is that the script is not loading at cinnamon login. I have also confirmed that the script is executable.
Can you help to load this script at cinnamon login?
Regards
 
Old 02-04-2015, 04:15 PM   #2
JeremyBoden
Member
 
Registered: Nov 2011
Posts: 939

Rep: Reputation: 174Reputation: 174
The only autostart user job in ~/.config I have is as follows:-
Code:
[Desktop Entry]
Version=1.0
Type=Application
Name=SpiderOak
GenericName=File Backup and Synchronizer
Comment=Privately sync, backup, and share your data across your computers.
Comment[en_US]=Privately sync, backup, and share your data across your computers.
Icon=SpiderOak
Exec=SpiderOak
Terminal=false
Categories=Network;Archiving;Utility;
This gives an iconised process.
 
Old 02-04-2015, 04:49 PM   #3
zetrotrack000
Member
 
Registered: Dec 2011
Posts: 223

Original Poster
Rep: Reputation: Disabled
I have 2 more, dropbox and pulse audio. I want to create this 3rd one but not able to succeed yet
 
Old 02-04-2015, 08:15 PM   #4
JeremyBoden
Member
 
Registered: Nov 2011
Posts: 939

Rep: Reputation: 174Reputation: 174
Is it listed in Admin, System settings, Start-up Programs?
 
Old 02-05-2015, 05:35 AM   #5
zetrotrack000
Member
 
Registered: Dec 2011
Posts: 223

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by JeremyBoden View Post
Is it listed in Admin, System settings, Start-up Programs?
Yes. Check this screenshot:
http://s12.postimg.org/b2uaennfh/Sta...rences_001.png
I suspect that the problem is with this line:
Code:
Exec=python /home/<myusername>/scripts/battery_monitor.py
I have also tried following variation:
Code:
Exec=python /home/<myusername>/scripts/battery_monitor.py
Exec=/usr/bin/python /home/<myusername>/scripts/battery_monitor.py
Exec=python '/home/<myusername>/scripts/battery_monitor.py'
Exec=python "/home/<myusername>/scripts/battery_monitor.py"
Exec=/home/<myusername>/scripts/battery_monitor.py
But none worked.
 
Old 02-05-2015, 05:37 AM   #6
zetrotrack000
Member
 
Registered: Dec 2011
Posts: 223

Original Poster
Rep: Reputation: Disabled
PS. PowerTop is showing that the process is running, but its not working like it used to do when I launch it from terminal.
 
Old 02-08-2015, 05:33 PM   #7
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: Austin, TX
Distribution: Mint-17.1 with Cinnamon & KDE
Posts: 1,478
Blog Entries: 3

Rep: Reputation: 95
Quote:
Originally Posted by zetrotrack000 View Post
PS. PowerTop is showing that the process is running, but its not working like it used to do when I launch it from terminal.
This is just a guess...

It might be that your python script runs BEFORE there are enough desktop parts active to support it correctly. For example, the desktop is an X-Windows DISPLAY. If your script's shell cannot learn the active DISPLAY or if your script cannot get proper access, the the script will not be able to create and open an on-desktop window.

SUGGESTIONS:

There are ways for your script to wait until needed resources are available.

There are ways to impose a sequence on the various login-time applications.

If all else fails, you could insert a run-time delay (consider adding a WAIT=nn script parameter) to allow for some time passage and those resources to be active.

Good luck,
~~~ 0;-Dan
 
  


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
Ubuntu How to run Python script on Login? warnetgm Linux - General 14 03-13-2012 07:11 PM
[Help] Running an interactive (python) script in tty1 before login Thomaz Linux - Software 1 04-22-2011 06:38 PM
Autoload Xmodmap upon KDM login. unreal128 Linux - Desktop 8 02-18-2007 08:01 PM
python script to automatically login to yahoo pankaj99 Programming 1 09-17-2006 11:15 PM
trying to get lilo to autoload in my rcS script Frustin Linux - General 0 04-04-2003 04:46 AM


All times are GMT -5. The time now is 06:42 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration