Re: [wmii] rc0: 20060427-rc0-tschernobyl, wmiirc shortcuts patch

From: Alex Elide <elide_AT_bk.ru>
Date: Sat, 29 Apr 2006 22:44:23 +0400

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Apr 29, 2006 at 06:42:39PM +0200, Anselm R. Garbe wrote:
> Nah, that is somewhat over-engineered to my taste as a default ;)
> Though thanks anyway.
- ---end quoted text---

and what do you think about this function?
- --
        unset KEYS ACTIONS
        function bind_key(){
                        KEYS[$((${#KEYS[@]}+1))]="$1"
                        ACTIONS[$((${#ACTIONS[@]}+1))]="$2"
        }
- --

it is very simple to bind keys
- --
        M=$MODKEY
        C=Control
        bind_key $C-Return 'aterm &'
        .....
        bind_key $M-d 'xw /view/sel/mode default'
        bind_key $M-s 'xw /view/sel/mode stack'
        bind_key $M-m 'xw /view/sel/mode max'
- --

then, you can easily define active hotkeys with
- --
        for i in "${KEYS[@]}"; do echo "$i"; done | wmiir write /def/keys
- --

process hotkey events with
- --
        # in event loop
        case "$type" in
                .......
                Key)
                        for i in `seq 0 ${#KEYS[@]}`; do
                                [ "$1" = "${KEYS[$i]}" ] && eval "${ACTIONS[$i]}"
                        done
                ;;
                .......
        esac
- --

I think, this is better, then necessity to maintain two separate list of buttons and actions in two different places in wmiirc.
-----BEGIN PGP SIGNATURE-----

iD8DBQFEU7QHXdMH9oLAFG8RAkwoAKCXVTxwB4m2N3xL3xlTNJhMkMJVeQCgzeR3
x+a9ljbke01lapwInxywPqQ=
=JhlA
-----END PGP SIGNATURE-----
Received on Sat Apr 29 2006 - 20:44:24 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:04:02 UTC