| Copyright | (c) 2021 Tomáš Janoušek <tomi@nomi.cz> |
|---|---|
| License | BSD3 |
| Maintainer | Tomáš Janoušek <tomi@nomi.cz> |
| Safe Haskell | None |
| Language | Haskell2010 |
XMonad.Hooks.Rescreen
Contents
Description
Custom hooks for screen (xrandr) configuration changes.
Synopsis
- addAfterRescreenHook :: forall (l :: Type -> Type). X () -> XConfig l -> XConfig l
- addRandrChangeHook :: forall (l :: Type -> Type). X () -> XConfig l -> XConfig l
- data RescreenConfig = RescreenConfig {
- afterRescreenHook :: X ()
- randrChangeHook :: X ()
- rescreenHook :: forall (l :: Type -> Type). RescreenConfig -> XConfig l -> XConfig l
Usage
This module provides a replacement for the screen configuration change
handling in core that enables attaching custom hooks to screen (xrandr)
configuration change events. These can be used to restart/reposition status
bars or systrays automatically after xrandr
(dynamicSBs uses this module internally), as well
as to actually invoke xrandr or autorandr when an output is (dis)connected.
To use this, include the following in your xmonad.hs:
import XMonad.Hooks.Rescreen
define your custom hooks:
myAfterRescreenHook :: X () myAfterRescreenHook = spawn "fbsetroot -solid red"
myRandrChangeHook :: X () myRandrChangeHook = spawn "autorandr --change"
and hook them into your xmonad config:
main = xmonad $ …
. addAfterRescreenHook myAfterRescreenHook
. addRandrChangeHook myRandrChangeHook
. …
$ def{…}See documentation of rescreenHook for details about when these hooks are
called.
addAfterRescreenHook :: forall (l :: Type -> Type). X () -> XConfig l -> XConfig l #
Shortcut for rescreenHook.
addRandrChangeHook :: forall (l :: Type -> Type). X () -> XConfig l -> XConfig l #
Shortcut for rescreenHook.
data RescreenConfig #
Hook configuration for rescreenHook.
Constructors
| RescreenConfig | |
Fields
| |
Instances
| Default RescreenConfig # | |
Defined in XMonad.Hooks.Rescreen Methods def :: RescreenConfig # | |
| Monoid RescreenConfig # | |
Defined in XMonad.Hooks.Rescreen Methods mappend :: RescreenConfig -> RescreenConfig -> RescreenConfig # mconcat :: [RescreenConfig] -> RescreenConfig # | |
| Semigroup RescreenConfig # | |
Defined in XMonad.Hooks.Rescreen Methods (<>) :: RescreenConfig -> RescreenConfig -> RescreenConfig # sconcat :: NonEmpty RescreenConfig -> RescreenConfig # stimes :: Integral b => b -> RescreenConfig -> RescreenConfig # | |
rescreenHook :: forall (l :: Type -> Type). RescreenConfig -> XConfig l -> XConfig l #
Attach custom hooks to screen (xrandr) configuration change events. Replaces the built-in rescreen handling of xmonad core with:
- listen to
RRScreenChangeNotifyEventin addition toConfigureEventon the root window - whenever such event is received:
- clear any other similar events (Xorg server emits them in bunches)
- if any event was
ConfigureEvent,rescreenand invokeafterRescreenHook - if there was no
ConfigureEvent, invokerandrChangeHookonly
afterRescreenHook is useful for restarting/repositioning status bars and
systray.
randrChangeHook may be used to automatically trigger xrandr (or perhaps
autorandr) when outputs are (dis)connected.
Note that rescreenHook is safe to use several times, rescreen is still
done just once and hooks are invoked in sequence, also just once.