Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I know this is an old question, but I came here looking for an answer to this a few days ago, and I thought I'd share the way I solved it. You actually can do it entirely from xmonad. It's a tiny bit hacky, but I think it's much nicer than any of the alternatives I've come across.</p> <p>Basically, I used the <a href="http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Util-Timer.html" rel="noreferrer">XMonad.Util.Timer</a> library, which will send an X event after a specified time period (in this case, one second). Then I just wrote an event hook for it, which starts the timer again, and then manually runs the log hook.</p> <p>I also had to use the <a href="http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Util-ExtensibleState.html" rel="noreferrer">XMonad.Util.ExtensibleState</a> library, because Timer uses an id variable to make sure it's responding to the right event, so I have to store that variable between events.</p> <p>Here's my code:</p> <pre><code>{-# LANGUAGE DeriveDataTypeable #-} import qualified XMonad.Util.ExtensibleState as XS import XMonad.Util.Timer ... -- wrapper for the Timer id, so it can be stored as custom mutable state data TidState = TID TimerId deriving Typeable instance ExtensionClass TidState where initialValue = TID 0 ... -- put this in your startupHook -- start the initial timer, store its id clockStartupHook = startTimer 1 &gt;&gt;= XS.put . TID -- put this in your handleEventHook clockEventHook e = do -- e is the event we've hooked (TID t) &lt;- XS.get -- get the recent Timer id handleTimer t e $ do -- run the following if e matches the id startTimer 1 &gt;&gt;= XS.put . TID -- restart the timer, store the new id ask &gt;&gt;= logHook.config -- get the loghook and run it return Nothing -- return required type return $ All True -- return required type </code></pre> <p>Pretty straightforward. I hope this is helpful to someone.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload