WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to close X after application exits?  (Read 2315 times)

Offline Medox

  • Newbie
  • *
  • Posts: 36
How to close X after application exits?
« on: July 15, 2009, 04:02:40 PM »
I have a script that starts Xvesa and right after it starts another application that needs X... but when I close that application, X remains loaded. I want to close it right after.

 :-\
“Your body's just a vehicle, transporting the soul.
It's what's inside of people, is beauty to behold.” - Damian Marley

Offline robc

  • Sr. Member
  • ****
  • Posts: 447
Re: How to close X after application exits?
« Reply #1 on: July 15, 2009, 05:27:11 PM »
something like this may work with the .xsession file (this is untested):
Code: [Select]
Xvesa -br -mouse /dev/psaux,5 -screen 1024x768x32 -shadow -nolisten tcp -I 2>&1 > /dev/null &
waitforX
/your/X/application
sudo killall Xvesa
If you do not background your application in .xsession then when it closes all instances of Xvesa will be killed.

Or a script like this that is called by crond (limited to every 1 minute):
Code: [Select]
#!/bin/sh
if [ -z `pidof /your/X/application` ]; then
  sudo killall Xvesa;
fi
"Never give up! Never surrender!" - Commander Peter Quincy Taggart

"Make it so." - Captain Picard

Offline mikshaw

  • Sr. Member
  • ****
  • Posts: 368
Re: How to close X after application exits?
« Reply #2 on: July 15, 2009, 06:53:16 PM »
I think the method of running X in TC is maybe necessarily more complicated for this particular type of use because it means making things much simpler and lighter for the typical use.  In other distros I've accomplished what you want to do simply by switching the window manager with the desired application...after the app is closed X is closed.  With TC you must explicitly close X because it uses a very basic startx script that doesn't call xinit like the fatter distros do.

Offline Medox

  • Newbie
  • *
  • Posts: 36
Re: How to close X after application exits?
« Reply #3 on: July 16, 2009, 06:29:37 AM »
something like this may work with the .xsession file (this is untested):
Code: [Select]
Xvesa -br -mouse /dev/psaux,5 -screen 1024x768x32 -shadow -nolisten tcp -I 2>&1 > /dev/null &
waitforX
/your/X/application
sudo killall Xvesa

Thanks! This is exactly what I was searching for.

Btw, is there a difference between -screen ....... and -mode 0x...... ?
“Your body's just a vehicle, transporting the soul.
It's what's inside of people, is beauty to behold.” - Damian Marley

Offline Medox

  • Newbie
  • *
  • Posts: 36
Re: How to close X after application exits?
« Reply #4 on: July 26, 2009, 02:00:03 PM »
new problem... after i kill x, the menu that shows up isn't correctly positioned.
i mean, i've added a simple menu that should appear after exiting x but the first two or three lines (on top) dissapear.

"clear" nor "reset", placed in the menu or xsession (before the menu) position the upcoming menu correct  :(
i've even tried this: http://aplawrence.com/Bofcusm/542.html, but nothing... or i don't know the equivalent for TC (?)

this happens on two of my 3 pc's... those two aren't really the quickest but shouldn't get such problems (AMD 1800+ and a Pentium 3 with 500mhz)... on my dual core laptop everything works fine...

 :-\
“Your body's just a vehicle, transporting the soul.
It's what's inside of people, is beauty to behold.” - Damian Marley