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

Copyright | (c) Joachim Breitner <mail@joachim-breitner.de>
License | BSD
Maintainer | Joachim Breitner <mail@joachim-breitner.de>
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell2010

XMonad.Hooks.ManageDocks

Contents

- Usage
- For developers of other modules (XMonad.Actions.FloatSnap)
- Standalone hooks (deprecated)

Description

This module provides tools to automatically manage `dock` type programs, such as gnome-panel, kicker, dzen, and xmobar.

Synopsis

- docks :: forall (a :: Type -> Type). XConfig a -> XConfig a
- manageDocks :: ManageHook
- checkDock :: Query Bool
- newtype AvoidStruts a = AvoidStruts (Set Direction2D)
- avoidStruts :: LayoutClass l a => l a -> ModifiedLayout AvoidStruts l a
- avoidStrutsOn :: LayoutClass l a => [Direction2D] -> l a -> ModifiedLayout AvoidStruts l a
- data ToggleStruts
  - = ToggleStruts
  - | ToggleStrut Direction2D
- data SetStruts = SetStruts {
  - addedStruts :: [Direction2D]
  - removedStruts :: [Direction2D]
  }
- module XMonad.Util.Types
- calcGap :: Set Direction2D -> X (Rectangle -> Rectangle)
- docksEventHook :: Event -> X All
- docksStartupHook :: X ()

# Usage

To use this module, add the following import to `xmonad.hs`:

    import XMonad.Hooks.ManageDocks

Wrap your xmonad config with a call to `docks`, like so:

    main = xmonad $ … . docks . … $ def{…}

Then add `avoidStruts` or `avoidStrutsOn` layout modifier to your layout to prevent windows from overlapping these windows.

    layoutHook = avoidStruts (tall ||| mirror tall ||| ...)
                      where  tall = Tall 1 (3/100) (1/2)

`AvoidStruts` also supports toggling the dock gaps; add a keybinding similar to:

    ,((modm, xK_b     ), sendMessage ToggleStruts)

If you have multiple docks, you can toggle their gaps individually. For example, to toggle only the top gap:

    ,((modm .|. controlMask, xK_t), sendMessage $ ToggleStrut U)

Similarly, you can use `D`, `L`, and `R` to individually toggle gaps on the bottom, left, or right.

If you want certain docks to be avoided but others to be covered by default, you can manually specify the sides of the screen on which docks should be avoided, using `avoidStrutsOn`. For example:

    layoutHook = avoidStrutsOn [U,L] (tall ||| mirror tall ||| ...)

For detailed instructions on editing your key bindings, see the tutorial.

docks :: forall (a :: Type -> Type). XConfig a -> XConfig a #

Add docks functionality to the given config. See above for an example.

manageDocks :: ManageHook #

Detects if the given window is of type DOCK and if so, reveals it, but does not manage it.

checkDock :: Query Bool #

Checks if a window is a DOCK or DESKTOP window. Ignores xmonad's own windows (usually _NET_WM_WINDOW_TYPE_DESKTOP) to avoid unnecessary refreshes.

newtype AvoidStruts a #

Constructors

AvoidStruts (Set Direction2D) |

#### Instances

Instances details

LayoutModifier AvoidStruts a # |

Instance details

Defined in XMonad.Hooks.ManageDocks

Methods

modifyLayout :: LayoutClass l a => AvoidStruts a -> Workspace WorkspaceId (l a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (l a)) #

modifyLayoutWithUpdate :: LayoutClass l a => AvoidStruts a -> Workspace WorkspaceId (l a) a -> Rectangle -> X (([(a, Rectangle)], Maybe (l a)), Maybe (AvoidStruts a)) #

handleMess :: AvoidStruts a -> SomeMessage -> X (Maybe (AvoidStruts a)) #

handleMessOrMaybeModifyIt :: AvoidStruts a -> SomeMessage -> X (Maybe (Either (AvoidStruts a) SomeMessage)) #

pureMess :: AvoidStruts a -> SomeMessage -> Maybe (AvoidStruts a) #

redoLayout :: AvoidStruts a -> Rectangle -> Maybe (Stack a) -> [(a, Rectangle)] -> X ([(a, Rectangle)], Maybe (AvoidStruts a)) #

pureModifier :: AvoidStruts a -> Rectangle -> Maybe (Stack a) -> [(a, Rectangle)] -> ([(a, Rectangle)], Maybe (AvoidStruts a)) #

hook :: AvoidStruts a -> X () #

