Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Desktop
User Name
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.


  Search this Thread
Old 09-29-2008, 09:37 AM   #1
LQ Newbie
Registered: Sep 2008
Location: Germany
Posts: 8

Rep: Reputation: 0
How to steal focus?

First, I'm well aware that focus stealing (i.e. program moves itself to the top) is generally frowned upon. In my case however, focus stealing is perfectly legitimate: I want my program to get to the top when the user hits a special key. I just couldn't figure out how to do that or what to search for, so can somebody please help me? I'm working on X11/GTK+ (noob skill level though).

Last edited by qforce; 09-29-2008 at 09:38 AM.
Old 10-04-2008, 03:06 PM   #2
Registered: May 2004
Distribution: Gentoo, Debian, OpenBSD, NetBSD
Posts: 157

Rep: Reputation: 16
Sounds like you're making a toolbar or a desktop applet or something of the kind. That's probably something that would best be registered with the window manager you're using.
Old 10-07-2008, 09:43 AM   #3
LQ Newbie
Registered: Sep 2008
Location: Germany
Posts: 8

Original Poster
Rep: Reputation: 0
The program I'm working on is a Java desktop search application (Link). By default, it hides in the system tray, and I want it to show up when the user hits a special key. Now the problem is that in Java there seems to be no way to steal focus from other applications. Therefore I'm wondering if this can be done in C/C++.
Old 10-07-2008, 10:54 AM   #4
Senior Member
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
Couldn't wmctrl do that?

Old 10-07-2008, 11:42 AM   #5
LQ Newbie
Registered: Sep 2008
Location: Germany
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks for the hint, I'll look into it!


focus, spam, spamming

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
Focus on Click or anything else besides Focus on mouse. mellor Linux - Newbie 2 05-29-2008 11:31 AM
LXer: Steal This Wi-Fi LXer Syndicated Linux News 0 01-13-2008 09:41 PM
Can people steal cable internet from me? General Linux - General 6 03-04-2007 05:41 PM
steal focus shortcut LucidParody Linux - General 2 10-26-2005 02:16 PM
Forward X / Steal a process sval Linux - General 0 12-30-2004 10:32 AM

All times are GMT -5. The time now is 02:41 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration