]> 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>vanrenterghem.biz - e_launchOrMoveApp.sh</TITLE>
7 <link rel="stylesheet" href="/styles/header.css" type="text/css" />
8 <link rel="stylesheet" href="/styles/main.css" type="text/css" />  
9 </HEAD>
10 <BODY>
11 <!--#include virtual='/header.shtml' -->
12 <H1>e_launchOrMoveApp.sh</h1>
13 <P>
14 <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 />
15 </P>
16 <P>
17 <B>Requirements:</B> <a href="http://www.enlightenment.org/main/pages.html">Enlightenment window manager</A>
18 </P>
19 <P>
20 <table border="1" cellpadding="6" bgcolor="#ffeeee" width=100%><tr><td>
21 <pre>
22 <font color="0000ff"><strong>#!/bin/bash</strong></font>
24 <font color="#444444"># This script gets the current desktop and area</font>
25 <font color="#444444"># and checks if the prog $1 (identifier) is running</font>
26 <font color="#444444"># and moves a running $1 to current desktop/area
27 # or starts $2 (command)</font>
28 <font color="#444444"># e.g. $1 = Evolution and $2 = evolution
29 </font>
30 eesh -ewait <font color="#008000">&quot;goto_desktop ?&quot;</font>| \
31 cut -f2 -d: |\
32 while read desktop; do
33         eesh -ewait <font color="#008000">&quot;goto_area ?&quot;</font>| \
34         cut -f2 -d: |\
35         while read area; do
36                 if eesh -ewait <font color="#008000">&quot;window_list&quot;</font> | grep <font color="#2040a0">$1</font> 
37                 then
38                         eesh -ewait <font color="#008000">&quot;window_list&quot;</font> | \
39                         grep <font color="#2040a0">$1</font>| \
40                         cut -f1 -d: |\
41                         while read win_id; do 
42                                 eesh -e <font color="#008000">&quot;win_op ${win_id} move 80 0&quot;</font>; 
43                                 eesh -e <font color="#008000">&quot;win_op ${win_id} desk ${desktop}&quot;</font>;
44                                 eesh -e <font color="#008000">&quot;win_op ${win_id} area ${area}&quot;</font>;
45                         done 
46                 else 
47                         <font color="#2040a0">$2</font> &amp;
48                 fi
49         done
50 done
51 </pre>
52 </td></tr></table>
53 </P>
54 and in ~/.enlightenment/keybindings.cfg: 
55 <table border="1" cellpadding="6" bgcolor="#ffeeee" width=100%><tr><td>
56 <pre>
57 __NEXT_ACTION
58     __KEY logitech_mail
59     __EVENT __KEY_PRESS
60     __ACTION __A_EXEC ~/scripts/e_launchOrMoveApp.sh Evolution evolution
61 </pre>
62 </td></tr></table>
63 </P>
64 <!--#include virtual='/footer.shtml' -->
65 </HTML>
66 </BODY>