]> git.vanrenterghem.biz Git - www.vanrenterghem.biz.git/blob - Linux/e_changefocus_sh.shtml~
Update van about met rel=me link
[www.vanrenterghem.biz.git] / Linux / e_changefocus_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@chello.be (Frederik Vanrenterghem)">
5    <META NAME="Description" CONTENT="Personal homepage - Pictures">
6    <TITLE>frederik.gotdns.org:1976 - e_changefocus.sh</TITLE>
7 </HEAD>
8 <BODY>
9 <!--#include virtual='/header.shtml' -->
10 <H1>e_changefocus.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 <B>Script: </B>
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>
51 Syntax highlighted by <a href="http://www.palfrader.org/code2html">Code2HTML</a>, v. 0.9.1
52 </P>
53 <!--#include virtual='/footer.shtml' -->
54 </HTML>
55 </BODY>