PDA

View Full Version : shell command to set focus to a window



hakermania
November 6th, 2010, 01:29 AM
I know about xwit, but i need something pre-installed. Is there any available?

hakermania
November 6th, 2010, 01:55 AM
xmctrl does this as well with the option -a <application name>
But as I mentioned before, I need something pre-installed, so to have fewer dependencies.

hakermania
November 6th, 2010, 08:15 PM
*bump*

hakermania
November 7th, 2010, 10:44 PM
*bump** ???

Simian Man
November 7th, 2010, 10:51 PM
No way that I know of.

hakermania
November 8th, 2010, 12:20 AM
Very helpful, thx, should I mark the thread now as solved? --_--

nvteighen
November 8th, 2010, 08:39 AM
If you're coding in a language like C, C++, Python, etc., please use the GTK+ API (This is the C signature): gtk_window_set_focus(GtkWindow *, GtkWidget *)

If you're writing a shell script, I think the only chance you have is to install any of those you mentioned. Shell scripting can't access GTK+ directly so you'll need to install a program to do it.

Simian Man
November 8th, 2010, 03:52 PM
If you're coding in a language like C, C++, Python, etc., please use the GTK+ API (This is the C signature): gtk_window_set_focus(GtkWindow *, GtkWidget *)

Also keep in mind that will only work for windows created by GTK+.

nvteighen
November 8th, 2010, 10:13 PM
Also keep in mind that will only work for windows created by GTK+.

Ugh... somehow I thought this was GTK+-specific :P

Well, if it's Qt, use whatever Qt offers to do this. The general criterion is: if there's an API, use it :)

hakermania
November 11th, 2010, 05:52 PM
It is a Qt app actually but I haven't found something specific about setFocus()... I am probably searching in wrong section :/