Toby Cubitt wrote:
> On Fri, Aug 25, 2006 at 10:58:15PM +0200, Toby Cubitt wrote:
>> On Fri, Aug 25, 2006 at 12:22:47PM +0100, Asfand Yar Qazi wrote:
>>> I don't know if it's already been done, but here's a little script
>>> that reads in all key bindings from enlightenment_remote, and
>>> substitutes all uses of ALT with WIN.
>>>
>>> Just thought it might be useful to someone.  If there's a better
>>> solution out there, please tell me!
>> Looks to me like a job for a sed + xargs one-liner(*) to me...
>>
>> (*) left as an exercise for the reader ;-)
> 
> 
> OK, I got curious as to how easy this would be, so here's my attempt:
> (split over multiple lines for clarity(!), but it could all be on
> one...)
> 
> 
> enlightenment_remote -binding-key-list | grep -v '<-' | \
> tr = " " | cut -d" " -f4,6,8,10,12,14 | \
> while read context key mod anymod action params; do \
>   if [[ -n "`echo $mod | grep ALT`" ]]; then \
>     enlightenment_remote -binding-key-del \
>       $context $key $mod $anymod $action $params; \
>     enlightenment_remote -binding-key-add \
>       $context $key `echo $mod | sed 's/ALT/WIN/g'` \
>       $anymod $action $params; \
>   fi; \
> done
> 
> 
Just a short note there need to be quotes around the $mod in both lines 
otherwise the shell will interpret them as pipes. The correct script 
should look like this:
#!/bin/bash

enlightenment_remote -binding-key-list | grep -v '<-' | \
tr = " " | cut -d" " -f4,6,8,10,12,14 | \
while read context key mod anymod action params; do \
   if [[ -n "`echo $mod | grep ALT`" ]]; then \
   enlightenment_remote -binding-key-del \
$context $key "$mod" $anymod $action $params; \
   enlightenment_remote -binding-key-add \
  $context $key "${mod//ALT/WIN}" $anymod $action $params; \
   fi;\
done

Note this one uses bash string replacement, if you use a different shell 
you have to use the sed statement in the script above
Cheers
Jochen



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users

Reply via email to