Skip to content

Instantly share code, notes, and snippets.

@KirinDave
Created November 9, 2011 22:59
Show Gist options
  • Save KirinDave/1353452 to your computer and use it in GitHub Desktop.
Save KirinDave/1353452 to your computer and use it in GitHub Desktop.
main = do
xmonad $ ewmh $ defaultConfig
{ manageHook = manageDocks <+>
manageHook defaultConfig <+>
-- ...
namedScratchpadManageHook sessionScratchpads
, layoutHook = avoidStruts $ smartBorders myLayoutHook
, logHook = dynamicLog >> updatePointer (Relative 0.1 0.05)
, modMask = modMaskKey
}
`additionalKeys`
[ ((modMaskKey, xK_p), spawn "exe=`dmenu_path | dmenu -b` && eval \"exec $exe\"")
, ((modMaskKey, xK_b), spawn "firefox -new-window")
, ((modMaskKey .|. shiftMask, xK_b), spawn "google-chrome --new-window")
, ((modMaskKey, xK_s), shellPrompt myPromptConfig)
, ((modMaskKey .|. shiftMask, xK_s), sshPrompt myPromptConfig)
, ((modMaskKey .|. shiftMask, xK_a), spBeckon "aws_console")]
-- Helpers
roleName :: Query String
roleName = stringProperty "WM_WINDOW_ROLE"
spBeckon :: String -> X ()
spBeckon = namedScratchpadAction sessionScratchpads
centeredFloat :: Rational -> Rational -> ManageHook
centeredFloat widthProportion heightProportion =
customFloating $ W.RationalRect l t widthProportion heightProportion
where t = (1 - heightProportion)/2
l = (1 - widthProportion)/2
-- Scratchpads
sessionScratchpads = [ NS "aws_console" spawnAWSConsole findAWSConsole manageAWSConsole ]
where
spawnAWSConsole = "google-chrome --app='https://console.aws.amazon.com/ec2/home'"
findAWSConsole = roleName =? "console.aws.amazon.com__ec2_home"
manageAWSConsole = centeredFloat 0.8 0.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment