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

Copyright | (c) Roman Cheplyaka
License | BSD-style (see LICENSE)
Maintainer | Roman Cheplyaka <roma@ro-che.info>
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell2010

XMonad.Layout.Monitor

Contents

- Usage
- Hints and issues
- TODO

Description

Layout modifier for displaying some window (monitor) above other windows.

Synopsis

- data Monitor a = Monitor {
  - prop :: Property
  - rect :: Rectangle
  - visible :: Bool
  - name :: String
  - persistent :: Bool
  - opacity :: Rational
  }
- monitor :: Monitor a
- data Property
  - = Title String
  - | ClassName String
  - | Resource String
  - | Role String
  - | Machine String
  - | And Property Property
  - | Or Property Property
  - | Not Property
  - | Const Bool
  - | Tagged String
- data MonitorMessage
  - = ToggleMonitor
  - | ShowMonitor
  - | HideMonitor
  - | ToggleMonitorNamed String
  - | ShowMonitorNamed String
  - | HideMonitorNamed String
- doHideIgnore :: ManageHook
- manageMonitor :: Monitor a -> ManageHook

# Usage

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

    import XMonad.Layout.Monitor

Define `Monitor` record. `monitor` can be used as a template. At least `prop` and `rect` should be set here. Also consider setting `persistent` to True.

Minimal example:

    myMonitor = monitor
        { prop = ClassName "SomeClass"
        , rect = Rectangle 0 0 40 20 -- rectangle 40x20 in upper left corner
        }

More interesting example:

    clock = monitor {
         -- Cairo-clock creates 2 windows with the same classname, thus also using title
         prop = ClassName "Cairo-clock" `And` Title "MacSlow's Cairo-Clock"
         -- rectangle 150x150 in lower right corner, assuming 1280x800 resolution
       , rect = Rectangle (1280-150) (800-150) 150 150
         -- avoid flickering
       , persistent = True
         -- make the window transparent
       , opacity = 0.6
         -- hide on start
       , visible = False
         -- assign it a name to be able to toggle it independently of others
       , name = "clock"
       }

Add ManageHook to de-manage monitor windows and apply opacity settings.

    manageHook = myManageHook <> manageMonitor clock

Apply layout modifier.

    myLayout = ModifiedLayout clock $ tall ||| Full ||| ...

After that, if there exists a window with specified properties, it will be displayed on top of all tiled (not floated) windows on specified position.

It's also useful to add some keybinding to toggle monitor visibility:

    , ((mod1Mask, xK_u     ), broadcastMessage ToggleMonitor >> refresh)

Screenshot: http://www.haskell.org/haskellwiki/Image:Xmonad-clock.png

# Hints and issues

- This module assumes that there is only one window satisfying property exists.
- If your monitor is available on all layouts, set `persistent` to `True` to avoid unnecessary flickering. You can still toggle monitor with a keybinding.
- You can use several monitors with nested modifiers. Give them names

data Monitor a #

Constructors

Monitor |
Fields prop :: Property property which uniquely identifies monitor window rect :: Rectangle specifies where to put monitor visible :: Bool is it visible by default? name :: String name of monitor (useful when we have many of them) persistent :: Bool is it shown on all layouts? opacity :: Rational opacity level

#### Instances

Instances details

