Xmonad多个子图按键组合 [英] Xmonad multiple submap key combos

查看:94
本文介绍了Xmonad多个子图按键组合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此答案介绍了如何在Xmonad中创建组合键绑定.

This answer describes how to create combo key bindings in Xmonad.

使用additionalKeys,将按键绑定作为列表添加到XConfig配置中:

With additionalKeys I add my key bindings as a list to my XConfig configuration:

...
-- Does NOT work
, ((myModMask, xK_a), submap . M.fromList $
    [ ((0, xK_l),    submap . M.fromList $
        [ ((0, xK_1),  spawn "xbacklight -set 10" ) ])
    ])
-- Does work
, ((myModMask, xK_d), submap . M.fromList $
    [ ((0, xK_l),    submap . M.fromList $
        [ ((0, xK_2),  spawn "xbacklight -set 20" ) ])
    ])
-- Does work
, ((myModMask, xK_a), submap . M.fromList $
    [ ((0, xK_l),    submap . M.fromList $
        [ ((0, xK_5),  spawn "xbacklight -set 50" ) ])
    ])
...

但是似乎只有那些以相同键开头的组合的最后定义有效(这里第一个以"a"开头的组合似乎被最后一个覆盖).

But it seems like only the last defined combination of those starting with the same key works (here the first one starting with an "a" seems to be overridden by the last one).

与链接答案中的示例的不同之处仅在于,组合以modkey + key绑定而不是键开头.

What is different from the example in the linked answer is only that the combinations start with a modkey+key binding instead of just a key.

这里可能是什么问题?

推荐答案

我非常确定您不能拥有具有相同键绑定的键映射列表条目-(myModMask, xK_a).在这种情况下,最后一个条目将覆盖前一个条目.

I'm fairly certain that you can't have keymap list entries with the same keybinding - (myModMask, xK_a). In which case the last entry overrides the previous entry.

不过,您可以将两个条目组合在一起:

You can combine the two entries however:

 ((myModMask, xK_a), submap . M.fromList $
    [ ((0, xK_l),    submap . M.fromList $
         [
             ((0, xK_1),  spawn "xbacklight -set 10" )
           , ((0, xK_5),  spawn "xbacklight -set 50" )
         ]
      )
    ]
 )

这篇关于Xmonad多个子图按键组合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