removing all keybindings from .stumpwmrc

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

removing all keybindings from .stumpwmrc

Burton Samograd
Hello,

Is there a way to remove all keybindings from *root-map*?

I want to clear the *root-map* and then define new bindings.

Thanks.

--
Burton Samograd


_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: removing all keybindings from .stumpwmrc

Martin Oppegaard-2
Hi!

>
> Is there a way to remove all keybindings from *root-map*?
>
> I want to clear the *root-map* and then define new bindings.
>

Without a REPL at my hands - you can do something like (mapcar (lambda (x)
(undefine-key *root-map* x)) *root-map*). Or maybe (setf *root-map* nil) is
equivalent.


_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: removing all keybindings from .stumpwmrc

Burton Samograd
"Martin Oppegaard" <[hidden email]> writes:

> (mapcar (lambda
> (x)
> (undefine-key *root-map* x))

I'm trying:

    (setf (kmap-bindings *root-map*) nil)

but that doesn't seem to do anything, and neither does:

    (mapcar (lambda (x) (undefine-key *root-map*)
            (kmap-bindings *root-map*)))

as the contents of the list returned by kmap-bindings is not of the
correct type.

Any other ideas?  If not, I could just cut the bindings out of the
source, but I thought there might have been a less harsh way of doing
it.

--
Burton Samograd


_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: removing all keybindings from .stumpwmrc

Shawn Betts-3
> I wanna clear *root-map*

(setf *root-map* (make-sparse-keymap))
(sync-keys)

Keep in mind that there's also *tile-group-root-map* and
*float-group-root-map* that you prolly want to zero out.

-Shawn

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: removing all keybindings from .stumpwmrc

Josh Elsasser
In reply to this post by Burton Samograd
On Thu, Jan 12, 2012 at 01:34:09PM -0700, Burton Samograd wrote:
> Hello,
>
> Is there a way to remove all keybindings from *root-map*?
>
> I want to clear the *root-map* and then define new bindings.

My .stumpwmrc is mostly confusing and useless crap, but I think it
does something similar to what you want to do:

http://www.elsasser.org/misc/.stumpwmrc

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: removing all keybindings from .stumpwmrc

Burton Samograd
In reply to this post by Martin Oppegaard-2
"Martin Oppegaard" <[hidden email]> writes:

> (mapcar (lambda
> (x)
> (undefine-key *root-map* x))

I'm trying:

    (setf (kmap-bindings *root-map*) nil)

but that doesn't seem to do anything, and neither does:

    (mapcar (lambda (x) (undefine-key *root-map*)
            (kmap-bindings *root-map*)))

as the contents of the list returned by kmap-bindings is not of the
correct type.

Any other ideas?  If not, I could just cut the bindings out of the
source, but I thought there might have been a less harsh way of doing
it.

--
Burton Samograd


_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: removing all keybindings from .stumpwmrc

Burton Samograd
In reply to this post by Josh Elsasser
"Josh Elsasser" <[hidden email]> writes:

> On Thu, Jan 12, 2012 at 01:34:09PM -0700, Burton Samograd wrote:
>> Hello,
>>
>> Is there a way to remove all keybindings from *root-map*?
>>
>> I want to clear the *root-map* and then define new bindings.
>
> My .stumpwmrc is mostly confusing and useless crap, but I think it
> does something similar to what you want to do:
>
> http://www.elsasser.org/misc/.stumpwmrc

From what it looks like from your stumpwmrc, the following *should*
work (from the very top of my .stumpwmrc):

    (setf *root-map* (make-sparse-keymap))
    (sync-keys)

but in my case it does not seem to remove the bindings.  I highly doubt
this, but is *root-map* created and bound after .stumpwmrc is loaded?

I am testing this by hitting Control-Alt-Delete (my prefix) and then r,
which still seems to call resize window.  

Any ideas why this doesn't seem to work for me?

--
Burton Samograd

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: removing all keybindings from .stumpwmrc

Shawn Betts-3
On Fri, Jan 13, 2012 at 9:44 AM, Burton Samograd
<[hidden email]> wrote:

> "Josh Elsasser" <[hidden email]> writes:
>
>> On Thu, Jan 12, 2012 at 01:34:09PM -0700, Burton Samograd wrote:
>>> Hello,
>>>
>>> Is there a way to remove all keybindings from *root-map*?
>>>
>>> I want to clear the *root-map* and then define new bindings.
>>
>> My .stumpwmrc is mostly confusing and useless crap, but I think it
>> does something similar to what you want to do:
>>
>> http://www.elsasser.org/misc/.stumpwmrc
>
> From what it looks like from your stumpwmrc, the following *should*
> work (from the very top of my .stumpwmrc):
>
>    (setf *root-map* (make-sparse-keymap))
>    (sync-keys)
>
> but in my case it does not seem to remove the bindings.  I highly doubt
> this, but is *root-map* created and bound after .stumpwmrc is loaded?

Many root level bindings that you expected to be cleared are stored in
the *tile-group-root-map* and *group-root-map*. Those have to be
cleared too. When you hit the prefix key stumpwm looks up the next
keystroke in *root-map* and if no match is found then it checks
*group-root-map* and if no match is found it looks in
*tile-group-root-map* IF you're in a tiling group. It checks
*float-group-root-map* if you're in a float group. Kind of
complicated.

-Shawn

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: removing all keybindings from .stumpwmrc

Burton Samograd
Shawn Betts <[hidden email]> writes:
> Many root level bindings that you expected to be cleared are stored in
> the *tile-group-root-map* and *group-root-map*. Those have to be
> cleared too. When you hit the prefix key stumpwm looks up the next
> keystroke in *root-map* and if no match is found then it checks
> *group-root-map* and if no match is found it looks in
> *tile-group-root-map* IF you're in a tiling group. It checks
> *float-group-root-map* if you're in a float group. Kind of
> complicated.

Thank you, the below seems to do the trick:

    (defun remove-all-keybindings ()
        (setf *root-map* (make-sparse-keymap))
        (setf *group-root-map* (make-sparse-keymap))
        (setf *tile-group-root-map* (make-sparse-keymap))
        (setf *float-group-root-map* (make-sparse-keymap))
        (sync-keys))

> -Shawn

Thanks Shawn!

--
Burton Samograd


_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel