Dotan Cohen posted on Sat, 05 Mar 2011 16:07:56 +0200 as excerpted: > 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. > > 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! Try the pgrep (process grep) command for your first bit. =:^) But for window manipulation... as it happens I just needed such a thing and thus have the perfect app for you! wmctrl ! It handles... switching to the appropriate desktop, activating, moving/resizing, maximizing X/Y/ both, closing... more. And since it operates with window titles or windowclasses (you can use kwin's window rules click-to-autodetect feature to find this), you shouldn't even need the pgrep step. =:^) Both the above have manpages... and while the wmctrl manpage suggests zenity, a gnome dialog scripting app, for adding more interactivity (wouldn't be needed for your current use, but...), the kde alternative for that is of course kdialog, which I've used myself. kdialog is a bit quirky (reminds me of the MS Windows 2 era), resulting in several successive single-purpose popup windows instead of the more typical multi- purpose dialog window, but it does get the job done, allowing you to present a UI with which to select or type things in, if that's needed. -- Duncan - List replies preferred. No HTML msgs. "Every nonfree program has a lord, a master -- and if you use the program, he is your master." Richard Stallman ___________________________________________________ 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.