Refactor xmonad.hs, add avoidStruts

This commit is contained in:
Ivan Malison 2016-09-13 12:51:06 -07:00
parent f180fd9a6f
commit fc65a696e8
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -1,45 +1,42 @@
import System.IO
import XMonad
import XMonad.Actions.WindowBringer
import XMonad.Config()
import XMonad.Hooks.DynamicLog
import XMonad.Util.CustomKeys
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Util.EZConfig
import XMonad.Util.Run(spawnPipe)
import qualified Data.Map as M
startup :: X()
startup = do
spawn "stalonetray"
spawn "xscreensaver -no-splash"
spawn "feh --bg-scale /usr/share/backgrounds/gnome/Blinds.jpg"
spawn "copyq"
-- Use Super/Command/WinKey instead of Alt
myModMask :: KeyMask
myModMask = mod4Mask
main :: IO ()
main = do
xmproc <- spawnPipe "xmobar"
xmonad $ ewmh defaultConfig
{ modMask = mod4Mask -- Use Super instead of Alt
, keys = customKeys delkeys inskeys
xmonad $ ewmh def
{ modMask = myModMask
, terminal = "urxvt"
, layoutHook = avoidStruts $ layoutHook def
, logHook = dynamicLogWithPP xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "green" "" . shorten 50
}
, handleEventHook =
handleEventHook defaultConfig <+> fullscreenEventHook
, startupHook = startup
}
where
delkeys :: XConfig l -> [(KeyMask, KeySym)]
delkeys _ = [ ]
inskeys :: XConfig l -> [((KeyMask, KeySym), X ())]
inskeys conf@XConfig {XMonad.modMask = modm} =
[ ((modm, xK_p), spawn "rofi -show drun")
, ((modm, xK_g), spawn "rofi -show window")
, ((modm, xK_b), spawn "rofi -show run")
, handleEventHook = handleEventHook def <+> fullscreenEventHook
, startupHook = myStartup
} `additionalKeys`
[ ((myModMask, xK_p), spawn "rofi -show drun")
, ((myModMask, xK_g), spawn "rofi -show window")
-- TODO: Change this to bringing the window to the current workspace
, ((myModMask, xK_b), spawn "rofi -show run")
]
myStartup :: X()
myStartup = do
spawn "stalonetray"
spawn "xsetroot -solid black"
-- TODO: Figure out how to set different backgrounds for different x
-- monitors
-- spawn "feh --bg-scale /usr/share/backgrounds/gnome/Blinds.jpg"
spawn "copyq"