Attempt to react to screen event

This commit is contained in:
Martin Potier 2020-11-23 16:01:13 +02:00
parent 05ca473721
commit ebeb708303
No known key found for this signature in database
GPG key ID: D4DD957DBA4AD89E
2 changed files with 27 additions and 6 deletions

20
lib/ScreenEvents.hs Normal file
View file

@ -0,0 +1,20 @@
module ScreenEvents (
ScreenEvents.modify
) where
import XMonad
import Data.Monoid (All(..))
import Graphics.X11.Xlib.Extras (Event(RRScreenChangeNotifyEvent))
screenChangeHandler :: Event -> X All
screenChangeHandler (RRScreenChangeNotifyEvent _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) =
spawn "~/.fehbg" >> return (All True)
screenChangeHandler _ = return (All True)
modify :: XConfig l -> XConfig l
modify conf = conf
{ handleEventHook = mconcat
[ screenChangeHandler
, handleEventHook conf ] }

View file

@ -19,7 +19,6 @@ import XMonad.Layout.Spacing
import XMonad.Layout.ThreeColumns (ThreeCol(..))
import XMonad.Layout.ToggleLayouts (toggleLayouts)
import XMonad.Util.EZConfig
import qualified Solarized as S
@ -28,6 +27,7 @@ import KeyBindings as Keys (modify)
import MouseBindings as Mouse (modify)
import Projects (modify)
import Scratchpad (modify)
import ScreenEvents (modify)
-------------------- toggle btw vvvvvvvvvv or vvvvv
--layouts = titleBar $ toggleLayouts fullscreen tiled
@ -66,6 +66,7 @@ withConfig =
$ Keys.modify -- Apply keybindings config
$ Mouse.modify -- Apply mouse bindings config
$ Scratchpad.modify -- Apply scratchpad managehook config
$ ScreenEvents.modify -- Apply screen event hook config
$ desktopConfig -- on a default desktop config
{ manageHook = myManageHook <+> manageHook desktopConfig
, layoutHook = desktopLayoutModifiers layouts