Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X.H.ManageDocks: React to strut updates of override_redirect docks #492

Merged
merged 4 commits into from
Mar 23, 2021

Conversation

liskin
Copy link
Member

@liskin liskin commented Mar 23, 2021

Description

We only requested PropertyChange events from docks in the manageDocks manageHook, but that only gets called for normal windows, not override_redirect ones. Therefore, xmobar in its default configuration wouldn't get its struts refreshed on changes. This resulted in gaps not updating after xmobar repositions itself on xrandr changes.

If one wanted to handle that repositioning in xmonad, it was possible to configure xmobar with overrideRedirect = False, which is meant for window managers with proper EWMH stacking order support, so in xmonad it resulted in xmobar covering fullscreen windows. That can be worked around by adding checkDock --> doLower to manageHook, but it starts to smell of too many workarounds.

The fix is to request PropertyChange events for all windows that we treat as docks.

Related: #406
Related: #490

Checklist

  • I've read CONTRIBUTING.md

  • I tested my changes with xmonad-testing

  • I updated the CHANGES.md file

  • n/a I updated the XMonad.Doc.Extending file (if appropriate)

Copy link
Contributor

@geekosaur geekosaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that (and a similar feeling about the deleteFromStru[c]tCache correction), this seems okay.

@@ -121,8 +123,11 @@ remove :: (ExtensionClass a, XLike m) => a -> m ()
remove wit = modifyStateExts $ M.delete (show . typeOf $ wit)

modified :: (ExtensionClass a, Eq a, XLike m) => (a -> a) -> m Bool
modified f = do
modified = modifiedM . (pure .)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably this refactor should be a separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can definitely turn this into a commit on its own but a separate PR seems excessive.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that (and a similar feeling about the deleteFromStru[c]tCache correction), this seems okay.

I split both into separate commits.

Fixes: c48d81e ("Fix caching issues in ManageDocks")
This is primarily a cleanup to make it easier to use `setDocksMask` from
the on-demand cache init (see further commits), but it makes the code
nicer:

- the logic to refresh and cache a strut is now concentrated in
  `updateStrut` instead of being spread over `updateStrutCache` and
  `docksEventHook`

- the logic to initialize the cache if not yet initialized is now
  concentrated in `maybeInitStrutCache` instead of being spread over
  `initStrutCache` and `getStrutCache`, so the dual-purpose return type
  of `getStrutCache` is no more

- the logic to detect changes and refresh is now always handled by
  `XS.modifiedM` instead of an additional `||`

Related: xmonad#406
We only requested PropertyChange events from docks in the `manageDocks`
manageHook, but that only gets called for normal windows, not
override_redirect ones. Therefore, xmobar in its default configuration
wouldn't get its struts refreshed on changes. This resulted in gaps not
updating after xmobar repositions itself on xrandr changes.

If one wanted to handle that repositioning in xmonad, it was possible to
configure xmobar with `overrideRedirect = False`, which is meant for
window managers with proper EWMH stacking order support [1], so in
xmonad it resulted in xmobar covering fullscreen windows. That can be
worked around by adding `checkDock --> doLower` to manageHook, but it
starts to smell of too many workarounds.

[1]: https://specifications.freedesktop.org/wm-spec/wm-spec-1.5.html#STACKINGORDER

The fix is to request PropertyChange events for all windows that we
treat as docks.

Related: xmonad#490
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants