From b975c0a90dce97c8d96ab464d69575a9d8c150b3 Mon Sep 17 00:00:00 2001 From: azahi Date: Tue, 12 Jun 2018 22:59:58 +0300 Subject: Add X.Custom and split existing code in modules --- src/XMonad/Custom/Startup.hs | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/XMonad/Custom/Startup.hs (limited to 'src/XMonad/Custom/Startup.hs') diff --git a/src/XMonad/Custom/Startup.hs b/src/XMonad/Custom/Startup.hs new file mode 100644 index 0000000..b2765a0 --- /dev/null +++ b/src/XMonad/Custom/Startup.hs @@ -0,0 +1,47 @@ +module XMonad.Custom.Startup + ( startupHook' + ) where + +import Control.Monad +import Data.Maybe +import XMonad +import XMonad.Hooks.ManageDocks +import XMonad.Hooks.SetWMName +import XMonad.Util.Cursor +import XMonad.Util.SpawnNamedPipe + +atomsToFullscreen :: [String] +atomsToFullscreen = + [ "_NET_ACTIVE_WINDOW" + , "_NET_CLIENT_LIST" + , "_NET_CLIENT_LIST_STACKING" + , "_NET_DESKTOP_NAMES" + , "_NET_WM_DESKTOP" + , "_NET_WM_STATE" + , "_NET_WM_STATE_FULLSCREEN" + , "_NET_WM_STATE_HIDDEN" + , "_NET_WM_STRUT" + ] + +addNETSupported :: Atom -> X () +addNETSupported x = withDisplay $ \d -> do + r <- asks theRoot + ns <- getAtom "_NET_SUPPORTED" + a <- getAtom "ATOM" + liftIO $ do + s <- (join . maybeToList) <$> getWindowProperty32 d ns r + when (fromIntegral x `notElem` s) $ changeProperty32 d r ns a propModeAppend [fromIntegral x] + +addEWMHFullscreen :: X () +addEWMHFullscreen = do + s <- mapM getAtom atomsToFullscreen + mapM_ addNETSupported s + +startupHook' :: X () +startupHook' = do + spawnNamedPipe "/usr/bin/xmobar ~/.xmonad/xmobarrcTop.hs" "xmobarTop" + spawnNamedPipe "/usr/bin/xmobar ~/.xmonad/xmobarrcBot.hs" "xmobarBot" + docksStartupHook + addEWMHFullscreen + setDefaultCursor xC_left_ptr + setWMName "xmonad" -- cgit 1.4.1