ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RP] Command to make ratpoison press down-arrow.


From: Martin
Subject: Re: [RP] Command to make ratpoison press down-arrow.
Date: Wed, 9 Sep 2009 07:16:34 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

address@hidden @ 2009-08-27 (Thursday), 12:06 (-0400)
> If I want it to type some text, I've tried messing with putsel and
> getsel, but that doesn't work for special characters like down-arrow
> or esc.
>
>   Any ideas?

If I understand you correctly, the command meta is what you are looking
for. I'm using it in combination with the small shell script posted
below. Please note that this script is only an ugly hack that can only
be seen as inspiration. E.g. it is written for a Swedish keyboard
mapping and will have to be adapted if used with US keyboards where
brackets are on their own keys instead of supershifts of the regular
parenthesis.

#!/bin/zsh
#
# rattype

function do_type()
{
        for ((i = 1; i <= ${#1}; i++)) {
                KEYCODE="${1[$i,$i]}"
                KEYCODEVAL=$[ ##$KEYCODE ]
                [ $KEYCODEVAL -gt 64 -a $KEYCODEVAL -lt 91 ] && 
KEYCODE=S-$KEYCODE
                [ $KEYCODEVAL -eq 32 ] && KEYCODE="space"
                [ $KEYCODEVAL -eq 40 ] && KEYCODE="S-parenleft"
                [ $KEYCODEVAL -eq 41 ] && KEYCODE="S-parenright"
                [ $KEYCODEVAL -eq 44 ] && KEYCODE="comma"
                [ $KEYCODEVAL -eq 46 ] && KEYCODE="period"
                [ $KEYCODEVAL -eq 47 ] && KEYCODE="S-slash"
                [ $KEYCODEVAL -eq 45 ] && KEYCODE="minus"
                [ $KEYCODEVAL -eq 58 ] && KEYCODE="S-colon"

                echo $KEYCODEVAL
                $RATPOISON --command "meta $KEYCODE"
        }
}

[ "$1" = "--command" ] && do_type address@hidden
[ "$1" = "--command" ] || do_type "$@"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]