XMonad.Hooks.XPropManage

xmonad-contrib-0.18.1: Community-maintained extensions for xmonad

Copyright | (c) Karsten Schoelzel <kuser@gmx.de>
License | BSD
Maintainer | Karsten Schoelzel <kuser@gmx.de>
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell2010

XMonad.Hooks.XPropManage

Contents

- Usage

Description

A ManageHook matching on XProperties.

Synopsis

- xPropManageHook :: [XPropMatch] -> ManageHook
- type XPropMatch = ([(Atom, [String] -> Bool)], Window -> X (WindowSet -> WindowSet))
- pmX :: (Window -> X ()) -> Window -> X (WindowSet -> WindowSet)
- pmP :: (WindowSet -> WindowSet) -> Window -> X (WindowSet -> WindowSet)

# Usage

You can use this module with the following in your `xmonad.hs`:

    import XMonad.Hooks.XPropManage
    import qualified XMonad.StackSet as W
    import XMonad.Actions.TagWindows
    import Data.List

    manageHook = xPropManageHook xPropMatches

    xPropMatches :: [XPropMatch]
    xPropMatches = [ ([ (wM_CLASS, any ("gimp"==))], (\w -> float w >> return (W.shift "2")))
                   , ([ (wM_COMMAND, any ("screen" ==)), (wM_CLASS, any ("xterm" ==))], pmX (addTag "screen"))
                   , ([ (wM_NAME, any ("Iceweasel" `isInfixOf`))], pmP (W.shift "3"))
                   ]

Properties known to work: wM_CLASS, wM_NAME, wM_COMMAND

A XPropMatch consists of a list of conditions and function telling what to do.

The list entries are pairs of an XProperty to match on (like wM_CLASS, wM_NAME)^1, and an function which matches onto the value of the property (represented as a List of Strings).

If a match succeeds the function is called immediately, can perform any action and then return a function to apply in `windows` (see Operations.hs). So if the action does only work on the WindowSet use just 'pmP function'.

*1 You can get the available properties of an application with the xprop utility. STRING properties should work fine. Others might not work.

xPropManageHook :: [XPropMatch] -> ManageHook #

type XPropMatch = ([(Atom, [String] -> Bool)], Window -> X (WindowSet -> WindowSet)) #

pmX :: (Window -> X ()) -> Window -> X (WindowSet -> WindowSet) #

pmP :: (WindowSet -> WindowSet) -> Window -> X (WindowSet -> WindowSet) #