xmonad-contrib-0.17.1: Community-maintained extensions for xmonad
Copyright(c) Brandon S Allbery Brent Yorgey
LicenseBSD-style (see LICENSE)
Maintainer<allbery.b@gmail.com>
Stabilityunstable
Portabilityunportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

XMonad.Layout.OnHost

Contents

Description

Configure layouts on a per-host basis: use layouts and apply layout modifiers selectively, depending on the host. Heavily based on XMonad.Layout.PerWorkspace by Brent Yorgey.

Synopsis

Usage

You can use this module by importing it into your ~/.xmonad/xmonad.hs file:

import XMonad.Layout.OnHost

and modifying your layoutHook as follows (for example):

layoutHook = modHost "baz" m1 $            -- apply layout modifier m1 to all layouts on host "baz"
             onHost "foo" l1 $             -- layout l1 will be used on host "foo".
             onHosts ["bar","quux"] l2 $   -- layout l2 will be used on hosts "bar" and "quux".
             l3                            -- layout l3 will be used on all other hosts.

Note that l1, l2, and l3 can be arbitrarily complicated layouts, e.g. (Full ||| smartBorders $ tabbed shrinkText def ||| ...), and m1 can be any layout modifier, i.e. a function of type (l a -> ModifiedLayout lm l a).

In another scenario, suppose you wanted to have layouts A, B, and C available on all hosts, except that on host foo you want layout D instead of C. You could do that as follows:

layoutHook = A ||| B ||| onHost "foo" D C

Note that we rely on '$HOST' being set in the environment, as is true on most modern systems; if it's not, you may want to use a wrapper around xmonad or perhaps use setEnv (or putEnv) to set it in main. This is to avoid dragging in the network package as an xmonad dependency. If '$HOST' is not defined, it will behave as if the host name never matches.

Also note that '$HOST' is usually a fully qualified domain name, not a short name. If you use a short name, this code will try to truncate $HOST to match; this may prove too magical, though, and may change in the future.

data OnHost l1 l2 a Source #

Structure for representing a host-specific layout along with a layout for all other hosts. We store the names of hosts to be matched, and the two layouts. We save the layout choice in the Bool, to be used to implement description.

Instances

Instances details
(LayoutClass l1 a, LayoutClass l2 a, Show a) => LayoutClass (OnHost l1 l2) a Source # 
Instance details

Defined in XMonad.Layout.OnHost

Methods

runLayout :: Workspace WorkspaceId (OnHost l1 l2 a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (OnHost l1 l2 a)) #

doLayout :: OnHost l1 l2 a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (OnHost l1 l2 a)) #

pureLayout :: OnHost l1 l2 a -> Rectangle -> Stack a -> [(a, Rectangle)] #

emptyLayout :: OnHost l1 l2 a -> Rectangle -> X ([(a, Rectangle)], Maybe (OnHost l1 l2 a)) #

handleMessage :: OnHost l1 l2 a -> SomeMessage -> X (Maybe (OnHost l1 l2 a)) #

pureMessage :: OnHost l1 l2 a -> SomeMessage -> Maybe (OnHost l1 l2 a) #

description :: OnHost l1 l2 a -> String #

(Read (l1 a), Read (l2 a)) => Read (OnHost l1 l2 a) Source # 
Instance details

Defined in XMonad.Layout.OnHost

Methods

readsPrec :: Int -> ReadS (OnHost l1 l2 a) #

readList :: ReadS [OnHost l1 l2 a] #

readPrec :: ReadPrec (OnHost l1 l2 a) #

readListPrec :: ReadPrec [OnHost l1 l2 a] #

(Show (l1 a), Show (l2 a)) => Show (OnHost l1 l2 a) Source # 
Instance details

Defined in XMonad.Layout.OnHost

Methods

showsPrec :: Int -> OnHost l1 l2 a -> ShowS #

show :: OnHost l1 l2 a -> String #

showList :: [OnHost l1 l2 a] -> ShowS #

onHost Source #

Arguments

:: (LayoutClass l1 a, LayoutClass l2 a) 
=> String

the name of the host to match

-> l1 a

layout to use on the matched host

-> l2 a

layout to use everywhere else

-> OnHost l1 l2 a 

Specify one layout to use on a particular host, and another to use on all others. The second layout can be another call to onHost, and so on.

onHosts Source #

Arguments

:: (LayoutClass l1 a, LayoutClass l2 a) 
=> [String]

names of hosts to match

-> l1 a

layout to use on matched hosts

-> l2 a

layout to use everywhere else

-> OnHost l1 l2 a 

Specify one layout to use on a particular set of hosts, and another to use on all other hosts.

modHost Source #

Arguments

:: LayoutClass l a 
=> String

name of the host to match

-> (l a -> ModifiedLayout lm l a)

the modifier to apply on the matching host

-> l a

the base layout

-> OnHost (ModifiedLayout lm l) l a 

Specify a layout modifier to apply on a particular host; layouts on all other hosts will remain unmodified.

modHosts Source #

Arguments

:: LayoutClass l a 
=> [String]

names of the hosts to match

-> (l a -> ModifiedLayout lm l a)

the modifier to apply on the matching hosts

-> l a

the base layout

-> OnHost (ModifiedLayout lm l) l a 

Specify a layout modifier to apply on a particular set of hosts; layouts on all other hosts will remain unmodified.