[kde] Re: How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

2011-03-06 Thread kde
On Saturday 05 March 2011 17:57:10 Duncan wrote:
 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.
 
If this is a general problem built into 4. KDE I will be going else where. 

I often have several spread sheets, pdf's and all sorts of things open in the 
way you describe ie. several instances.  Under 3.xxx any number of instances 
of kde programs are fine.  ( ;-) Other than mail for slightly understandable 
reasons )

Some browsers such a firefox are ok but opera will only fire up once.

If KDE has dropped to this sort of level it really is a rather sad because if 
it's a general thing it's a sign of extremely badly conceived software 
organisation. Instances should run entirely independently of each other. Bit 
difficult with mail but not so hard on most other things.

John
___
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.


[kde] Re: How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

2011-03-06 Thread Duncan
kde posted on Sun, 06 Mar 2011 01:31:16 + as excerpted:

 On Saturday 05 March 2011 17:57:10 Duncan wrote:
 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.

 If this is a general problem built into 4. KDE I will be going else
 where.
 
 I often have several spread sheets, pdf's and all sorts of things open
 in the way you describe ie. several instances.  Under 3.xxx any number
 of instances of kde programs are fine.  ( ;-) Other than mail for
 slightly understandable reasons )

 If KDE has dropped to this sort of level it really is a rather sad
 because if it's a general thing it's a sign of extremely badly conceived
 software organisation. Instances should run entirely independently of
 each other. Bit difficult with mail but not so hard on most other
 things.

Don't worry, then.  kde4 still runs fine with multiple instances of apps 
running.  In fact, that's what Dotan C. was asking about, as that's what 
is causing the confusion with his senior users.

But you shouldn't have a problem running more than one instance of an app 
if you want, and you're not the only one that would be going elsewhere, 
were that to become a kde restriction.  Rest assured on that! =:^)

...

Dotan, while writing the above, I thought of another angle, as well.  
Perhaps part of the problem for your seniors is kde's session management.  
If they quit kde with several app instances running and kde restarts them 
when it comes back up, but they don't understand that, they may be 
starting a new instance each time, not thinking that kde might have 
remembered what was running the last time and restarted it, so the 
instances gradually build up...

Of course, you can make kde start with a clean session each time, if you 
wish.  That would cure that issue.

But what about going about it from the other angle?  Have kde start all 
the apps they need, then save that as their session, and hide the 
launcher, so all they have is the taskbar.  You could take the close 
button off the title bar too, making it more difficult to close the apps, 
and if they did, they'd only have to restart kde to have the pre-set 
session come back with all their apps.

It may or may not work in practice, but it's certainly thinking about the 
problem from outside the box.  Reverse the problem and it goes away. =:^)

-- 
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.


[kde] Re: How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

2011-03-06 Thread Charles Polisher
On Sun, Mar 06, 2011 at 03:16:34PM +, Duncan wrote:
 kde posted on Sun, 06 Mar 2011 01:31:16 + as excerpted:
 Perhaps part of the problem for your seniors is kde's session management.  
 If they quit kde with several app instances running and kde restarts them 
 when it comes back up, but they don't understand that, they may be 
 starting a new instance each time, not thinking that kde might have 
 remembered what was running the last time and restarted it, so the 
 instances gradually build up...
 
 Of course, you can make kde start with a clean session each time, if you 
 wish.  That would cure that issue.
 
 But what about going about it from the other angle?  Have kde start all 
 the apps they need, then save that as their session, and hide the 
 launcher, so all they have is the taskbar.  You could take the close 
 button off the title bar too, making it more difficult to close the apps, 
 and if they did, they'd only have to restart kde to have the pre-set 
 session come back with all their apps.
 
 It may or may not work in practice, but it's certainly thinking about the 
 problem from outside the box.  Reverse the problem and it goes away. =:^)

Would this be a workable approach for the OP - wrap the app launch
in a generalized mechanism, let's call the mechanism Larry (as I
abhor the imprecision that comes with it, and have no better name).
Larry handles each attempted application launch for the seniors.
Here's what I envision happening:

Larry looks at the proposed app, and if that app has one or more
running instances, display a dialog, with a suitably large font,
with a clickable list that distinguishes each running instance
of the app. At one end of the list, distinguished visually in
some way from other items in the list, is a nope, none of
these, start a fresh new instance list item. Clicking a list
item or using the arrow keys and the enter-key would switch to
that instance or launch a new instance of the app. 

Larry should have a way to back-out of any action at all - cancel.
And a Help button that has both an icon (I favor a question mark)
and a (largish) text label to go with it.

