========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://urukrama.wordpress.com/"
linktext was:"Urukrama"
====================================
. All that i have done is altered a few names in the original scripts to make them work with the apps i use. __{{emoticon}}__
For the sake of brevity,
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://urukrama.wordpress.com/2008/05/05/focus-an-application-instead-of-re-launching-it/"
linktext was:"THIS"
====================================
will explain what these scripts do and what "Application Focus" is all about. Once you've read it (it's only a few paragraphs) then you should know what the following scripts are and how to use them.
The original scripts are for Thunar & Terminal (gnome?) but i tend to use XFCE4-Term, RoxTerm, Thunar & PCmanFM, so i've modified the scripts to work with those apps. I've included the script for each app below. All you need to do is save each one to it's own file & call it whatever you like. I have prefixed all of mine with a"1" (ie: 1roxterm.sh - 1thunar.sh etc) and made the script file executable. Then it's just a case of adding the relevant code to the fluxbox menu like so:
Code: Select all
[exec] (1-PCmanFM) {~/.1pcmanfm.sh}
[exec] (1-XFCE4-Term) {~/.1xfce4term.sh}
[exec] (1-Thunar) {~/.1thunar.sh}
[exec] (1-RoxTerm) {~/.1roxterm.sh}
So here are the scripts:
FOR THUNAR:
Code: Select all
#!/bin/sh
thunar_wm_class="thunar"
thunar_exec="thunar"
# no thunar started, so start one
if [ -z"`wmctrl -lx | grep thunar`" ]; then
$thunar_exec &
else
# search for existing thunars on current desktop
current_desk=`wmctrl -d | grep '*' | cut -d ' ' -f 1`
thunar_on_this_desk=`wmctrl -lx | grep"$current_desk[ ]*$thunar_wm_class" | cut -d ' ' -f 1`
if [ -n"$thunar_on_this_desk" ]; then
wmctrl -i -a $thunar_on_this_desk
else
# no thunars on current desktop, so open a new one
wmctrl -x -R $thunar_wm_class
fi;
fi;
Code: Select all
#!/bin/sh
pcmanfm_wm_class="pcmanfm"
pcmanfm_exec="pcmanfm"
# no pcmanfm started, so start one
if [ -z"`wmctrl -lx | grep pcmanfm`" ]; then
$pcmanfm_exec &
else
# search for existing pcmanfm on current desktop
current_desk=`wmctrl -d | grep '*' | cut -d ' ' -f 1`
pcmanfm_on_this_desk=`wmctrl -lx | grep"$current_desk[ ]*$pcmanfm_wm_class" | cut -d ' ' -f 1`
if [ -n"$pcmanfm_on_this_desk" ]; then
wmctrl -i -a $pcmanfm_on_this_desk
else
# no pcmanfm's on current desktop, so open a new one
wmctrl -x -R $pcmanfm_wm_class
fi;
fi;
Code: Select all
#!/bin/sh
terminal_wm_class="roxterm"
terminal_exec="roxterm"
# no terminal started, so start one
if [ -z"`wmctrl -lx | grep roxterm`" ]; then
$terminal_exec &
else
# search for existing terminals on current desktop
current_desk=`wmctrl -d | grep '*' | cut -d ' ' -f 1`
term_on_this_desk=`wmctrl -lx | grep"$current_desk[ ]*$terminal_wm_class" | cut -d ' ' -f 1`
if [ -n"$term_on_this_desk" ]; then
wmctrl -i -a $term_on_this_desk
else
# no terminals on current desktop, so just open a new one
wmctrl -x -R $terminal_wm_class
fi;
fi;
Code: Select all
#!/bin/sh
terminal_wm_class="Terminal"
terminal_exec="xfce4-terminal"
# no terminal started, so start one
if [ -z"`wmctrl -lx | grep terminal`" ]; then
$terminal_exec &
else
# search for existing terminals on current desktop
current_desk=`wmctrl -d | grep '*' | cut -d ' ' -f 1`
term_on_this_desk=`wmctrl -lx | grep"$current_desk[ ]*$terminal_wm_class" | cut -d ' ' -f 1`
if [ -n"$term_on_this_desk" ]; then
wmctrl -i -a $term_on_this_desk
else
# no terminals on current desktop, so just open a new one
wmctrl -x -R $terminal_wm_class
fi;
fi;
Enjoy. __{{emoticon}}__