I am having problems with my CMS at the moment so most stuff is broken by now...
...no I can't use standard-software for this ;)
I am using wmclockmon on my XMonad-desktop for a while now. But something anoyed me:
In its configuration as XMonad.Layout.Monitor it gets displayed on top of all other windows -
As far as good - but what if an application (such as a browser) has buttons hidden under it? You would
not be able to access them!
So in order to get my system more usable I have to hide the clock once I hover it. In the following code you can see what I did to the wmclockmon-window. Some issues are however still left...
import Data.IORef
import XMonad.Layout.Monitor
import XMonad.Layout.LayoutModifier
myClckMonitor = monitor
{ prop = ClassName "DockApp" `And` Title "wmclockmon"
, rect = Rectangle (1680 - 64) 0 64 64
, persistent = False
, name = "clock"
}
-- Hide wmclockmon on mouse over
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)
-- Now Add it to the Layout...
myNewLayout = ModifiedLayout myBattMonitor $ myLayout
-- You have to ignore emclockmon in your ManageHook!
-- Start wmclockmon in your .xinitrc
The main problem left is how (/when) to redisplay the clock. As you can see I do that on a crossing event, too. That's good enough for me. One could mess around with timers but as it would be neccesary to emulate side-effects this is imho rather not trivial.