-
-
Notifications
You must be signed in to change notification settings - Fork 717
Description
Checklist
- I have read the appropriate section in the contributing guidelines
- I believe this issue is a problem with polybar itself and not a misconfiguration on my part
- I have searched for other open and closed issues that may have already reported this problem
- I have checked the known issues page for this problem.
- I have followed the debugging guide to narrow down the problem to a minimal config.
Steps to reproduce
- Have a window manager that does not have independent workspaces. Ala xmonad, where a tag can be on any monitor.
- Have 2 monitors or more
- Have it support the desktop_viewport ewmh extension (I implemented viewport support for my xmonad)
- See how polybar, when it is started, reads the list of workspaces and their viewports. When pinned-workspaces is on, polybar would include in its workspace list, only the workspaces that were on its monitor during startup and not update with the changing net_desktop_viewport
I believe qtile has the same behaviour, where our workpaces change their viewports dynamically, depending on the monitor we display them.
Minimal config
[bar/this]
width = 100%
height = 24pt
monitor = yourmonitor
background = #000000
foreground = #ffffff
line-size = 3pt
border-size = 4pt
border-color = #00000000
modules-left = xworkspaces
[module/xworkspaces]
type = internal/xworkspaces
label-active = %name%
label-active-background = ${colors.background-alt}
label-active-underline= ${colors.primary}
label-active-padding = 1
label-occupied = %name%
label-occupied-padding = 1
label-urgent = %name%
label-urgent-background = ${colors.alert}
label-urgent-padding = 1
label-empty = %name%
label-empty-foreground = ${colors.disabled}
label-empty-padding = 1
pin-workspaces = true
Polybar log
No response
Expected behavior
Since the pinned workspaces implementation of polybar right now, does not expect workspaces to have their viewports dynamically, I think xworkspaces module should refresh it when it changes.
Actual behavior
See how polybar, when it is started, reads the list of workspaces and their viewports. When pinned-workspaces is on, polybar would include in its workspace list, only the workspaces that were on its monitor during startup and not update with the changing net_desktop_viewport
Window Manager and Version
xmonad with ewmh and my _net_desktop_viewport implementation
Linux Distribution
gentoo
Polybar version
polybar 3.6.2
Additional Context / Screenshots
I believe any wm with viewport support and tags that are shared in all monitors support ewmh this way.
Here it is a SS of wmctl -d when the current focused monitor is in workspace 1 (the 0 1366 viewport) and the other visible monitor is resting with workspace 2 (0 0 viewport). (mind the other non visible workspaces I like setting them in the focused monitor viewport, so that polybar maybe if this resolves, has close to my eye the workspaces I might go)
$ wmctrl -d
0 * DG: N/A VP: 1366,0 WA: N/A 1
1 - DG: N/A VP: 0,0 WA: N/A 2
2 - DG: N/A VP: 1366,0 WA: N/A 3
3 - DG: N/A VP: 1366,0 WA: N/A 4
4 - DG: N/A VP: 1366,0 WA: N/A 5
5 - DG: N/A VP: 1366,0 WA: N/A 6
6 - DG: N/A VP: 1366,0 WA: N/A 7
7 - DG: N/A VP: 1366,0 WA: N/A 8
8 - DG: N/A VP: 1366,0 WA: N/A 9
Now this is what happens when I switch the tags across my monitors. See how workspace 1 and 2 have had their viewports switched (ignore the hidden workspaces 3 - 9)
0 * DG: N/A VP: 0,0 WA: N/A 1
1 - DG: N/A VP: 1366,0 WA: N/A 2
2 - DG: N/A VP: 0,0 WA: N/A 3
3 - DG: N/A VP: 0,0 WA: N/A 4
4 - DG: N/A VP: 0,0 WA: N/A 5
5 - DG: N/A VP: 0,0 WA: N/A 6
6 - DG: N/A VP: 0,0 WA: N/A 7
7 - DG: N/A VP: 0,0 WA: N/A 8
8 - DG: N/A VP: 0,0 WA: N/A 9
If you want to run this with xmonad, you have to include the viewport support on your log hook with these 2 functions
getDesktopViewport = withWindowSet $ \x -> do
sort' <- mkViewPortSort getWsCompare
let cS = W.current x
vS = W.visible x
hWs = W.hidden x
viewPorts = sort' $ map mkViewPort' (cS : vS)
++ map (`mkViewPort` cS) hWs
setDesktopViewport $ viewPortList viewPorts
where
mkViewPort w s = (W.tag w, screenToViewPort s)
mkViewPort' s = mkViewPort (W.workspace s) s
mkViewPortSort cmpX = do
cmp <- cmpX
return $ sortBy (\a b -> cmp (fst a) (fst b))
viewPortList list = concatMap ((\(a,b) -> a : [b]) . snd ) list
setDesktopViewport :: [Position] -> X ()
setDesktopViewport l = withDisplay $ \dpy -> do
a <- io $ internAtom dpy "_NET_DESKTOP_VIEWPORT" True
r <- asks theRoot
let n = map fromIntegral l
io $ changeProperty32 dpy r a cARDINAL propModeReplace n
and also add this into the startup hook
setSupported :: X ()
setSupported = withDisplay $ \dpy -> do
r <- asks theRoot
a <- getAtom "_NET_SUPPORTED"
supp <- mapM getAtom ["_NET_WM_STATE_HIDDEN"
,"_NET_WM_STATE_DEMANDS_ATTENTION"
,"_NET_NUMBER_OF_DESKTOPS"
,"_NET_CLIENT_LIST"
,"_NET_CLIENT_LIST_STACKING"
,"_NET_CURRENT_DESKTOP"
,"_NET_DESKTOP_NAMES"
,"_NET_ACTIVE_WINDOW"
,"_NET_WM_DESKTOP"
,"_NET_WM_STRUT"
,"_NET_DESKTOP_VIEWPORT"
]
io $ changeProperty32 dpy r a aTOM propModeReplace (fmap fromIntegral supp)`