如何使用 IndependentScreens 获取监视器 x 上的工作区列表
How do I get list of workspaces on monitor x with IndependentScreens
我有 2 个不同尺寸的显示器,其中一个 是垂直放置的,我希望它们默认具有不同的布局
我正在使用 XMonad.Layout.IndependentScreens
为每个监视器分配它自己的一组工作空间
我找到了一个可以满足我需要的库 XMonad.Layout.PerWorkspace
据此,我定义了 2 个我将要使用的显示器布局:
where
-- default tiling algorithm partitions the screen into two panes
tiled = (Tall nmaster delta ratio) -- here, we can use `magicFocus`, but it creates several inconviniences
-- The default number of windows in the master pane
nmaster = 1
-- Default proportion of screen occupied by master pane
ratio = 2/3
-- Percent of screen to increment by when resizing panes
delta = 3/100
verticalLayout = Mirror tiled ||| tabbed shrinkText myTabConfig ||| noBorders Full ||| tiled
where
-- default tiling algorithm partitions the screen into two panes
tiled = (Tall nmaster delta ratio) -- here, we can use `magicFocus`, but it creates several inconviniences
-- The default number of windows in the master pane
nmaster = 1
-- Default proportion of screen occupied by master pane
ratio = 2/3
-- Percent of screen to increment by when resizing panes
delta = 3/100
所以现在我尝试在布局挂钩上使用它们,以及 IndependentScreens 的 workspacesOn 函数
layoutHook = smartBorders . avoidStruts $
onWorkspaces (workspacesOn 0) myLayout $
onWorkspaces (workspacesOn 1) verticalLayout
失败并出现以下错误:
xmonad.hs:447:27: error:
• Variable not in scope: workspacesOn :: Integer -> [WorkspaceId]
• Perhaps you meant one of these:
‘workspaces'’ (imported from XMonad.Layout.IndependentScreens),
‘workspaces’ (imported from XMonad),
‘W.workspaces’ (imported from XMonad.StackSet)
|
447 | onWorkspaces (workspacesOn 0) myLayout $
| ^^^^^^^^^^^^
xmonad.hs:448:27: error:
• Variable not in scope: workspacesOn :: Integer -> [WorkspaceId]
• Perhaps you meant one of these:
‘workspaces'’ (imported from XMonad.Layout.IndependentScreens),
‘workspaces’ (imported from XMonad),
‘W.workspaces’ (imported from XMonad.StackSet)
|
448 | onWorkspaces (workspacesOn 1) verticalLayout
|
现在我很困惑,因为那个函数在 documentation 中,而且我清楚地包含了对 IndependantStreens 的引用,它在错误消息中
上面的代码有什么问题,我该如何让它工作?
在你的配置中的某个地方,你写了这样的东西:
workspaces = withScreens 2 ["a", "b", "c"]
您可以使用 marshall
获取特定屏幕上的工作区列表。屏幕 0 上的工作区是 map (marshall 0) ["a", "b", "c"]
,屏幕 1 上的工作区也类似。您可能应该将虚拟工作区列表分离到它自己的定义中。所以:
virtualWorkspaces = ["a", "b", "c"]
... (map (marshall 0) virtualWorkspaces) ...
... (map (marshall 1) virtualWorkspaces) ...
...
workspaces = withScreens 2 virtualWorkspaces
我有 2 个不同尺寸的显示器,其中一个 是垂直放置的,我希望它们默认具有不同的布局
我正在使用 XMonad.Layout.IndependentScreens
为每个监视器分配它自己的一组工作空间
我找到了一个可以满足我需要的库 XMonad.Layout.PerWorkspace
据此,我定义了 2 个我将要使用的显示器布局:
where
-- default tiling algorithm partitions the screen into two panes
tiled = (Tall nmaster delta ratio) -- here, we can use `magicFocus`, but it creates several inconviniences
-- The default number of windows in the master pane
nmaster = 1
-- Default proportion of screen occupied by master pane
ratio = 2/3
-- Percent of screen to increment by when resizing panes
delta = 3/100
verticalLayout = Mirror tiled ||| tabbed shrinkText myTabConfig ||| noBorders Full ||| tiled
where
-- default tiling algorithm partitions the screen into two panes
tiled = (Tall nmaster delta ratio) -- here, we can use `magicFocus`, but it creates several inconviniences
-- The default number of windows in the master pane
nmaster = 1
-- Default proportion of screen occupied by master pane
ratio = 2/3
-- Percent of screen to increment by when resizing panes
delta = 3/100
所以现在我尝试在布局挂钩上使用它们,以及 IndependentScreens 的 workspacesOn 函数
layoutHook = smartBorders . avoidStruts $
onWorkspaces (workspacesOn 0) myLayout $
onWorkspaces (workspacesOn 1) verticalLayout
失败并出现以下错误:
xmonad.hs:447:27: error:
• Variable not in scope: workspacesOn :: Integer -> [WorkspaceId]
• Perhaps you meant one of these:
‘workspaces'’ (imported from XMonad.Layout.IndependentScreens),
‘workspaces’ (imported from XMonad),
‘W.workspaces’ (imported from XMonad.StackSet)
|
447 | onWorkspaces (workspacesOn 0) myLayout $
| ^^^^^^^^^^^^
xmonad.hs:448:27: error:
• Variable not in scope: workspacesOn :: Integer -> [WorkspaceId]
• Perhaps you meant one of these:
‘workspaces'’ (imported from XMonad.Layout.IndependentScreens),
‘workspaces’ (imported from XMonad),
‘W.workspaces’ (imported from XMonad.StackSet)
|
448 | onWorkspaces (workspacesOn 1) verticalLayout
|
现在我很困惑,因为那个函数在 documentation 中,而且我清楚地包含了对 IndependantStreens 的引用,它在错误消息中
上面的代码有什么问题,我该如何让它工作?
在你的配置中的某个地方,你写了这样的东西:
workspaces = withScreens 2 ["a", "b", "c"]
您可以使用 marshall
获取特定屏幕上的工作区列表。屏幕 0 上的工作区是 map (marshall 0) ["a", "b", "c"]
,屏幕 1 上的工作区也类似。您可能应该将虚拟工作区列表分离到它自己的定义中。所以:
virtualWorkspaces = ["a", "b", "c"]
... (map (marshall 0) virtualWorkspaces) ...
... (map (marshall 1) virtualWorkspaces) ...
...
workspaces = withScreens 2 virtualWorkspaces