How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

phanisvara das listmail at phanisvara.com
Sat Mar 5 13:51:39 GMT 2011


On Sat, 05 Mar 2011 20:13:37 +0530, Alex Schuster <wonko at wonkology.org> wrote:

> Dotan Cohen writes:
>
>> I have two separate cases where seniors using KDE like to open many
>> instances of the same application rather than use the already-open
>> application. This is a user problem, not a KDE problem, but I wonder
>> if there is  technical solution.
>
> Switching to Gnome, maybe? I think there the default behaviour is to not
> allow multiple instances of the same application.

doesn't this depend on the application, not the DE? in many cases app.s can be configured via 'settings' or conf. files, what they'll do when they are called while an instance is running already (konqueror, per ex.). in some cases you can add a command line argument to force a certain behavior, like re-use of an existing instance (firefox).

with skype i couldn't figure out how to make it re-use it's existing instance, unfortunately.

>> These users click the application's menu item to start using the
>> application, even if there is already an open instance in the Taskbar
>> or in the System Tray. Examples include Firefox, Skype, Solitaire
>> (Windows executable running in Wine), and some others. Therefore, I'd
>> like to write a wrapper script for each of these apps to check if
>> there exists a running instance. If not, then open the application. If
>> yes, then bring the running application to the foreground.
>>
>> Can this be done? I could probably grep "ps aux" for the application
>> and to get it's pid, but how to bring it to the foreground? Thanks!
>
> You could use xlsclients -al to get the list of running applications and
> their window IDs, and then xdotool windowactivate <windowid> to bring it
> to the foreground.

gave this a short try, but didn't get anything useful. didn't try very much though; quite possibly this may work if one really tries...

--
phani.
___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list