简体   繁体   English

使用程序员dvorak键盘布局切换xmonad中的工作区(移位数字)

[英]Switching workspaces in xmonad using programmer dvorak keyboard layout (shifted numbers)

Well, I am not using Dvorak actually but Neo2 , but as I am using a matrix type keyboard ( Truly Ergonomic ) I have also shifted the numbers. 好吧,我实际上并没有使用Dvorak而是使用Neo2 ,但是当我使用矩阵型键盘( Truly Ergonomic )时, 我也改变了数字。

Therefore this construction in my xmonad.hs does not work ergonomically: 因此,我的xmonad.hs中的这种构造不符合人体工程学:

-- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N
--
[((m .|. modMask, k), windows $ f i)
    | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
    , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]

I want to change that, to be able to access the workspaces 1 to 9 with the keys 2 to 0. 我想改变这一点,以便能够使用键2到0访问工作区1到9。

How could I achive that? 我怎么能这样做? I have tried to change the third line to 我试图改变第三行

    | (i, k) <- zip (XMonad.workspaces conf) [xK_2 .. xK_0]

but then I could not access the 9th workspace. 但后来我无法访问第9个工作区。 How do I have to change this? 我该如何改变这个? A short explanition would be nice, so to learn something about this construction (I learned Haskell many years ago and forgot most of it). 一个简短的解释会很好,所以要了解一下这个结构(我多年前学过Haskell而忘记了大部分内容)。

Your problem is that xK_2 is bigger than xK_0 , so the list [xK_2 .. xK_0] is empty: 您的问题是xK_2大于xK_0 ,因此列表[xK_2 .. xK_0]为空:

Prelude XMonad> xK_2
50
Prelude XMonad> xK_0
48
Prelude XMonad> [xK_2 .. xK_0]
[]

You'll want to use a bit longer list than that. 你会想要使用比这更长的列表。 There's at least two reasonable ways to do this; 至少有两种合理的方法可以做到这一点; one is to just specify all of keys yourself manually: 一种是自己手动指定所有键:

Prelude XMonad> [xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0]
[50,51,52,53,54,55,56,57,48]

What I would probably use is a bit shorter: 我可能会使用的更短一点:

Prelude XMonad> [xK_2 .. xK_9] ++ [xK_0]
[50,51,52,53,54,55,56,57,48]

Remember to add some parentheses if it's part of a bigger expression. 如果它是更大表达式的一部分,请记住添加一些括号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM