Review your favorite Linux distribution.
Go Back > Blogs > linux-related notes
User Name


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Rate this Entry

Single, "teleporting" instance of system monitor (or something else)

Posted 03-30-2011 at 02:20 AM by the dsc
Updated 03-30-2011 at 02:26 AM by the dsc (minor correction)

[ -z $(ps -A | grep ksysguard) ] && ksysguard & disown &&
wmctrl -iR $(wmctrl -l | grep "System Monitor" | sed 's/\ .*//')
Depend on wmctrl.

Are you tired of winding up with multiple instances of a program of which you don't really need multiple instances? Your problems are over! Now you can just press the hot-keys or whatever shortcuts you have, without ever worrying about earlier instances. No more sore joints for having to close THOUSANDS of instances that hog all your RAM! No more cluttered desktops filled with multiple instances of programs of which you don't really need so many instances!

With a script like this set as an alias or just being the target of a hotkey/shortcut, these are all things of the past!

You got to use wmctrl -l in order to check what could be a constant on the window name of a program (in this case, "System Monitor"), as it can only rarely rely on PIDs, using some obscure internal reference instead, which is "grepped" with grep and sed.

WARNING: may cause some wmctrl error messages on .xsession-errors each time it runs the program "for the first time" (as opposed to bringing the extant instance to the current desktop).
Posted in Uncategorized
Views 777 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 03:24 PM.

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