LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-15-2005, 02:57 PM   #1
Spoonman
LQ Newbie
 
Registered: Nov 2005
Posts: 4

Rep: Reputation: 0
Send keys to an X app & diconnect an X session


I have an application that I generally leave running on my machine, and would like it to shutdown gracefully if possible when the machine shuts down. If I'm not there, and the UPS shuts the machine down, it doesn't shutdown gracefully unless I hit Ctrl-Z. Is there a way I can script sending Ctrl-Z (or any keystroke for future reference) to an X-based application? Sorta like Send Keyboard Keys for Windows at vsisoftware dot com (I can't post URLs yet).

Second, is there a way to disconnect from an X session, so I can reconnect from another machine? Similar to Terminal Services for Windows? I've looked at using VNC, but it's far too slow.

Thanks,
-Spoonie
 
Old 12-16-2005, 04:17 AM   #2
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,640

Rep: Reputation: 144Reputation: 144
Quote:
Originally Posted by Spoonman
Is there a way I can script sending Ctrl-Z (or any keystroke for future reference) to an X-based application? Sorta like Send Keyboard Keys for Windows at vsisoftware dot com (I can't post URLs yet).
You can for example use wmctrl to send applications running on X a close signal. (If you read in the manpage check the -c switch). The website: http://sweb.cz/tripie/utils/wmctrl/
Otherwise If I understand your intention right you could look at the kill command and it's options. This doesn't not any keystroke but can shut down an application gracefully or force it to end.
 
Old 12-18-2005, 09:14 AM   #3
Spoonman
LQ Newbie
 
Registered: Nov 2005
Posts: 4

Original Poster
Rep: Reputation: 0
The app is vmware, and I have a virtual machine running on my primary server all the time. What I want to do is send it the ctrl-z before the app closes (and wait an appropriate amount of time) so it puts the server in hibernation rather than just letting it be "switched off". wmctrl won't do the job by itself 'cause it just kills the app. However, at the bottom of that page is an app called "gnee" that might do the job. It can't grab focus, it appears, so I'd use wmctrl to do that first, then send the keystroke. I'm still in the process of rebuilding my server, at which point I'll post a reply so the right answer's here for others (I've been searching for this for some time).

-S
 
  


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
Xfce4 & Fn Keys BittaBrotha *BSD 4 10-04-2006 01:59 PM
CVS & SSH & Public/private keys guideweb Linux - Software 15 09-09-2005 01:06 PM
Fn Keys & Brightness epicadop Linux - Laptop and Netbook 3 11-16-2004 10:23 PM
'Send to tray' app for KDE 3.2? bröggle Linux - Newbie 3 08-18-2004 09:52 PM
What happend to the Session App in FC2? lramos85 Fedora 1 05-24-2004 11:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:14 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
Open Source Consulting | Domain Registration