xmonad-contrib-0.16: Third party extensions for xmonad

Copyright | (c) Anton Vorontsov <anton@enomsg.org> 2014
License | BSD-style (as xmonad)
Maintainer | Anton Vorontsov <anton@enomsg.org>
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell98

XMonad.Layout.Stoppable

Description

This module implements a special kind of layout modifier, which when applied to a layout, causes xmonad to stop all non-visible processes. In a way, this is a sledge-hammer for applications that drain power. For example, given a web browser on a stoppable workspace, once the workspace is hidden the web browser will be stopped.

Note that the stopped application won't be able to communicate with X11 clipboard. For this, the module actually stops applications after a certain delay, giving a chance for a user to complete copy-paste sequence. By default, the delay equals to 15 seconds, it is configurable via `Stoppable` constructor.

The stoppable modifier prepends a mark (by default equals to "Stoppable") to the layout description (alternatively, you can choose your own mark and use it with `Stoppable` constructor). The stoppable layout (identified by a mark) spans to multiple workspaces, letting you to create groups of stoppable workspaces that only stop processes when none of the workspaces are visible, and conversely, unfreezing all processes even if one of the stoppable workspaces are visible.

To stop the process we use signals, which works for most cases. For processes that tinker with signal handling (debuggers), another (Linux-centric) approach may be used. See https://www.kernel.org/doc/Documentation/cgroups/freezer-subsystem.txt

- Note This module doesn't work on programs that do fancy things with processes (such as Chromium) and programs that do not set _NET_WM_PID.

Synopsis

- data Stoppable a = Stoppable {
  - mark :: String
  - delay :: Rational
  - timer :: Maybe TimerId
  }
- stoppable :: l a -> ModifiedLayout Stoppable l a

# Documentation

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

    import XMonad
    import XMonad.Layout.Stoppable

    main = xmonad def
       { layoutHook = layoutHook def ||| stoppable (layoutHook def) }

Note that the module has to distinguish between local and remote proccesses, which means that it needs to know the hostname, so it looks for environment variables (e.g. HOST).

Environment variables will work for most cases, but won't work if the hostname changes. To cover dynamic hostnames case, in addition to layoutHook you have to provide manageHook from XMonad.Util.RemoteWindows module.

For more detailed instructions on editing the layoutHook see:

XMonad.Doc.Extending

data Stoppable a Source #

Data type for ModifiedLayout. The constructor lets you to specify a custom mark/description modifier and a delay. You can also use `stoppable` helper function.

Constructors

Stoppable |

Fields

- mark :: String
- delay :: Rational
- timer :: Maybe TimerId

#### Instances

Instances details

LayoutModifier Stoppable Window Source # |

Instance details

Defined in XMonad.Layout.Stoppable

Methods

modifyLayout :: LayoutClass l Window => Stoppable Window -> Workspace WorkspaceId (l Window) Window -> Rectangle -> X ([(Window, Rectangle)], Maybe (l Window)) Source #

modifyLayoutWithUpdate :: LayoutClass l Window => Stoppable Window -> Workspace WorkspaceId (l Window) Window -> Rectangle -> X (([(Window, Rectangle)], Maybe (l Window)), Maybe (Stoppable Window)) Source #

handleMess :: Stoppable Window -> SomeMessage -> X (Maybe (Stoppable Window)) Source #

handleMessOrMaybeModifyIt :: Stoppable Window -> SomeMessage -> X (Maybe (Either (Stoppable Window) SomeMessage)) Source #

pureMess :: Stoppable Window -> SomeMessage -> Maybe (Stoppable Window) Source #

redoLayout :: Stoppable Window -> Rectangle -> Maybe (Stack Window) -> [(Window, Rectangle)] -> X ([(Window, Rectangle)], Maybe (Stoppable Window)) Source #

pureModifier :: Stoppable Window -> Rectangle -> Maybe (Stack Window) -> [(Window, Rectangle)] -> ([(Window, Rectangle)], Maybe (Stoppable Window)) Source #

hook :: Stoppable Window -> X () Source #

unhook :: Stoppable Window -> X () Source #

modifierDescription :: Stoppable Window -> String Source #

modifyDescription :: LayoutClass l Window => Stoppable Window -> l Window -> String Source #

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

stoppable :: l a -> ModifiedLayout Stoppable l a Source #

Convert a layout to a stoppable layout using the default mark ("Stoppable") and a delay of 15 seconds.