如何切换多个 master windows 方向

How to toggle multiple master windows orientation

我正在使用以下 XMonad.Layout.ThreeColumns 布局

-----------------------------------
|        |               |        |    
|        |               |        |
|        |               |        |
|--------|     Master    |--------|  
|        |               |        |  
|        |               |        | 
|        |               |        |
-----------------------------------

当我通过热键使用 sendMessage (IncMaster 1) 时,它会水平拆分 Master window

-----------------------------------
|        |               |        |    
|        |    Master 1   |        |
|        |               |        |
|--------|---------------|--------|  
|        |               |        |  
|        |    Master 2   |        | 
|        |               |        |
-----------------------------------

如何垂直拆分或切换到垂直方向? 让它像这样:

-------------------------------------
|        |        |        |        |    
|        |        |        |        |
|        |        |        |        |
|--------|Master 1|Master 2|--------|  
|        |        |        |        |
|        |        |        |        |
|        |        |        |        |
-------------------------------------

通过分叉布局并将其硬编码为垂直拆分来解决:

mkdir -p ~/.xmonad/lib/XMonad/Layout
wget "https://raw.githubusercontent.com/xmonad/xmonad-contrib/master/XMonad/Layout/ThreeColumns.hs" -o ~/.xmonad/lib/XMonad/Layout/My.hs

更改模块名称:

module XMonad.Layout.My 

修复导入 XMonad.Prelude 模块问题:

-- import XMonad.Prelude
import Control.Monad (ap, msum)

从此更改行为:

tile3 middle f r nmaster n
    | n <= nmaster || nmaster == 0 = splitVertically n r
    | n <= nmaster+1 = splitVertically nmaster s1 ++ splitVertically (n-nmaster) s2
    | otherwise = splitVertically nmaster r1 ++ splitVertically nslave1 r2 ++ splitVertically nslave2 r3

对此:

tile3 middle f r nmaster n
    | n <= nmaster || nmaster == 0 = splitHorizontally n r
    | n <= nmaster+1 = splitVertically nmaster s1 ++ splitVertically (n-nmaster) s2
    | otherwise = splitHorizontally nmaster r1 ++ splitVertically nslave1 r2 ++ splitVertically nslave2 r3

~/.xmonad/xmonad.hs:

--import XMonad.Layout.ThreeColumns
import XMonad.Layout.My