From 68b2b3b07dece4183e403311210ae844e4cd7b40 Mon Sep 17 00:00:00 2001 From: Magic_RB Date: Wed, 28 Jun 2023 21:51:03 +0200 Subject: [PATCH] Add xmonad keybinding to force fullscreen Signed-off-by: Magic_RB --- home-manager/modules/xmonad/xmonad.hs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/home-manager/modules/xmonad/xmonad.hs b/home-manager/modules/xmonad/xmonad.hs index 2db5419..2e382f0 100644 --- a/home-manager/modules/xmonad/xmonad.hs +++ b/home-manager/modules/xmonad/xmonad.hs @@ -11,8 +11,12 @@ -- Normally, you'd only override those defaults you care about. -- +{-# LANGUAGE BlockArguments +#-} + import XMonad import Data.Monoid +import Data.List (delete) import Data.Maybe import Data.Function import Data.Functor @@ -159,6 +163,23 @@ myKeymap c = , ("" , spawn "@toggle_touchpad@") , ("M-", spawn "@auxmenu@") + + , ("M-", withDisplay $ \dpy -> withFocused $ \win -> do + wmstate <- getAtom "_NET_WM_STATE" + fullsc <- getAtom "_NET_WM_STATE_FULLSCREEN" + wstate <- fromMaybe [] `fmap` getProp32 wmstate win + + let + ptype = 4 + chWstate f = io $ changeProperty32 dpy win wmstate ptype propModeReplace (f wstate) + isFull = fromIntegral fullsc `elem` wstate + + when (not isFull) $ do + chWstate (fromIntegral fullsc:) + windows $ W.float win $ W.RationalRect 0 0 1 1 + when isFull $ do + chWstate $ delete (fromIntegral fullsc) + windows $ W.sink win) ] ++