Skip to content

Instantly share code, notes, and snippets.

@earlybr
Last active August 5, 2016 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save earlybr/244fe4aa370431099b74dab7c8b2b17d to your computer and use it in GitHub Desktop.
Save earlybr/244fe4aa370431099b74dab7c8b2b17d to your computer and use it in GitHub Desktop.
import XMonad
import XMonad.Hooks.DynamicLog
import System.Exit
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import XMonad.Actions.CycleWS
import XMonad.Prompt
import XMonad.Prompt.Window
myTerm = "xterm"
myModMask = mod4Mask
myWorkspaces = map show [1..9]
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True
clickJustFocuses :: Bool
clickJustFocuses = True
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
[ ((modMask .|. shiftMask, xK_b), windowPromptBring defaultXPConfig)
, ((modMask .|. shiftMask, xK_g), windowPromptGoto
defaultXPConfig {autoComplete = Just 500000})
, ((modMask, xK_space ), sendMessage NextLayout)
, ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
, ((modMask .|. shiftMask, xK_c), kill)
, ((modMask, xK_n), refresh)
, ((modMask .|. shiftMask, xK_q), io (exitWith ExitSuccess))
, ((modMask, xK_q), spawn "xmonad --restart")
, ((modMask, xK_Tab), windows W.focusDown)
, ((modMask .|. shiftMask, xK_Tab), windows W.focusUp)
, ((modMask, xK_j), windows W.focusDown)
, ((modMask, xK_k), windows W.focusUp)
, ((modMask, xK_m), windows W.focusMaster)
, ((modMask, xK_Return), windows W.swapMaster)
, ((modMask .|. shiftMask, xK_j), windows W.swapDown)
, ((modMask .|. shiftMask, xK_k), windows W.swapUp)
, ((modMask, xK_h), sendMessage Shrink)
, ((modMask, xK_l), sendMessage Expand)
, ((modMask, xK_comma ), sendMessage (IncMasterN 1))
, ((modMask, xK_period), sendMessage (IncMasterN (-1)))
-- MOVING BETWEEN WORKSPACES
-- Switch to the next workspace
, ((modMask, xK_Up), nextWS)
-- Switch to the previous workspace
, ((modMask, xK_Down), prevWS)
-- Move the focused window to the next workspace
, ((modMask .|. shiftMask, xK_Up), shiftToNext)
-- Move the focused window to the previous workspace
, ((modMask .|. shiftMask, xK_Down), shiftToPrev)
-- Move the focused window to the next empty workspace and follow it
, ((modMask .|. controlMask, xK_Up), shiftTo Next EmptyWS)
-- Move the focused window to the previous empty workspace and follow it
, ((modMask .|. controlMask, xK_Down), shiftTo Prev EmptyWS)
-- TOGGLING THE PREVIOUS WORKSPACE
-- Toggle to the workspace displayed previously
, ((modMask, xK_z), toggleWS)
-- MOVING BETWEEN SCREENS (XINERAMA)
-- View next screen
, ((modMask, xK_Right), nextScreen)
-- View prev screen
, ((modMask, xK_Left), prevScreen)
-- Move focused window to workspace on next screen
, ((modMask .|. shiftMask, xK_Right), shiftNextScreen)
-- Move focused window to workspace on prev screen
, ((modMask .|. shiftMask, xK_Left), shiftPrevScreen)
-- Swap current screen with next screen
, ((modMask .|. controlMask, xK_Right), swapNextScreen)
-- Swap current screen with previous screen
, ((modMask .|. controlMask, xK_Left), swapPrevScreen)
]
-- mod-[1..9] %! Switch to workspace N
-- mod-shift-[1..9] %! Move client to workspace N
++
[((m .|. modMask, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
++
-- mod-{w,e,r} %! Switch to physical/Xinerama screens 1, 2, or 3
-- mod-shift-{w,e,r} %! Move client to screen 1, 2, or 3
[((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
main = xmonad =<< xmobar defaultConfig
{
terminal = myTerm
, modMask = myModMask
, workspaces = myWorkspaces
, focusFollowsMouse = myFocusFollowsMouse
, keys = myKeys
, borderWidth = 0
, normalBorderColor = "black"
, focusedBorderColor = "black"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment