简体   繁体   English

XMonad 在可见工作区的所有窗口中循环

[英]XMonad cycle through all windows on visible workspaces

I'm using XMonad on a dual screen set up, and would like to be able to cycle focus through every window visible on either screen (say, with alt+tab).我在双屏幕设置上使用 XMonad,并且希望能够在任一屏幕上可见的每个窗口中循环焦点(例如,使用 alt+tab)。 The behavior would be similar to XMonad.Actions.WindowNavigation, except it wouldn't be bound to a direction, and just cycle through them in some order that makes sense (left to right, top to bottom for instance).该行为类似于 XMonad.Actions.WindowNavigation,不同之处在于它不会绑定到一个方向,并且只是按照某种有意义的顺序(例如从左到右,从上到下)循环遍历它们。

I've found some code here that claims to manipulate the StackSet to solve this problem, and I got it to compile but it wouldn't do what I wanted.我在这里找到了一些声称操纵 StackSet 来解决这个问题的代码,我让它编译但它不会做我想要的。 Unfortunately my understanding of Haskell is pretty limited, so I've been unable to either write my own or fix whatever is wrong with the code above.不幸的是,我对 Haskell 的理解非常有限,所以我无法自己编写或修复上面代码的任何错误。

You can use the CycleWS module in xmonad-contrib您可以在xmonad-contrib 中使用CycleWS模块

It has bindings that you can use to cycle through non-empty workspaces:它具有可用于在非空工作区中循环的绑定:

import XMonad.Actions.CycleWS

myKeys homeDir conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
    [ -- (your own bindings here)
    -- Cycle non-empty workspaces with mod+tab or mod+shift+tab
    , ((modm              , xK_Tab   ), moveTo Next NonEmptyWS)
    , ((modm .|. shiftMask, xK_Tab   ), moveTo Prev NonEmptyWS)
    ]

My full config is here if you want a complete example.如果你想要一个完整的例子,我的完整配置在这里

This functionality has since been added to xmonad-contrib by this pull request .此功能已通过此拉取请求添加到 xmonad-contrib 中。

Example usage:用法示例:

import XMonad.Actions.GroupNavigation

within the keys section在钥匙部分

-- use Alt+Tab and Alt+Shift+Tab to change focus to different windows across workspaces
((alt,           xK_Tab   ), nextMatch Forward isOnAnyVisibleWS),
((alt .|. shift, xK_Tab   ), nextMatch Backward isOnAnyVisibleWS),

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

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