]> git.vanrenterghem.biz Git - www.vanrenterghem.biz.git/blob - Linux/e_launchOrMoveApp_sh.shtml~
Baseline
[www.vanrenterghem.biz.git] / Linux / e_launchOrMoveApp_sh.shtml~
1 <HTML>
2 <HEAD>
3    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15">
4    <meta name="author" content="Frederik Vanrenterghem">
5    <META NAME="Description" CONTENT="Personal homepage - Script">
6    <TITLE>frederik.gotdns.org:1976 - e_launchOrMoveApp.sh</TITLE>
7 </HEAD>
8 <BODY>
9 <!--#include virtual='/header.shtml' -->
10 <H1>e_launchOrMoveApp.sh</h1>
11 <P>
12 <B>Purpose:</B> This script was written to be bound to the extra keys on my Logitech Cordless Desktop Deluxe wireless keyboard. This way, I can click on f.i. the E-Mail button to either launch my mail program, or transfer the application to the current desktop.<BR>
13 </P>
14 <P>
15 <B>Requirements:</B> <a href="http://www.enlightenment.org/main/pages.html">Enlightenment window manager</A>
16 </P>
17 <P>
18 <table border="1" cellpadding="6" bgcolor="#ffeeee" width=100%><tr><td>
19 <pre>
20 <font color="0000ff"><strong>#!/bin/bash</strong></font>
22 <font color="#444444"># This script gets the current desktop and area</font>
23 <font color="#444444"># and checks if the prog $1 (identifier) is running</font>
24 <font color="#444444"># and moves a running $1 to current desktop/area
25 # or starts $2 (command)</font>
26 <font color="#444444"># e.g. $1 = Evolution and $2 = evolution
27 </font>
28 eesh -ewait <font color="#008000">&quot;goto_desktop ?&quot;</font>| \
29 cut -f2 -d: |\
30 while read desktop; do
31         eesh -ewait <font color="#008000">&quot;goto_area ?&quot;</font>| \
32         cut -f2 -d: |\
33         while read area; do
34                 if eesh -ewait <font color="#008000">&quot;window_list&quot;</font> | grep <font color="#2040a0">$1</font> 
35                 then
36                         eesh -ewait <font color="#008000">&quot;window_list&quot;</font> | \
37                         grep <font color="#2040a0">$1</font>| \
38                         cut -f1 -d: |\
39                         while read win_id; do 
40                                 eesh -e <font color="#008000">&quot;win_op ${win_id} move 80 0&quot;</font>; 
41                                 eesh -e <font color="#008000">&quot;win_op ${win_id} desk ${desktop}&quot;</font>;
42                                 eesh -e <font color="#008000">&quot;win_op ${win_id} area ${area}&quot;</font>;
43                         done 
44                 else 
45                         <font color="#2040a0">$2</font> &amp;
46                 fi
47         done
48 done
49 </pre>
50 </td></tr></table>
51 </P>
52 and in keybindings.cfg: 
53 <table border="1" cellpadding="6" bgcolor="#ffeeee" width=100%><tr><td>
54 <pre>
56 __NEXT_ACTION
57     __KEY logitech_mail
58     __EVENT __KEY_PRESS
59     __ACTION __A_EXEC /scripts/e_launchOrMoveApp.sh Evolution evolution
60 </pre>
61 </td></tr></table>
62 </P>
63 <!--#include virtual='/footer.shtml' -->
64 </HTML>
65 </BODY>