dotfiles

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

xmonad.hs (2583B)


      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_p
     31     , xK_Return
     32     , xK_i
     33     , xK_z
     34     , xmonad
     35     , (.|.)
     36     , (<+>)
     37     )
     38 import           XMonad.Core                  (X, logHook)
     39 import           XMonad.Hooks.DynamicLog
     40     ( defaultPP
     41     , dynamicLogString
     42     , xmonadPropLog
     43     )
     44 import           XMonad.Hooks.EwmhDesktops    (ewmh, fullscreenEventHook)
     45 import           XMonad.Hooks.ManageDocks     (AvoidStruts, avoidStruts)
     46 import           XMonad.Layout.LayoutModifier (ModifiedLayout)
     47 import           XMonad.Util.EZConfig         (additionalKeys)
     48 
     49 myTerminal :: String
     50 myTerminal = "gnome-terminal"
     51 
     52 myBorderWidth :: Int
     53 myBorderWidth = 2
     54 
     55 myStartupHook :: MonadIO m => m ()
     56 myStartupHook = do
     57     spawn "~/bin/xmonadstartup"
     58 
     59 myLayoutHook :: ModifiedLayout AvoidStruts (Choose Tall (Choose (Mirror Tall) Full)) Window
     60 myLayoutHook = avoidStruts $ layoutHook defaultConfig
     61 
     62 myAdditionalKeys ::
     63     MonadIO m =>
     64     [((KeyMask, KeySym), m ())]
     65 myAdditionalKeys =
     66     [ ((mod4Mask .|. shiftMask, xK_z), spawn "xscreensaver-command -lock")
     67     , ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
     68     , ((mod4Mask, xK_p), spawn "dmenu_run")
     69     , ((0, xK_Print), spawn "scrot")
     70     -- , ((mod1Mask, xK_Escape), spawn "setxkbmap -option grp:alts_toggle us,il")
     71     -- , ((controlMask .|. shiftMask, xK_Return), spawn "xsel -b | festival --tts")
     72     , ((mod4Mask .|. shiftMask, xK_Return), spawn myTerminal)
     73     ]
     74 
     75 myHandleEventHook :: Graphics.X11.Xlib.Extras.Event -> XMonad.Core.X Data.Monoid.All
     76 myHandleEventHook = handleEventHook defaultConfig <+> fullscreenEventHook
     77 
     78 myLogHook :: X ()
     79 myLogHook = dynamicLogString defaultPP >>= xmonadPropLog
     80 
     81 main :: IO ()
     82 main = do
     83     dbus <- D.connectSession
     84     -- getWellKnownName dbus
     85     xmonad $ ewmh defaultConfig
     86       { handleEventHook = myHandleEventHook
     87       , layoutHook      = myLayoutHook
     88       , logHook         = myLogHook
     89       , modMask         = mod4Mask
     90       , startupHook     = myStartupHook
     91       } `additionalKeys` myAdditionalKeys