Customize _NET_CURRENT_DESKTOP to w.greedyView desktop
jceb opened this issue · comments
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
- Install a desktop bar like tint2
- Start xmonad in a multi monitor xinerama setup
- Show workspace 1 on monitor 1
- Show workspace 2 on monitor 2
- On monitor 2 click on workspace 1 in the desktop bar to switch to workspace 1
- 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
- With
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 :-))
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.
@jceb so would you like to add an additional field to EwmhDesktopsConfig
?
@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.
@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…
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 thatewmh
returns. It would be helpful if additional symbols likeEwmhDesktopsConfig
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.
Thanks mate, I found a solution that works for the moment. Thanks for working on the API!