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.ThreeColumns (ThreeCol(..))
import XMonad.Layout.ToggleLayouts (toggleLayouts) import XMonad.Layout.ToggleLayouts (toggleLayouts)
import XMonad.Util.EZConfig import XMonad.Util.EZConfig
import qualified Solarized as S import qualified Solarized as S
@ -28,6 +27,7 @@ import KeyBindings as Keys (modify)
import MouseBindings as Mouse (modify) import MouseBindings as Mouse (modify)
import Projects (modify) import Projects (modify)
import Scratchpad (modify) import Scratchpad (modify)
import ScreenEvents (modify)
-------------------- toggle btw vvvvvvvvvv or vvvvv -------------------- toggle btw vvvvvvvvvv or vvvvv
--layouts = titleBar $ toggleLayouts fullscreen tiled --layouts = titleBar $ toggleLayouts fullscreen tiled
@ -62,11 +62,12 @@ myManageHook = composeOne
------------ build the full config ------------ build the full config
withConfig = withConfig =
Projects.modify -- Apply projects config Projects.modify -- Apply projects config
$ Keys.modify -- Apply keybindings config $ Keys.modify -- Apply keybindings config
$ Mouse.modify -- Apply mouse bindings config $ Mouse.modify -- Apply mouse bindings config
$ Scratchpad.modify -- Apply scratchpad managehook config $ Scratchpad.modify -- Apply scratchpad managehook config
$ desktopConfig -- on a default desktop config $ ScreenEvents.modify -- Apply screen event hook config
$ desktopConfig -- on a default desktop config
{ manageHook = myManageHook <+> manageHook desktopConfig { manageHook = myManageHook <+> manageHook desktopConfig
, layoutHook = desktopLayoutModifiers layouts , layoutHook = desktopLayoutModifiers layouts
, terminal = "nvidia-offload alacritty" , terminal = "nvidia-offload alacritty"