xmonad-contrib-0.9.1: Third party extensions for xmonad

Portabilityunportable
Stabilityunstable
MaintainerBraden.Shepherdson@gmail.com

XMonad.Hooks.DynamicHooks

Contents

Description

One-shot and permanent ManageHooks that can be updated at runtime.

Synopsis

Usage

Provides two new kinds of ManageHooks that can be defined at runtime.

  • One-shot ManageHooks that are deleted after they execute.
  • Permanent ManageHooks (unless you want to destroy them)

Note that you will lose all dynamically defined ManageHooks when you mod+q! If you want them to last, you should create them as normal in your xmonad.hs.

First, you must execute initDynamicHooks from main in your xmonad.hs:

 dynHooksRef <- initDynamicHooks

and then pass this value to the other functions in this module.

You also need to add the base ManageHook:

 xmonad { manageHook = myManageHook <+> dynamicMasterHook dynHooksRef }

You must include this dynHooksRef value when using the functions in this module:

 xmonad { keys = myKeys `Data.Map.union` Data.Map.fromList
                   [((modm, xK_i), oneShotHook dynHooksRef
                    "FFlaunchHook" (className =? "firefox") (doShift "3")
                    >> spawn "firefox")
                   ,((modm, xK_u), addDynamicHook dynHooksRef
                     (className =? "example" --> doFloat))
                   ,((modm, xK_y), updatePermanentHook dynHooksRef
                     (const idHook))) ]  -- resets the permanent hook.

initDynamicHooks :: IO (IORef DynamicHooks)Source

Creates the IORef that stores the dynamically created ManageHooks.

dynamicMasterHook :: IORef DynamicHooks -> ManageHookSource

Master ManageHook that must be in your xmonad.hs ManageHook.

addDynamicHook :: IORef DynamicHooks -> ManageHook -> X ()Source

Appends the given ManageHook to the permanent dynamic ManageHook.

updateDynamicHook :: IORef DynamicHooks -> (ManageHook -> ManageHook) -> X ()Source

Modifies the permanent ManageHook with an arbitrary function.

oneShotHook :: IORef DynamicHooks -> Query Bool -> ManageHook -> X ()Source

Creates a one-shot ManageHook. Note that you have to specify the two parts of the ManageHook separately. Where you would usually write:

 className =? "example" --> doFloat

you must call oneShotHook as

 oneShotHook dynHooksRef (className =? "example) doFloat