in my config.hs I use a Monitor to show wmclockmon on top of all windows like this:
myClckMonitor = monitor
{ prop = ClassName "DockApp" `And` Title "wmclockmon"
, rect = Rectangle (1680 - 64) 0 64 64
, persistent = False
, name = "clock"
}
myNewLayout = ModifiedLayout myClckMonitor $ smartBorders $ avoidStruts $ myLayout ||| noBorders Full
And additionally added it to the ignores of the manageHook.
What I want to do now is to hide the monitor when I hover (mouse over) it (and of course show it again when I leave that area). Do you have any hints how to achieve that?
I finally got it!
Corresponding part of my xmonad.hs:
import Data.IORef
import XMonad.Layout.Monitor
myClckMonitor = monitor
{ prop = ClassName "DockApp" `And` Title "wmclockmon"
, rect = Rectangle (1680 - 64) 0 64 64
, persistent = False
, name = "clock"
}
screenRectEventHook :: Event -> X All
screenRectEventHook CrossingEvent { ev_window = win } = do
dpy <- asks display
root <- asks theRoot
(posX, posY, acc) <- io $ do
-- queryPointer :: Display -> Window -> IO (Bool, Window, Window, Int, Int, Int, Int, Modifier)
-- interface to the X11 library function XQueryPointer().
(_, _, _, ix, iy, _, _, _) <- queryPointer dpy root
r <- newIORef Nothing
return (fromIntegral ix, fromIntegral iy, r)
if (posY < 64 && posX > (1680 - 64))
then do
broadcastMessage HideMonitor >> refresh
return (All True)
else do
broadcastMessage ShowMonitor >> refresh
return (All True)
screenRectEventHook _ = return (All True)
and then register the event hook:
myEventHook e = do
screenRectEventHook e
return (All True)
As you can see the coordinates of my monitor are hardcoded! The question on how to re-display the clock is still open. However if you switch the Workspace or to another window it'll get visible again. That's good enough for me.