Create a gist now

Instantly share code, notes, and snippets.

My xmonad configuration
import XMonad
import XMonad.Actions.CycleWS -- cycle thru WS', toggle last WS
import XMonad.Hooks.DynamicLog -- statusbar
import XMonad.Hooks.ManageDocks -- dock/tray mgmt
import XMonad.Util.EZConfig -- append key/mouse bindings
import XMonad.Util.Run(spawnPipe) -- spawnPipe and hPutStrLn
import System.IO
import XMonad.Actions.SpawnOn
lowerVolume = "<XF86AudioLowerVolume>"
lowerVolumeCMD = "amixer -c 0 set Master 1-"
raiseVolume = "<XF86AudioRaiseVolume>"
raiseVolumeCMD = "amixer -c 0 set Master 1+ unmute"
muteVolume = "<XF86AudioMute>"
muteVolumeCMD = "amixer -c 0 set Master 1- mute"
myLogHook dest = dynamicLogWithPP defaultPP { ppOutput = hPutStrLn dest
,ppVisible = wrap "(" ")"
}
myManageHook = composeAll
[ className =? "Firefox" --> doShift "2"
, className =? "Opera" --> doShift "3"
, className =? "Thunderbird" --> doShift "4"
, className =? "Remmina" --> doShift "5"
, className =? "Xchat" --> doShift "6"
]
myKeys = [ ("M-b" , sendMessage ToggleStruts ) -- toggle the status bar gap
, ("M-<Right>" , nextWS ) -- go to next workspace
, ("M-<Left>" , prevWS ) -- go to prev workspace
, ("M-p" , spawn "gmrun" ) -- app launcher
, ("M-r" , spawn "xmonad --restart" ) -- restart xmonad w/o recompiling
, ("M-f" , spawn "firefox" ) -- launch firefox
, ("M-g" , spawn "google-chrome" ) -- launch chrome
, ("M-e" , spawn "thunderbird" ) -- launch thunderbird
, ("M-v" , spawn "remmina" ) -- launch remmina
, ("M-x" , spawn "xchat" ) -- launch xchat
, ("M-o" , spawn "opera" ) -- launch opera
, ("C-M-x" , spawn "xlock" ) -- lockdown
, ("M-s" , spawn "sudo /usr/sbin/pm-suspend" ) -- suspend
, ("C-M-h" , spawn "sudo /usr/sbin/pm-hibernate") -- hibernate
, ("C-M-r" , spawn "sudo /sbin/shutdown -r now" ) -- reboot
, ("C-M-s" , spawn "sudo /sbin/shutdown -h now" ) -- halt
, ("<Print>" , spawn "ksnapshot" ) -- screenshot
, (raiseVolume , spawn raiseVolumeCMD ) -- raise volume
, (lowerVolume , spawn lowerVolumeCMD ) -- lower volume
, (muteVolume , spawn muteVolumeCMD ) -- mute volume
]
myConfig xmproc = defaultConfig
{ manageHook = myManageHook
<+> manageDocks
<+> manageHook defaultConfig
, layoutHook = avoidStruts $ layoutHook defaultConfig
, terminal = "konsole"
, focusFollowsMouse = True
, logHook = myLogHook xmproc
, modMask = mod4Mask -- Rebind Mod to the Windows key
, startupHook = return () >> checkKeymap (myConfig xmproc) myKeys
}
`additionalKeysP` myKeys
main = do
xmproc <- spawnPipe "/usr/bin/xmobar /home/thomas/.xmobarrc"
xmonad $ myConfig xmproc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment