Copyright | (c) 2021 Tomáš Janoušek <tomi@nomi.cz> |
---|---|
License | BSD3 |
Maintainer | Tomáš Janoušek <tomi@nomi.cz> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Custom hooks for screen (xrandr) configuration changes.
Synopsis
- addAfterRescreenHook :: X () -> XConfig l -> XConfig l
- addRandrChangeHook :: X () -> XConfig l -> XConfig l
- setRescreenWorkspacesHook :: X () -> XConfig l -> XConfig l
- setRescreenDelay :: Int -> XConfig l -> XConfig l
- data RescreenConfig = RescreenConfig {
- afterRescreenHook :: X ()
- randrChangeHook :: X ()
- rescreenWorkspacesHook :: Last (X ())
- rescreenDelay :: Last Int
- rescreenHook :: 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 :: X () -> XConfig l -> XConfig l Source #
Shortcut for rescreenHook
.
addRandrChangeHook :: X () -> XConfig l -> XConfig l Source #
Shortcut for rescreenHook
.
setRescreenWorkspacesHook :: X () -> XConfig l -> XConfig l Source #
Shortcut for rescreenHook
.
setRescreenDelay :: Int -> XConfig l -> XConfig l Source #
Shortcut for rescreenHook
.
data RescreenConfig Source #
Hook configuration for rescreenHook
.
RescreenConfig | |
|
Instances
Monoid RescreenConfig Source # | |
Defined in XMonad.Hooks.Rescreen mappend :: RescreenConfig -> RescreenConfig -> RescreenConfig # mconcat :: [RescreenConfig] -> RescreenConfig # | |
Semigroup RescreenConfig Source # | |
Defined in XMonad.Hooks.Rescreen (<>) :: RescreenConfig -> RescreenConfig -> RescreenConfig # sconcat :: NonEmpty RescreenConfig -> RescreenConfig # stimes :: Integral b => b -> RescreenConfig -> RescreenConfig # | |
Default RescreenConfig Source # | |
Defined in XMonad.Hooks.Rescreen def :: RescreenConfig # |
rescreenHook :: RescreenConfig -> XConfig l -> XConfig l Source #
Attach custom hooks to screen (xrandr) configuration change events. Replaces the built-in rescreen handling of xmonad core with:
- listen to
RRScreenChangeNotifyEvent
in addition toConfigureEvent
on the root window - whenever such event is received:
- clear any other similar events (Xorg server emits them in bunches)
- if any event was
ConfigureEvent
,rescreen
and invokeafterRescreenHook
- if there was no
ConfigureEvent
, invokerandrChangeHook
only
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.
rescreenWorkspacesHook
allows tweaking the rescreen
implementation,
to change the order workspaces are assigned to physical screens for
example.
rescreenDelay
makes xmonad wait a bit for events to settle (after the
first event is received) — useful when multiple xrandr
invocations are
being used to change the screen layout.
Note that rescreenHook
is safe to use several times, rescreen
is still
done just once and hooks are invoked in sequence (except
rescreenWorkspacesHook
, which has a replace rather than sequence
semantics), also just once.