[xmonad] Toggle Window (Always Below <-> Always Above)

Jan-David Quesel quesel at gmail.com
Mon Jan 31 17:40:15 CET 2011


On Mon, Jan 31, 2011 at 05:21:28PM +0100, Audun Skaugen wrote:
> On Mon, Jan 31, 2011 at 3:35 PM, Jan-David Quesel <quesel at gmail.com> wrote:
> > ah nice. That seems to work. Now on to the next issue.
> > Floating the docks seems to kinda work. However it has lots of
> > ugly side effects, such as being able to move the windows around etc.
> >
> > When I call doIgnore on the window and later try to call reveal
> > on it, it does stay in the background... same for doHideIgnore
> > and reveal.
> >
> > Is there a function I can call on a window to get on top of other
> > windows?
> 
> Try:
> d <- asks display
> io $ raiseWindow d win
> 
> You might have to import Graphics.X11.Xlib first.

thats it. I finally was able to implement the behavior I wanted.

Thank you everyone for your help.

Best regards,
Jan

P.S. For documentation purposes I attach the relevant code parts:

My handleEventHook is defined as follows:

data WindowDump = WindowDump ([Window]) deriving (Read, Show, Typeable)
instance ExtensionClass WindowDump 
    where initialValue = WindowDump []
          extensionType = PersistentExtension

myEventHook :: Event -> X All
myEventHook e = handle e >> return (All True)

handle :: Event -> X ()
handle KeyEvent { 
        ev_event_type = ty,
        ev_keycode = k,
        ev_time = t, 
        ev_state = mod 
    } | (ty == keyPress && k == 133) = do
          d <- asks display
          WindowDump windows <- XS.get :: X WindowDump
          mapM (io . (raiseWindow d)) windows
          return ()
handle KeyEvent { 
        ev_event_type = ty,
        ev_keycode = k,
        ev_time = t, 
        ev_state = mod 
    } | (ty == keyRelease && k == 133) = do
          d <- asks display
          WindowDump windows <- XS.get :: X WindowDump
          mapM (io . (lowerWindow d)) windows
          return ()
handle _ = return ()

And the manageHook looks like this:

unique = map head . group . sort
composeAll [
     checkDock <&&> ((fmap ("dzen slave" `isInfixOf`) title) =? False) --> do
        win <- ask
        WindowDump windows <- liftX XS.get :: Query WindowDump
        liftX $ XS.put $ WindowDump (unique (win:windows))
        doIgnore
    , (fmap ("dzen slave" `isInfixOf`) title) --> do
        doIgnore
]


-- 
Jan-David Quesel
Carl von Ossietzky Universität Oldenburg
Department of Computing Science
Correct System Design
D-26111 Oldenburg, Germany

Phone: +49 (0)441 798-2376
Fax: +49 (0)441 798-2965
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20110131/9d6f80f5/attachment.pgp>


More information about the xmonad mailing list