dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit f2881aa503472114139c0e2e910532b2f96fdb78
parent c9ccbe3a7630091e30801ea635225c9c14436bf6
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Mon,  6 Oct 2014 19:27:05 +0300

Placing definitions outside the main function

Diffstat:
M.xmonad/xmonad.hs | 55+++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 39 insertions(+), 16 deletions(-)

diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs @@ -1,21 +1,27 @@ module Main where + import XMonad import XMonad.Hooks.DynamicLog import XMonad.Hooks.ManageDocks -import XMonad.Util.Run(spawnPipe) -import XMonad.Util.EZConfig(additionalKeys) +import XMonad.Layout.LayoutModifier (ModifiedLayout) +import XMonad.Util.Run (spawnPipe) +import XMonad.Util.EZConfig (additionalKeys) import System.IO + myTerminal :: String myTerminal = "gnome-terminal" + myBorderWidth :: Int myBorderWidth = 2 + myModMask :: Modifier myModMask = mod4Mask + myWorkspaces :: [String] myWorkspaces = [ "web" @@ -29,6 +35,7 @@ myWorkspaces = , "system" ] + myManageHook :: ManageHook myManageHook = composeAll [ className =? "firefox" --> doShift "web" @@ -36,29 +43,45 @@ myManageHook = composeAll , className =? "pidgin" --> doShift "im" , className =? "keepassx" --> doShift "system" , manageDocks + , manageHook defaultConfig ] -main :: IO () -main = do - xmproc <- spawnPipe "/home/yuval/.cabal/bin/xmobar" + +myStartupHook :: MonadIO m => m () +myStartupHook = do spawn "setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,il" - xmonad $ defaultConfig - { manageHook = manageDocks <+> manageHook defaultConfig - , layoutHook = avoidStruts $ layoutHook defaultConfig - , logHook = dynamicLogWithPP xmobarPP + spawn "trayer" + + +myLayoutHook :: ModifiedLayout AvoidStruts (Choose Tall (Choose (Mirror Tall) Full)) Window +myLayoutHook = avoidStruts $ layoutHook defaultConfig + + +myLogHook :: Handle -> X () +myLogHook xmproc = + dynamicLogWithPP xmobarPP { ppOutput = hPutStrLn xmproc , ppTitle = xmobarColor "green" "" . shorten 50 } - , modMask = myModMask - , startupHook = startupFunc - } `additionalKeys` + + +myAdditionalKeys :: MonadIO m => [((KeyMask, KeySym), m ())] +myAdditionalKeys = [ ((mod4Mask .|. shiftMask, xK_z), spawn "xscreensaver-command -lock") , ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s") , ((0, xK_Print), spawn "scrot") -- , ((mod1Mask, xK_Escape), spawn "setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,il") ] -startupFunc :: MonadIO m => m () -startupFunc = do - spawn "setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,il" - spawn "trayer" + +main :: IO () +main = do + xmproc <- spawnPipe "/home/yuval/.cabal/bin/xmobar" + xmonad $ defaultConfig + { manageHook = myManageHook -- manageDocks <+> manageHook defaultConfig + , layoutHook = myLayoutHook + , logHook = myLogHook xmproc + , modMask = myModMask + , startupHook = myStartupHook + } `additionalKeys` + myAdditionalKeys