unhook :: AvoidStruts a -> X () #

modifierDescription :: AvoidStruts a -> String #

modifyDescription :: LayoutClass l a => AvoidStruts a -> l a -> String #

Read (AvoidStruts a) # |
Instance details Defined in XMonad.Hooks.ManageDocks Methods readsPrec :: Int -> ReadS (AvoidStruts a) # readList :: ReadS [AvoidStruts a] # readPrec :: ReadPrec (AvoidStruts a) # readListPrec :: ReadPrec [AvoidStruts a] #
Show (AvoidStruts a) # |
Instance details Defined in XMonad.Hooks.ManageDocks Methods showsPrec :: Int -> AvoidStruts a -> ShowS # show :: AvoidStruts a -> String # showList :: [AvoidStruts a] -> ShowS #

avoidStruts :: LayoutClass l a => l a -> ModifiedLayout AvoidStruts l a #

Adjust layout automagically: don't cover up any docks, status bars, etc.

Note that this modifier must be applied before any modifier that changes the screen rectangle, or struts will be applied in the wrong place and may affect the other modifier(s) in odd ways. This is most commonly seen with the `spacing` modifier and friends.

avoidStrutsOn :: LayoutClass l a => [Direction2D] -> l a -> ModifiedLayout AvoidStruts l a #

Adjust layout automagically: don't cover up docks, status bars, etc. on the indicated sides of the screen. Valid sides are `U` (top), `D` (bottom), `R` (right), or `L` (left). The warning in `avoidStruts` applies to this modifier as well.

data ToggleStruts #

Message type which can be sent to an `AvoidStruts` layout modifier to alter its behavior.

Constructors

ToggleStruts |
ToggleStrut Direction2D |

#### Instances

Instances details

Read ToggleStruts # |
Instance details Defined in XMonad.Hooks.ManageDocks Methods readsPrec :: Int -> ReadS ToggleStruts # readList :: ReadS [ToggleStruts] # readPrec :: ReadPrec ToggleStruts # readListPrec :: ReadPrec [ToggleStruts] #
Show ToggleStruts # |
Instance details Defined in XMonad.Hooks.ManageDocks Methods showsPrec :: Int -> ToggleStruts -> ShowS # show :: ToggleStruts -> String # showList :: [ToggleStruts] -> ShowS #
Message ToggleStruts # |
Instance details Defined in XMonad.Hooks.ManageDocks

data SetStruts #

SetStruts is a message constructor used to set or unset specific struts, regardless of whether or not the struts were originally set. Here are some example bindings:

Show all gaps:

      ,((modm .|. shiftMask  ,xK_b),sendMessage $ SetStruts [minBound .. maxBound] [])

Hide all gaps:

      ,((modm .|. controlMask,xK_b),sendMessage $ SetStruts [] [minBound .. maxBound])

Show only upper and left gaps:

      ,((modm .|. controlMask .|. shiftMask,xK_b),sendMessage $ SetStruts [U,L] [minBound .. maxBound])

Hide the bottom keeping whatever the other values were:

      ,((modm .|. controlMask .|. shiftMask,xK_g),sendMessage $ SetStruts [] [D])

Constructors

SetStruts |

Fields

- addedStruts :: [Direction2D]
- removedStruts :: [Direction2D]

  These are removed from the currently set struts before `addedStruts` are added.

#### Instances

Instances details

Read SetStruts # |
Instance details Defined in XMonad.Hooks.ManageDocks Methods readsPrec :: Int -> ReadS SetStruts # readList :: ReadS [SetStruts] # readPrec :: ReadPrec SetStruts # readListPrec :: ReadPrec [SetStruts] #
Show SetStruts # |
Instance details Defined in XMonad.Hooks.ManageDocks Methods showsPrec :: Int -> SetStruts -> ShowS # show :: SetStruts -> String # showList :: [SetStruts] -> ShowS #
Message SetStruts # |
Instance details Defined in XMonad.Hooks.ManageDocks

module XMonad.Util.Types

# For developers of other modules (XMonad.Actions.FloatSnap)

calcGap :: Set Direction2D -> X (Rectangle -> Rectangle) #

Goes through the list of windows and find the gap so that all STRUT settings are satisfied.

# Standalone hooks (deprecated)

docksEventHook :: Event -> X All #

Deprecated: Use docks instead.

Whenever a new dock appears, refresh the layout immediately to avoid the new dock.

docksStartupHook :: X () #

Deprecated: Use docks instead.