You are not logged in.

#1 2009-09-19 17:25:37

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

very very simple script

hi to all !

i want do write a little script that launch a program only if it isn't already opened instead if there is already an istance opened close , kill it

i need help

PS: i'm trying to make the script so when i click on clock in pypanel it show me a calendar ....

thanks very much


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#2 2009-09-19 17:46:57

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: very very simple script

killall calendar || setsid calendar &

Offline

#3 2009-09-19 18:26:22

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: very very simple script

Procyon wrote:

killall calendar || setsid calendar &

thanks very much
i've put it directly in pypanel !!!!

OT: only one thing i don't understand..... from when i click to when orage is displayed there is 1 second

what is the problem ???


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#4 2009-09-19 18:36:13

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: very very simple script

Maybe it doesn't like setsid and &, try without. It shouldn't make a difference though, when I use either in xbindkeys it works immediately.

Offline

#5 2009-09-19 19:02:58

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: very very simple script

You should also try to find out what it does with strace. Just run it as
strace -tt -o strace.txt pypanel
wait a minute and remember the time
press the button
maybe wait another minute (there is a lot of noise at program start and end)
quit
look at the strace log and see if you can find the time you pressed the button and why it paused.

Offline

Board footer

Powered by FluxBB