本文介绍了使用程序员dvorak键盘布局切换xmonad中的工作区(移位的数字)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 好吧,我实际上并没有使用Dvorak,而是 Neo2 ,但由于我使用的是矩阵式键盘(真正符合人体工程学的)我也改变了数字。 因此,我的 xmonad.hs 中的这个构造不符合人体工程学的设计: - mod- [1..9],切换到工作区N - mod-shift- [1..9],将客户端移动到工作区N - [((m。| .modMask,k),windows $ fi) | (w,shift,shiftMask),(f,m) - [(w.gift_view,0),(w,shift,shiftMask) ] 我想改变它,以便能够访问工作区1到9钥匙2到0。 我怎么能达到目的?我已经尝试将第三行改为 | (i,k)←zip(XMonad.workspaces conf)[xK_2 .. xK_0] 但之后我无法访问第9个工作区。我该如何改变这个?一个简短的解释会很好,所以要学习一些关于这个构造的知识(我在很多年前学过Haskell,并且忘记了它的大部分内容)。 解决方案您的问题是 xK_2 大于 xK_0 ,所以列表 [xK_2 .. xK_0] 为空: Prelude XMonad> xK_2 50 Prelude XMonad> xK_0 48 Prelude XMonad> [xK_2 .. xK_0] [] 您需要稍长一些列表比。至少有两种合理的方法可以做到这一点;一个是你自己手动指定所有的键: 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] 我可能会用到的有点短: Prelude XMonad> [xK_2 .. xK_9] ++ [xK_0] [50,51,52,53,54,55,56,57,48] 如果它是更大表达式的一部分,请记住添加一些括号。 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.Therefore this construction in my xmonad.hs does not work ergonomically:-- 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.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. 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). 解决方案 Your problem is that xK_2 is bigger than xK_0, so the list [xK_2 .. xK_0] is empty:Prelude XMonad> xK_250Prelude XMonad> xK_048Prelude 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. 这篇关于使用程序员dvorak键盘布局切换xmonad中的工作区(移位的数字)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-15 01:26