taffybar-4.1.0: A desktop bar similar to xmobar, but with more GUI
Copyright(c) José A. Romero L.
LicenseBSD3-style (see LICENSE)
MaintainerIvan Malison <IvanMalison@gmail.com>
Stabilityunstable
Portabilityunportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.Taffybar.Information.X11DesktopInfo

Description

Low-level functions to access data provided by the X11 desktop via window properties. One of them (getVisibleTags) depends on the pagerHints hook being installed in your ~/.xmonad/xmonad.hs configuration:

import XMonad.Hooks.TaffybarPagerHints (pagerHints)

main = xmonad $ ewmh $ pagerHints $ ...
Synopsis

Context

data X11Context Source #

Represents a connection to an X11 display. Use getX11Context to construct one of these.

data DisplayName Source #

Specifies an X11 display to connect to.

Constructors

DefaultDisplay

Use the DISPLAY environment variable.

DisplayName String

Of the form hostname:number.screen_number

Instances

Instances details
Generic DisplayName Source # 
Instance details

Defined in System.Taffybar.Information.X11DesktopInfo

Associated Types

type Rep DisplayName :: Type -> Type #

Read DisplayName Source # 
Instance details

Defined in System.Taffybar.Information.X11DesktopInfo

Show DisplayName Source # 
Instance details

Defined in System.Taffybar.Information.X11DesktopInfo

Default DisplayName Source # 
Instance details

Defined in System.Taffybar.Information.X11DesktopInfo

Methods

def :: DisplayName #

Eq DisplayName Source # 
Instance details

Defined in System.Taffybar.Information.X11DesktopInfo

Ord DisplayName Source # 
Instance details

Defined in System.Taffybar.Information.X11DesktopInfo

type Rep DisplayName Source # 
Instance details

Defined in System.Taffybar.Information.X11DesktopInfo

type Rep DisplayName = D1 ('MetaData "DisplayName" "System.Taffybar.Information.X11DesktopInfo" "taffybar-4.1.0-inplace" 'False) (C1 ('MetaCons "DefaultDisplay" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DisplayName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

getX11Context :: DisplayName -> IO X11Context Source #

Builds a new X11Context containing a connection to the default X11 display and its root window.

If the X11 connection could not be opened, it will throw userError "openDisplay". This can occur if the X -maxclients limit has been exceeded.

withX11Context :: DisplayName -> X11Property a -> IO a Source #

Makes a connection to the default X11 display using getX11Context and puts the current display and root window objects inside a ReaderT transformer for further computation.

Properties

type X11Property a = X11PropertyT IO a Source #

IO actions with access to an X11Context.

Event loop

eventLoop :: (Event -> IO ()) -> X11Property () Source #

Spawn a new thread and listen inside it to all incoming events, invoking the given function to every event of type MapNotifyEvent that arrives, and subscribing to all events of this type emitted by newly created windows.

Context getters

getDisplay :: X11Property Display Source #

An X11Property that returns the Display object stored in the X11Context.

getAtom :: String -> X11Property Atom Source #

Return the Atom with the given name.

Basic properties of windows

fetch Source #

Arguments

:: Integral a 
=> PropertyFetcher a

Function to use to retrieve the property.

-> Maybe X11Window

Window to read from. Nothing means the root Window.

-> String

Name of the property to retrieve.

-> X11Property (Maybe [a]) 

Apply the given function to the given window in order to obtain the X11 property with the given name, or Nothing if no such property can be read.

readAsInt Source #

Arguments

:: Maybe X11Window

window to read from. Nothing means the root window.

-> String

name of the property to retrieve

-> X11Property Int 

Retrieve the property of the given window (or the root window, if Nothing) with the given name as a value of type Int. If that property hasn't been set, then return -1.

readAsListOfInt Source #

Arguments

:: Maybe X11Window

window to read from. Nothing means the root window.

-> String

name of the property to retrieve

-> X11Property [Int] 

Retrieve the property of the given window (or the root window, if Nothing) with the given name as a list of Ints. If that property hasn't been set, then return an empty list.

readAsListOfString Source #

Arguments

:: Maybe X11Window

window to read from. Nothing means the root window.

-> String

name of the property to retrieve

-> X11Property [String] 

Retrieve the property of the given window (or the root window, if Nothing) with the given name as a list of Strings. If the property hasn't been set, then return an empty list.

readAsListOfWindow Source #

Arguments

:: Maybe X11Window

window to read from. Nothing means the root window.

-> String

name of the property to retrieve

-> X11Property [X11Window] 

Retrieve the property of the given window (or the root window, if Nothing) with the given name as a list of X11 Window IDs. If the property hasn't been set, then return an empty list.

readAsString Source #

Arguments

:: Maybe X11Window

window to read from. Nothing means the root window.

-> String

name of the property to retrieve

-> X11Property String 

Retrieve the property of the given window (or the root window, if Nothing) with the given name as a String. If the property hasn't been set, then return an empty string.

Getters

isWindowUrgent :: X11Window -> X11Property Bool Source #

Determine whether the "urgent" flag is set in the WM_HINTS of the given window.

getPrimaryOutputNumber :: X11Property (Maybe Int) Source #

Get the index of the primary monitor as set and ordered by Xrandr.

getVisibleTags :: X11Property [String] Source #

Retrieve the value of the special _XMONAD_VISIBLE_WORKSPACES hint set by the pagerHints hook provided by xmonad-contrib (see module documentation for instructions on how to do this), or an empty list of strings if the pagerHints hook is not available.

Operations

doLowerWindow :: X11Window -> X11Property () Source #

Move the given X11Window to the bottom of the X11 window stack.

postX11RequestSyncProp :: X11Property a -> a -> X11Property a Source #

Post the provided X11Property to taffybar's dedicated X11 thread, and wait for the result. The provided default value will be returned in the case of an error.

sendCommandEvent :: Atom -> Atom -> X11Property () Source #

Emit a "command" event with one argument for the X server. This is used to send events that can be received by event hooks in the XMonad process and acted upon in that context.

sendWindowEvent :: Atom -> X11Window -> X11Property () Source #

Similar to sendCommandEvent, but with an argument of type X11Window.