Larry could be assembled using bash, kdialog, and some tools
such as xmumble and grep, right? (Mumble is a place-holder for
an actual executable name. This isn't a fully worked example).

  #!/bin/bash
  itemlist=`xmumble | grep mumble | sort | ...`
  myitem=$(kdialog --menu Click what you want $itemlist)
  # activate the selection or launch new app
  /usr/bin/mumble myitem ...

-- 
Charles Polisher

___
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.


[kde] Re: How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

2011-03-06 Thread Dotan Cohen
On Sun, Mar 6, 2011 at 17:59, Charles Polisher cpol...@surewest.net wrote:
 Would this be a workable approach for the OP - wrap the app launch
 in a generalized mechanism, let's call the mechanism Larry (as I
 abhor the imprecision that comes with it, and have no better name).
 Larry handles each attempted application launch for the seniors.
 Here's what I envision happening:

 Larry looks at the proposed app, and if that app has one or more
 running instances, display a dialog, with a suitably large font,
 with a clickable list that distinguishes each running instance
 of the app. At one end of the list, distinguished visually in
 some way from other items in the list, is a nope, none of
 these, start a fresh new instance list item. Clicking a list
 item or using the arrow keys and the enter-key would switch to
 that instance or launch a new instance of the app.

 Larry should have a way to back-out of any action at all - cancel.
 And a Help button that has both an icon (I favor a question mark)
 and a (largish) text label to go with it.

 Larry could be assembled using bash, kdialog, and some tools
 such as xmumble and grep, right? (Mumble is a place-holder for
 an actual executable name. This isn't a fully worked example).

  #!/bin/bash
  itemlist=`xmumble | grep mumble | sort | ...`
  myitem=$(kdialog --menu Click what you want $itemlist)
  # activate the selection or launch new app
  /usr/bin/mumble myitem ...


Charles, the only problem is brining the active window to the
foreground. xdotool will bring to the foreground a window from the
taskbar, but won't open a Skype window if Skype is running in the
system tray.

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
___
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.

[kde] Re: How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

2011-03-06 Thread Alex Schuster
Dotan Cohen writes:

 That's actually not a bad idea! I already run a fix-kde script when
 they log into to reset the damage that they've done to the panel the
 last time:
 
 #!/bin/bash
 kbuildsycoca4
 kquitapp plasma-desktop
 cp $HOME/.bin/kde-fix/plasma-desktoprc 
 $HOME/.kde/share/config/plasma-desktoprc
 cp $HOME/.bin/kde-fix/plasma-desktop-appletsrc
 $HOME/.kde/share/config/plasma-desktop-appletsrc
 kstart plasma-desktop

Nice, I will use that, too. Until now I copied the files manually from
by backup when logged out. Plasma gets corrupted fairly often here, the
plasma stuff appears on the wrong desktops, or plasmoids are missing. I
also make a backup of .kde4 before I dare to save the session, because
this also often corrupts the session.

Wonko
___
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.


[kde] Re: How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

2011-03-06 Thread Alex Schuster
Dotan Cohen writes:

 That's actually not a bad idea! I already run a fix-kde script when
 they log into to reset the damage that they've done to the panel the
 last time:
 
 #!/bin/bash
 kbuildsycoca4
 kquitapp plasma-desktop
 cp $HOME/.bin/kde-fix/plasma-desktoprc 
 $HOME/.kde/share/config/plasma-desktoprc
 cp $HOME/.bin/kde-fix/plasma-desktop-appletsrc
 $HOME/.kde/share/config/plasma-desktop-appletsrc
 kstart plasma-desktop

Nice, I will use that, too. Until now I copied the files manually from
by backup when logged out. Plasma gets corrupted fairly often here, the
plasma stuff appears on the wrong desktops, or plasmoids are missing. I
also make a backup of .kde4 before I dare to save the session, because
this also often corrupts the session.

Wonko
___
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.


[kde] Re: How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

2011-03-06 Thread Steven Sroka
On 5 March 2011 20:31,  kde@mail.kde.org wrote:
 On Saturday 05 March 2011 17:57:10 Duncan wrote:
 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.
 
 If this is a general problem built into 4. KDE I will be going else where.

 I often have several spread sheets, pdf's and all sorts of things open in the
 way you describe ie. several instances.  Under 3.xxx any number of instances
 of kde programs are fine.  ( ;-) Other than mail for slightly understandable
 reasons )

 Some browsers such a firefox are ok but opera will only fire up once.

Just as an aside, this is an Opera thing. Opera never likes opening
multiple windows of itself.
I just tried opening a new instance of Opera now, but it only opened a new tab.


 If KDE has dropped to this sort of level it really is a rather sad because if
 it's a general thing it's a sign of extremely badly conceived software
 organisation. Instances should run entirely independently of each other. Bit
 difficult with mail but not so hard on most other things.

 John
 ___
 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.

___
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.


[kde] Re: How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

2011-03-06 Thread phanisvara das
On Mon, 07 Mar 2011 01:30:51 +0530, Steven Sroka sroka.ste...@gmail.com wrote:

 Just as an aside, this is an Opera thing. Opera never likes opening
 multiple windows of itself.
 I just tried opening a new instance of Opera now, but it only opened a new 
 tab.

that's the default behavior which can be changed at 
tools-preferences-advanced-tabs-additional tab options-open windows 
instead of tabs

or if you click ctrl + n in a running opera instance, a new one is created. i 
don't use that much, prefer my tabs in the same window, but didn't see any 
indication that opera never likes this.

-- 
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.


[kde] Re: How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

2011-03-05 Thread Alex Schuster
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.

 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.

Wonko
___
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.


[kde] Re: How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

2011-03-05 Thread phanisvara das
On Sat, 05 Mar 2011 20:13:37 +0530, Alex Schuster wo...@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.


[kde] Re: How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

2011-03-05 Thread Duncan
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.


[kde] Re: How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

2011-03-05 Thread Dotan Cohen
On Sat, Mar 5, 2011 at 16:43, Alex Schuster wo...@wonkology.org wrote:
 Switching to Gnome, maybe? I think there the default behaviour is to not
 allow multiple instances of the same application.


Thanks. I'll look into that. These users are unsavy enough to not care
about their environment.


 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.


Thank you! This is going to be a pain as the windowid is not on the
same line as the application name, but at least now I have the
critical tools that I need. Thank you Alex!


-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
___
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.


[kde] Re: How to set up Menu items such that if an instance is already running, the running instance is brought to the foreground?

2011-03-05 Thread Dotan Cohen
On Sat, Mar 5, 2011 at 15:51, phanisvara das listm...@phanisvara.com wrote:

 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).


Yes, but not all applications support this.


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


That is one of the main offenders. They will have over 10 Skype
instances running!


 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...


I did manage to locate and bring to foreground a Dolphin window with
this. It is doable so long as a window is open, I need to check for
applications such as Skype that may be running as a service.


-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
___
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.