Skip to content

Instantly share code, notes, and snippets.

@danbeam

danbeam/xmonad.hs

Last active Aug 29, 2015
Embed
What would you like to do?
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
myManageHook = composeAll
[ className =? "Gimp" --> doFloat
, className =? "Xmag" --> doFloat
]
main = do
xmproc <- spawnPipe "xmobar"
xmonad $ defaultConfig
{ manageHook = manageDocks <+> myManageHook
<+> manageHook defaultConfig
, layoutHook = avoidStruts $ layoutHook defaultConfig
, logHook = dynamicLogWithPP xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "green" "" . shorten 50
}
, terminal = "gnome-terminal"
} `additionalKeys`
-- hijack some gnome keyboard shortcuts
[ ((controlMask .|. mod1Mask, xK_l), spawn "gnome-screensaver-command --lock")
, ((controlMask .|. mod1Mask, xK_t), spawn "gnome-terminal")
-- volume up/down/mute (you see 2 everywhere because that's my active sound card, yours may be 0)
, ((0, 0x1008FF11), spawn "pactl set-sink-mute 2 0; pactl set-sink-volume 2 -- -3%")
, ((0, 0x1008FF12), spawn "muted=$(pactl list sinks | grep 'Mute' | tail -1 | awk '{print $2}'); if [ $muted == yes ]; then pactl set-sink-mute 2 0; else pactl set-sink-mute 2 1; fi")
, ((0, 0x1008FF13), spawn "pactl set-sink-mute 2 0; pactl set-sink-volume 2 -- +3%")
-- print screen (immediate or delayed over a selectable region)
, ((0, xK_Print), spawn "scrot")
, ((mod1Mask, xK_Print), spawn "sleep 0.2; scrot -s")
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment