XMonad.Util.XUtils

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

Copyright | (c) 2007 Andrea Rossato 2010 Alejandro Serrano
License | BSD-style (see xmonad/LICENSE)
Maintainer | andrea.rossato@unibz.it
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell2010

XMonad.Util.XUtils

Contents

- Usage:

Description

A module for painting on the screen

Synopsis

- withSimpleWindow :: WindowConfig -> [String] -> X a -> X a
- showSimpleWindow :: WindowConfig -> [String] -> X Window
- data WindowConfig = WindowConfig {
  - winFont :: !String
  - winBg :: !String
  - winFg :: !String
  - winRect :: !WindowRect
  }
- data WindowRect
  - = CenterWindow
  - | CustomRect Rectangle
- averagePixels :: Pixel -> Pixel -> Double -> X Pixel
- createNewWindow :: Rectangle -> Maybe EventMask -> String -> Bool -> X Window
- showWindow :: Window -> X ()
- showWindows :: [Window] -> X ()
- hideWindow :: Window -> X ()
- hideWindows :: [Window] -> X ()
- deleteWindow :: Window -> X ()
- deleteWindows :: [Window] -> X ()
- paintWindow :: Window -> Dimension -> Dimension -> Dimension -> String -> String -> X ()
- paintAndWrite :: Window -> XMonadFont -> Dimension -> Dimension -> Dimension -> String -> String -> String -> String -> [Align] -> [String] -> X ()
- paintTextAndIcons :: Window -> XMonadFont -> Dimension -> Dimension -> Dimension -> String -> String -> String -> String -> [Align] -> [String] -> [Placement] -> [[[Bool]]] -> X ()
- stringToPixel :: (Functor m, MonadIO m) => Display -> String -> m Pixel
- pixelToString :: MonadIO m => Display -> Pixel -> m String
- fi :: (Integral a, Num b) => a -> b

# Usage:

See XMonad.Layout.Tabbed or XMonad.Layout.DragPane or XMonad.Layout.Decoration for usage examples

withSimpleWindow :: WindowConfig -> [String] -> X a -> X a #

Like `showSimpleWindow`, but fully manage the window; i.e., destroy it after the given function finishes its execution.

showSimpleWindow #

Arguments

:: WindowConfig | Window config.
-> [String] | Lines of text to show.
-> X Window |

Create a window, then fill and show it with the given text. If you are looking for a version of this function that also takes care of destroying the window, refer to `withSimpleWindow`.

data WindowConfig #

The config for a window, as interpreted by `showSimpleWindow`.

The font `winFont` can either be specified in the TODO format or as an xft font. For example:

    winFont = "xft:monospace-20"

or

    winFont = "-misc-fixed-*-*-*-*-20-*-*-*-*-*-*-*"

Constructors

WindowConfig |
Fields winFont :: !String Font to use. winBg :: !String Background color. winFg :: !String Foreground color. winRect :: !WindowRect Position and size of the rectangle.

#### Instances

Instances details

Default WindowConfig # |
Instance details Defined in XMonad.Util.XUtils Methods def :: WindowConfig #

data WindowRect #

What kind of window we should be.

Constructors

CenterWindow | Centered, big enough to fit all the text.
CustomRect Rectangle | Completely custom dimensions.

averagePixels :: Pixel -> Pixel -> Double -> X Pixel #

Compute the weighted average the colors of two given `Pixel` values.

This function masks out any alpha channel in the passed pixels, and the result has no alpha channel. X11 mishandles `Pixel` values with alpha channels and throws errors while producing black pixels.

createNewWindow :: Rectangle -> Maybe EventMask -> String -> Bool -> X Window #

Create a simple window given a rectangle. If Nothing is given only the exposureMask will be set, otherwise the Just value. Use `showWindow` to map and hideWindow to unmap.

showWindow :: Window -> X () #

Map a window

showWindows :: [Window] -> X () #

the list version

hideWindow :: Window -> X () #

unmap a window

hideWindows :: [Window] -> X () #

the list version

deleteWindow :: Window -> X () #

destroy a window

deleteWindows :: [Window] -> X () #

the list version

paintWindow #

Arguments

:: Window | The window where to draw
-> Dimension | Window width
-> Dimension | Window height
-> Dimension | Border width
-> String | Window background color
-> String | Border color
-> X () |

Fill a window with a rectangle and a border

paintAndWrite #

Arguments

:: Window | The window where to draw
-> XMonadFont | XMonad Font for drawing
-> Dimension | Window width
-> Dimension | Window height
-> Dimension | Border width
-> String | Window background color
-> String | Border color
-> String | String color
-> String | String background color
-> [Align] | String `Align`ments
-> [String] | Strings to be printed
-> X () |

Fill a window with a rectangle and a border, and write | a number of strings to given positions

paintTextAndIcons #

Arguments

:: Window | The window where to draw
-> XMonadFont | XMonad Font for drawing
-> Dimension | Window width
-> Dimension | Window height
-> Dimension | Border width
-> String | Window background color
-> String | Border color
-> String | String color
-> String | String background color
-> [Align] | String `Align`ments
-> [String] | Strings to be printed
-> [Placement] | Icon `Placements`
-> [[[Bool]]] | Icons to be printed
-> X () |

Fill a window with a rectangle and a border, and write | a number of strings and a number of icons to given positions

stringToPixel :: (Functor m, MonadIO m) => Display -> String -> m Pixel #

Get the Pixel value for a named color: if an invalid name is given the black pixel will be returned.

pixelToString :: MonadIO m => Display -> Pixel -> m String #

Convert a `Pixel` into a `String`.

This function removes any alpha channel from the `Pixel`, because X11 mishandles alpha channels and produces black.

fi :: (Integral a, Num b) => a -> b #

Short for `fromIntegral`.