about summary refs log tree commit diff
path: root/dotfiles/xmonad.hs
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2022-07-07 11:46:40 +0200
committerBaitinq <manuelpalenzuelamerino@gmail.com>2022-07-07 11:46:40 +0200
commit51526384bc213eebbf11b4a61aaa0305d575ef61 (patch)
treec063fa7576f268297a387e128fbd57e64caa3296 /dotfiles/xmonad.hs
parentXMonad: Change window borders to be like dwm (diff)
downloadnixos-config-51526384bc213eebbf11b4a61aaa0305d575ef61.tar.gz
nixos-config-51526384bc213eebbf11b4a61aaa0305d575ef61.tar.bz2
nixos-config-51526384bc213eebbf11b4a61aaa0305d575ef61.zip
XMonad: Code cleanup
Diffstat (limited to '')
-rw-r--r--dotfiles/xmonad.hs20
1 files changed, 12 insertions, 8 deletions
diff --git a/dotfiles/xmonad.hs b/dotfiles/xmonad.hs
index 9b9972b..d8174b1 100644
--- a/dotfiles/xmonad.hs
+++ b/dotfiles/xmonad.hs
@@ -106,8 +106,11 @@ myBorderWidth = 2
 myNormalBorderColor :: String
 myNormalBorderColor = "#444444"
 
-myFocusedBorderColor :: String
-myFocusedBorderColor = "#005577"
+backgroundColor :: String
+backgroundColor = "#005577"
+
+foregroundColor :: String
+foregroundColor = "#bbbbbb"
 
 --This sets the "_NET_WM_STATE_FULLSCREEN" window property, helping some programs such as firefox to adjust acoordingly to fullscreen mode
 --In a perfect world we shouldnt need to do this manually but it seems like ewmhFullscreen/others dont implement this functionality
@@ -115,9 +118,10 @@ setFullscreenProp :: Bool -> Window -> X ()
 setFullscreenProp b win = withDisplay $ \dpy -> do
                       state  <- getAtom "_NET_WM_STATE"
                       fullsc <- getAtom "_NET_WM_STATE_FULLSCREEN"
+                      let replaceWMStateProperty = changeProperty32 dpy win state 4 propModeReplace
                       if b
-                        then io $ changeProperty32 dpy win state 4 propModeReplace [fromIntegral fullsc]
-                        else io $ changeProperty32 dpy win state 4 propModeReplace []
+                        then io $ replaceWMStateProperty [fromIntegral fullsc]
+                        else io $ replaceWMStateProperty []
 
 --Hide xmobar -> Hide borders -> Set fullscreen -> Set fullscreenprops
 toggleFullScreen :: X ()
@@ -212,12 +216,12 @@ myStatusBar = statusBarProp "xmobar" (do
                                         numWindows <- getNumberOfWindowsInWorkpace
                                         return $ xmobarPP {
                                                     ppCurrent = if numWindows > 0
-                                                                        then xmobarBorder "Top" "#bbbbbb" 4 . xmobarColor "#bbbbbb" "#005577" . wrap "  " "  "
-                                                                        else xmobarColor "#bbbbbb" "#005577" . wrap "  " "  "
+                                                                        then xmobarBorder "Top" foregroundColor 4 . xmobarColor foregroundColor backgroundColor . wrap "  " "  "
+                                                                        else xmobarColor foregroundColor backgroundColor . wrap "  " "  "
                                                   , ppTitle = id
                                                   , ppSep = " |  "
                                                   , ppLayout = (\_ -> "")
-                                                  , ppHidden = (\s -> clickableWrap ((read s::Int) - 1) (createDwmBox "#bbbbbb" ("  " ++ s ++ "  "))) --better way to clickablewrap . 
+                                                  , ppHidden = (\s -> clickableWrap ((read s::Int) - 1) (createDwmBox foregroundColor ("  " ++ s ++ "  "))) --better way to clickablewrap . 
                                                   , ppHiddenNoWindows = (\s -> clickableWrap ((read s::Int) - 1) ("  " ++ s ++ "  "))
                                           }
                                       )
@@ -233,7 +237,7 @@ main = do
                 borderWidth        = myBorderWidth,
                 workspaces         = myWorkspaces,
                 normalBorderColor  = myNormalBorderColor,
-                focusedBorderColor = myFocusedBorderColor,
+                focusedBorderColor = backgroundColor,
 
                 mouseBindings      = myMouseBindings,