Re: [dev] hotkey (1) - a suckless global keybinder

From: Calvin Morrison <mutantturkey_AT_gmail.com>
Date: Mon, 10 Feb 2014 18:42:00 -0500

On 10 February 2014 18:31, Calvin Morrison <mutantturkey_AT_gmail.com> wrote:
> make a hidden window, and set the window focus to it? that'd be my
> guess. I don't think you can grab two non modifier keys though, < and
>> for example probably wouldn't work with the way I am grabbing it.
> I'd love too see some code.
>
> A visual hint could be nice. I definitely see the advantage of a modal
> system because there are already so many shortcuts you can
> accidentally interfere with,having just one to interfere with reduces
> the issue.
>
> but then why not just use my program to launch a script with dmenu
> (vertical version) and have a keybinding for that? eg:
>
> ALT+P spawns dmenu
> dmenu shows
> 1. mocp -g
> 2. xterm
> 3. firefox
>
> you press 3 and enter and it executes..?
>
> what do you think of that?
>
> On 10 February 2014 18:24, Michael Hauser <awarewater_AT_gmail.com> wrote:
>> Calvin Morrison writes:
>>> I'm not sure what you mean by "modal bindings". Do you mean like
>>> executing a hotkey like "Ctrl+:" to jump the hotkey program, then
>>> pressing another key to execute a command? Sorry I'm not sure what you
>>> are saying.
>>>
>>> Calvin
>>
>> Exactly!
>>
>> Use case: one hotkey (in my case: the useless '><' key on german
>> keyboards) to activate a, let's call it COMMAND mode :), maybe a litte
>> visual hint (I'm making the taskbar visible in dwm for now), that does
>> nothing else than waiting for the next keypress.
>>
>> Have a look at dwm's keymodes patch, I really like this implementation.
>>
>> My hacked 'hotkey' version depends on some X11/event race condition, as
>> I was able to figure out how to grab the whole kb for a while; but I
>> haven't started to dig into the keymodes patch yet; therefore my
>> suggestion to combine the two.
>>
>> Also the goal is to have a system that can be operaten with literally
>> one finger alone, I think it would be a godsent for accessibility (not
>> just when consuming yp *ducks* :).
>>
>>
>> cheers, mih
>>
>>
>> ps. I really like the poetic license!
>>
>> --
>> 'aware water' is an anagram for 'we are at war'
>>

and here it is:

$ cat modal.sh
list="firefox
chromium
xterm
xterm -e mocp"
v=0
`for i in $list; do echo $v" "$i; v=$(($v+1)); done | dmenu -l 5 |
sed 's/^[0-9] //g'`

now it has some kinks, the whole for i in whatever in bash doesn't
work quite properly becaue it works on spaces and newlines... not sure
what to do about that. but i am sure there's a bash way to do it.
Received on Tue Feb 11 2014 - 00:42:00 CET

This archive was generated by hypermail 2.3.0 : Tue Feb 11 2014 - 00:48:05 CET