View difference between Paste ID: f24486729 and
SHOW: | | - or go back to the newest paste.
1-
1+
#!/bin/sh
2
3
thunar_wm_class="thunar"
4
thunar_exec="thunar"
5
6
# no thunar started, so start one
7
if [ -z "`wmctrl -lx | grep thunar`" ]; then
8
    $thunar_exec &
9
else
10
    # search for existing thunars on current desktop
11
    current_desk=`wmctrl -d | grep '*' | cut -d ' ' -f 1`
12
    thunar_on_this_desk=`wmctrl -lx | grep "$current_desk[ ]*$thunar_wm_class" | cut -d ' ' -f 1`
13
    if [ -n "$thunar_on_this_desk" ]; then
14
        wmctrl -i -a $thunar_on_this_desk
15
    else
16
        # no thunars on current desktop, so open a new one
17
        wmctrl -x -R $thunar_wm_class
18
    fi;
19
fi;