dotfiles

A steaming hot pile of sh...ell scripts and configuration files.
git clone https://kaka.farm/~git/dotfiles
Log | Files | Refs

xmonad.hs (3095B)


      1 module Main where
      2 
      3 import           Data.Monoid                  (All)
      4 import qualified DBus                         as D
      5 import qualified DBus.Client                  as D
      6 import           Graphics.X11.Xlib.Extras     (Event)
      7 import           XMonad
      8     ( Choose
      9     , Full
     10     , KeyMask (..)
     11     , KeySym (..)
     12     , Mirror
     13     , Modifier (..)
     14     , MonadIO (..)
     15     , Tall
     16     , Window
     17     , controlMask
     18     , defaultConfig
     19     , handleEventHook
     20     , layoutHook
     21     , mod1Mask
     22     , mod2Mask
     23     , mod3Mask
     24     , mod4Mask
     25     , modMask
     26     , shiftMask
     27     , spawn
     28     , startupHook
     29     , xK_Print
     30     , xK_Return
     31     , xK_i
     32     , xK_z
     33     , xmonad
     34     , (.|.)
     35     , (<+>)
     36     )
     37 import           XMonad.Core                  (X, logHook)
     38 import           XMonad.Hooks.DynamicLog
     39     ( defaultPP
     40     , dynamicLogString
     41     , xmonadPropLog
     42     )
     43 import           XMonad.Hooks.EwmhDesktops    (ewmh, fullscreenEventHook)
     44 import           XMonad.Hooks.ManageDocks     (AvoidStruts, avoidStruts)
     45 import           XMonad.Layout.LayoutModifier (ModifiedLayout)
     46 import           XMonad.Util.EZConfig         (additionalKeys)
     47 
     48 myTerminal :: String
     49 myTerminal = "mlterm"
     50 
     51 myBorderWidth :: Int
     52 myBorderWidth = 2
     53 
     54 myModMask :: Modifier
     55 myModMask = mod4Mask
     56 
     57 -- Use this to start everything considered cheap.
     58 myStartupHook :: MonadIO m => m ()
     59 myStartupHook = do
     60     spawn "sleep 2; redshift -O 3500"
     61     spawn "keynav"
     62     spawn "setxkbmap -option grp:switch,grp:alt_shift_toggle us,il"
     63     spawn "xmobar"
     64 
     65 -- Use this to start everything considered costly.
     66 -- Recommended to be bound to a key combination instead of `startupHook`.
     67 startupMyStuff :: MonadIO m => m ()
     68 startupMyStuff = do
     69     myStartupHook
     70     spawn "trayer"
     71     spawn "keynav"
     72     spawn "xfce4-power-manager"
     73 
     74 myLayoutHook :: ModifiedLayout AvoidStruts (Choose Tall (Choose (Mirror Tall) Full)) Window
     75 myLayoutHook = avoidStruts $ layoutHook defaultConfig
     76 
     77 myAdditionalKeys ::
     78     MonadIO m =>
     79     [((KeyMask, KeySym), m ())]
     80 myAdditionalKeys =
     81     [ ((mod4Mask .|. shiftMask, xK_z), spawn "xscreensaver-command -lock")
     82     , ((mod4Mask .|. shiftMask, xK_i), startupMyStuff)
     83     , ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
     84     , ((0, xK_Print), spawn "scrot")
     85     -- , ((mod1Mask, xK_Escape), spawn "setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,il")
     86     -- , ((controlMask .|. shiftMask, xK_Return), spawn "xsel -b | festival --tts")
     87     , ((mod4Mask .|. shiftMask, xK_Return), spawn myTerminal)
     88     ]
     89 
     90 myHandleEventHook :: Graphics.X11.Xlib.Extras.Event -> XMonad.Core.X Data.Monoid.All
     91 myHandleEventHook = handleEventHook defaultConfig <+> fullscreenEventHook
     92 
     93 myLogHook :: X ()
     94 myLogHook = dynamicLogString defaultPP >>= xmonadPropLog
     95 
     96 main :: IO ()
     97 main = do
     98     dbus <- D.connectSession
     99     -- getWellKnownName dbus
    100     xmonad $ ewmh defaultConfig
    101         { handleEventHook = myHandleEventHook
    102         , layoutHook      = myLayoutHook
    103         , logHook         = myLogHook
    104         , modMask         = myModMask
    105         , startupHook     = myStartupHook
    106         } `additionalKeys` myAdditionalKeys