Last active
May 13, 2016 13:40
-
-
Save davama/8ec019c5ea19f1f857f37ad140abbf41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------------------------------------------------------------------------------------ | |
-- Imports -- | |
------------------------------------------------------------------------------------------------------------------------------------------ | |
-- ALL MY IMPORTS | |
-- much redacted code | |
-- working hook which does nothing for now | |
myCaseHook :: String -> X () | |
myCaseHook hostname = case hostname of | |
"ARCHLAP" -> return () | |
_ -> return () | |
-- _ -> do { spawnHere myTerminal ; | |
-- -- do something else | |
-- } | |
------------------------------------------------------------------------------------------------------------------------------------------ | |
-- Default Config structure -- | |
------------------------------------------------------------------------------------------------------------------------------------------ | |
defaults hostname = defaultConfig { | |
-- simple stuff | |
terminal = myTerminal | |
, focusFollowsMouse = myFocusFollowsMouse | |
, clickJustFocuses = myClickJustFocuses | |
, borderWidth = myBorderWidth | |
, modMask = myModMask | |
, workspaces = myWorkspaces | |
, normalBorderColor = myNormalBorderColor | |
, focusedBorderColor = myFocusedBorderColor | |
-- key bindings | |
, keys = myKeys hostname | |
, mouseBindings = myMouseBindings | |
-- hooks, layouts | |
-- , layoutHook = smartBorders (myShowWName myLayoutHook) | |
, layoutHook = smartBorders (myLayoutHook) | |
, manageHook = myManageHook | |
, handleEventHook = myEventHook | |
, startupHook = myStartupHook | |
} | |
main = do | |
hostname <- fmap nodeName getSystemID | |
xmproc <- spawnPipe myDzenStatus -- Dzenbar | |
xmonad $ withUrgencyHookC LibNotifyUrgencyHook myUrgencyConfig | |
$ (defaults hostname) { | |
manageHook = composeAll [ | |
manageDocks | |
, manageSpawn | |
, myManageHook | |
, namedScratchpadManageHook myScratchPads | |
] | |
, startupHook = composeAll [ | |
myStartupHook | |
, setWMName "Xmonad" | |
, myCaseHook hostname | |
, myDzenStartup -- Dzenbar | |
] | |
, logHook = composeAll [ | |
myFadeHook | |
, ewmhDesktopsLogHook -- gives focus to google-chrome, not steal focus | |
, myDzenLogHook xmproc -- Dzenbar | |
] | |
>> updatePointer (0.5, 0.5) (0, 0) -- moves pointer to center of focused window xmonad-12 darcs | |
} | |
myModMask = mod4Mask | |
myKeys hostname conf@(XConfig {XMonad.modMask = mod}) = M.fromList $ | |
[ | |
((mod .|. shiftMask, xK_Return), spawn "xterm") | |
-- MORE KEYBINDINGS | |
-- | |
-- | |
, ((0, 0x1008FF17), spawn myMpdNext) | |
, ((0, 0x1008FF15), spawn myMpdStop) | |
, ((0, 0x1008FF2C), spawn "eject -T") | |
, ((0, xK_Print), spawn myScreenshot) | |
, ((0, xK_Insert), pasteSelection) -- uses getSelection from XMonad.Util.XSelection and so is heir to its flaws | |
, ((0, xK_Scroll_Lock), namedScratchpadAction myScratchPads "scratchterm") | |
, ((shiftMask, xK_Insert), spawn "xdotool click 2") -- paste x primary, simulates middle click | |
, (((mod .|. controlMask .|. shiftMask), xK_Print), submap . M.fromList $ | |
[ --- sort of finiky. had to run command in reverse twice | |
((0, xK_a), spawn "xrandr --auto --output $(cat /tmp/second) --primary --right-of $(cat /tmp/first); xrandr --auto --output $(cat /tmp/first) --primary --left-of $(cat /tmp/second)") -- my dual mornitor on | |
, ((0, xK_p), spawn "xrandr --output $(cat /tmp/first) --off") -- my primary mornitor off | |
, ((0, xK_s), spawn "xrandr --output $(cat /tmp/second) --off") -- my secondary moritor off | |
]) | |
, (((mod1Mask .|. controlMask ), xK_Delete), submap . M.fromList $ -- requires sudo priveledges. see arch wiki "allow users to shutdown" | |
[ | |
((0, xK_s), spawn myXscreenLock) -- screensaver lock | |
, ((0, xK_q), spawn (myMsg ++ " q") >> io (exitWith ExitSuccess)) -- logout | |
, ((0, xK_r), spawn "sudo systemctl reboot") -- reboot system | |
, ((0, xK_p), spawn "sudo systemctl poweroff") -- poweroff system | |
]) | |
] ++ | |
(case hostname of | |
"ARCH" -> [ | |
((mod .|. controlMask, xK_KP_End), spawn (myTerminal ++ " -p AMER-L")) -- myself | |
, ((mod .|. controlMask, xK_2), spawn (myTerminal ++ " -p EMEA-L")) -- myself | |
] | |
_ -> [ | |
((mod .|. controlMask, xK_KP_End), spawn (myTerminal ++ " -p AMER")) -- myself | |
, ((mod .|. controlMask, xK_2), spawn (myTerminal ++ " -p EMEA")) -- myself | |
] | |
) | |
++ | |
-- mouse keybindings | |
-- | |
-- | |
-- blah blah | |
-- end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment