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

Customize _NET_CURRENT_DESKTOP to w.greedyView desktop #776

Open
3 tasks done
jceb opened this issue Nov 3, 2022 · 7 comments
Open
3 tasks done

Customize _NET_CURRENT_DESKTOP to w.greedyView desktop #776

jceb opened this issue Nov 3, 2022 · 7 comments

Comments

@jceb
Copy link

jceb commented Nov 3, 2022

Problem Description

I'd like xmonad to change the current workspace via W.greedyView when clicking on a workspace in the desktop bar. Currently, ewmh uses W.view in ewmhDesktopsEventHook' which doesn't bring the selected workspace into sight when the workspace is displayed on a another monitor. Before version 0.17 I was able to patch ewmhDesktopsEventHook' manually and feed it back into the configuration via the hook system. With version 0.17 this workaround doesn't seem to be possible anymore.

This function is the one that causes the issue for me: https://hackage.haskell.org/package/xmonad-contrib-0.17.1/docs/src/XMonad.Hooks.EwmhDesktops.html#ewmhDesktopsEventHook%27

Steps to Reproduce

  1. Install a desktop bar like tint2
  2. Start xmonad in a multi monitor xinerama setup
  3. Show workspace 1 on monitor 1
  4. Show workspace 2 on monitor 2
  5. On monitor 2 click on workspace 1 in the desktop bar to switch to workspace 1
  6. Observe that the workspaces didn't change monitors. The only difference is that now workspace 1 on monitor 1 is active

Configuration File

Please include the smallest full configuration file that reproduces
the problem you are experiencing:

module Main (main) where

import XMonad
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks

main :: IO ()
main = xmonad $ docks . ewmh $ def

Checklist

  • I've read CONTRIBUTING.md

  • I tested my configuration

    • With xmonad version 0.17.1
    • With xmonad-contrib version 0.17.1
@liskin
Copy link
Member

liskin commented Nov 4, 2022

We can add a configurable hook to https://hackage.haskell.org/package/xmonad-contrib-0.17.1/docs/src/XMonad.Hooks.EwmhDesktops.html#EwmhDesktopsConfig

(pull request welcome but one of us would get to it eventually too :-))

@jceb
Copy link
Author

jceb commented Nov 4, 2022

Okay, I managed to get it to work .. it felt a bit more involved than before. Since it's not easily possible to feed my own custom handleEventHook in - ewmh places its own event hook in front of any custom hook that I pass in, I resolved to patching the config that ewmh returns.
It would be helpful if additional symbols like EwmhDesktopsConfig were exported so it becomes easier to write a custom ewmh event hook.

@slotThe
Copy link
Member

slotThe commented Nov 5, 2022

@jceb so would you like to add an additional field to EwmhDesktopsConfig?

@jceb
Copy link
Author

jceb commented Nov 5, 2022

@slotThe I want to define a new hook (see https://github.com/jceb/dotfiles/blob/master/xorg/.xmonad/xmonad.hs#L118) that requires EwmhDesktopsConfig .. so I'd like to import it to define the hook.

@liskin
Copy link
Member

liskin commented Nov 5, 2022

@jceb That sounds like an https://en.wikipedia.org/wiki/XY_problem though. What you really want is to make _NET_CURRENT_DESKTOP be handled via greedyView, right? Whether you achieve that goal via a nice handleDesktopSwitch-ish hook interface or via copypasting the entire ewmhDesktopsEventHook implementation and making tiny changes to it, is an implementation detail…

@liskin
Copy link
Member

liskin commented Nov 5, 2022

Since it's not easily possible to feed my own custom handleEventHook in - ewmh places its own event hook in front of any custom hook that I pass in, I resolved to patching the config that ewmh returns. It would be helpful if additional symbols like EwmhDesktopsConfig were exported so it becomes easier to write a custom ewmh event hook.

Actually, I just remembered that there's always been a way to override just a part of what ewmhDesktopsEventHook does. You define a hook wrapper that handles a specific request (_NET_CURRENT_DESKTOP in your case) and falls back to the ewmh-defined hook otherwise. See an old example here: https://github.com/xmonad/xmonad-contrib/pull/110/files#diff-cf9308345d1d5de4c1e403c5874d91d723ffc5d4ff79b21c4dbfe6390a592598R230

This should be a better solution for you now, and we'll try to figure out a nice hook api for swapping view/greedyView later.

@jceb
Copy link
Author

jceb commented Nov 5, 2022

Thanks mate, I found a solution that works for the moment. Thanks for working on the API!

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

No branches or pull requests

3 participants