Add fullscreen fix for chromium to xmonad

This commit is contained in:
Leon Kowarschick 2020-06-26 20:38:19 +02:00
parent f4139b8f39
commit 1ef9e7d27c
2 changed files with 24 additions and 0 deletions

View file

@ -7,6 +7,8 @@ font = Terminus (TTF) 12
;font = jetbrains mono Nerd Font 12 ;font = jetbrains mono Nerd Font 12
;font = monospace 13 ;font = monospace 13
dynamic_title = false
[colors] [colors]
# hard contrast: background = #1d2021 # hard contrast: background = #1d2021
background = rgba(40, 40, 40, 1) background = rgba(40, 40, 40, 1)

View file

@ -511,6 +511,7 @@ main = do
, handleEventHook = mconcat [ mySwallowEventHook , handleEventHook = mconcat [ mySwallowEventHook
, activateWindowEventHook , activateWindowEventHook
, handleEventHook Desktop.desktopConfig , handleEventHook Desktop.desktopConfig
, fullscreenFixEventHook
, Ewmh.ewmhDesktopsEventHook , Ewmh.ewmhDesktopsEventHook
] ]
--, handleEventHook = minimizeEventHook <+> handleEventHook def <+> hintsEventHook -- <+> Ewmh.fullscreenEventHook --, handleEventHook = minimizeEventHook <+> handleEventHook def <+> hintsEventHook -- <+> Ewmh.fullscreenEventHook
@ -548,6 +549,27 @@ activateWindowEventHook _ = return $ All True
-- | Fixes fullscreen behaviour of chromium based apps by quickly applying and undoing a resize.
-- This causes chromium to recalculate the fullscreen window
-- dimensions to match the actual "windowed fullscreen" dimensions.
fullscreenFixEventHook :: Event -> X All
fullscreenFixEventHook (ClientMessageEvent _ _ _ dpy win typ (_:dats)) = do
wmstate <- getAtom "_NET_WM_STATE"
fullscreen <- getAtom "_NET_WM_STATE_FULLSCREEN"
when (typ == wmstate && fromIntegral fullscreen `elem` dats) $ do
withWindowAttributes dpy win $ \attrs ->
liftIO $ resizeWindow dpy win (fromIntegral $ wa_width attrs - 1) (fromIntegral $ wa_height attrs)
withWindowAttributes dpy win $ \attrs ->
liftIO $ resizeWindow dpy win (fromIntegral $ wa_width attrs + 1) (fromIntegral $ wa_height attrs)
return $ All True
fullscreenFixEventHook _ = return $ All True
-- POLYBAR Kram -------------------------------------- {{{ -- POLYBAR Kram -------------------------------------- {{{
-- | Loghook for polybar on a given monitor. -- | Loghook for polybar on a given monitor.