LayoutModifier Monitor Window # |
Instance details Defined in XMonad.Layout.Monitor Methods modifyLayout :: LayoutClass l Window => Monitor Window -> Workspace WorkspaceId (l Window) Window -> Rectangle -> X ([(Window, Rectangle)], Maybe (l Window)) # modifyLayoutWithUpdate :: LayoutClass l Window => Monitor Window -> Workspace WorkspaceId (l Window) Window -> Rectangle -> X (([(Window, Rectangle)], Maybe (l Window)), Maybe (Monitor Window)) # handleMess :: Monitor Window -> SomeMessage -> X (Maybe (Monitor Window)) # handleMessOrMaybeModifyIt :: Monitor Window -> SomeMessage -> X (Maybe (Either (Monitor Window) SomeMessage)) # pureMess :: Monitor Window -> SomeMessage -> Maybe (Monitor Window) # redoLayout :: Monitor Window -> Rectangle -> Maybe (Stack Window) -> [(Window, Rectangle)] -> X ([(Window, Rectangle)], Maybe (Monitor Window)) # pureModifier :: Monitor Window -> Rectangle -> Maybe (Stack Window) -> [(Window, Rectangle)] -> ([(Window, Rectangle)], Maybe (Monitor Window)) # hook :: Monitor Window -> X () # unhook :: Monitor Window -> X () # modifierDescription :: Monitor Window -> String # modifyDescription :: LayoutClass l Window => Monitor Window -> l Window -> String #
Read (Monitor a) # |
Instance details Defined in XMonad.Layout.Monitor Methods readsPrec :: Int -> ReadS (Monitor a) # readList :: ReadS [Monitor a] # readPrec :: ReadPrec (Monitor a) # readListPrec :: ReadPrec [Monitor a] #
Show (Monitor a) # |
Instance details Defined in XMonad.Layout.Monitor Methods showsPrec :: Int -> Monitor a -> ShowS # show :: Monitor a -> String # showList :: [Monitor a] -> ShowS #

monitor :: Monitor a #

Template for `Monitor` record. At least `prop` and `rect` should be redefined. Default settings: `visible` is `True`, `persistent` is `False`.

data Property #

Most of the property constructors are quite self-explaining.

Constructors

Title String |
ClassName String |
Resource String |
Role String | WM_WINDOW_ROLE property
Machine String | WM_CLIENT_MACHINE property
And Property Property infixr 9 |
Or Property Property infixr 8 |
Not Property |
Const Bool |
Tagged String | Tagged via XMonad.Actions.TagWindows

#### Instances

Instances details

Read Property # |
Instance details Defined in XMonad.Util.WindowProperties Methods readsPrec :: Int -> ReadS Property # readList :: ReadS [Property] # readPrec :: ReadPrec Property # readListPrec :: ReadPrec [Property] #
Show Property # |
Instance details Defined in XMonad.Util.WindowProperties Methods showsPrec :: Int -> Property -> ShowS # show :: Property -> String # showList :: [Property] -> ShowS #
Predicate Property Window # |
Instance details Defined in XMonad.Layout.LayoutBuilder Methods alwaysTrue :: Proxy Window -> Property # checkPredicate :: Property -> Window -> X Bool #

data MonitorMessage #

Messages without names affect all monitors. Messages with names affect only monitors whose names match.

Constructors

ToggleMonitor |
ShowMonitor |
HideMonitor |
ToggleMonitorNamed String |
ShowMonitorNamed String |
HideMonitorNamed String |

#### Instances

Instances details

Read MonitorMessage # |
Instance details Defined in XMonad.Layout.Monitor Methods readsPrec :: Int -> ReadS MonitorMessage # readList :: ReadS [MonitorMessage] # readPrec :: ReadPrec MonitorMessage # readListPrec :: ReadPrec [MonitorMessage] #
Show MonitorMessage # |
Instance details Defined in XMonad.Layout.Monitor Methods showsPrec :: Int -> MonitorMessage -> ShowS # show :: MonitorMessage -> String # showList :: [MonitorMessage] -> ShowS #
Eq MonitorMessage # |
Instance details Defined in XMonad.Layout.Monitor Methods (==) :: MonitorMessage -> MonitorMessage -> Bool # (/=) :: MonitorMessage -> MonitorMessage -> Bool #
Message MonitorMessage # |
Instance details Defined in XMonad.Layout.Monitor

doHideIgnore :: ManageHook #

Hides window and ignores it.

manageMonitor :: Monitor a -> ManageHook #

ManageHook which demanages monitor window and applies opacity settings.

# TODO

- make Monitor remember the window it manages
- specify position relative to the screen