- import XMonad
- import XMonad.Config.Gnome
- import XMonad.Layout.ResizableTile
- import XMonad.Hooks.ManageDocks
- import XMonad.Hooks.EwmhDesktops
- import qualified XMonad.StackSet as W
- import qualified Data.Map as M
- myLogHook :: X ()
- myLogHook = ewmhDesktopsLogHook
- myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
- -- launch a terminal
- [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
- -- launch dmenu
- , ((modm, xK_p ), gnomeRun)
- -- close focused window
- , ((modm .|. shiftMask, xK_q ), kill)
- -- Rotate through the available layout algorithms
- , ((modm, xK_space ), sendMessage NextLayout)
- -- Reset the layouts on the current workspace to default
- , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
- -- Resize viewed windows to the correct size
- --, ((modm, xK_n ), refresh)
- -- Move focus to the next window
- --, ((modm, xK_Tab ), windows W.focusDown)
- -- Move focus to the previous window
- , ((modm, xK_Tab ), windows W.focusUp )
- -- Move focus to the master window
- , ((modm, xK_m ), windows W.focusMaster )
- -- Swap the focused window and the master window
- , ((modm, xK_Return), windows W.swapMaster)
- -- Swap the focused window with the next window
- , ((modm .|. shiftMask, xK_j ), windows W.swapDown )
- -- Swap the focused window with the previous window
- , ((modm .|. shiftMask, xK_k ), windows W.swapUp )
- -- Shrink the master area
- , ((modm, xK_e ), sendMessage Shrink)
- -- Expand the master area
- , ((modm, xK_n ), sendMessage Expand)
- -- Push window back into tiling
- , ((modm, xK_t ), withFocused $ windows . W.sink)
- -- Increment the number of windows in the master area
- , ((modm , xK_comma ), sendMessage (IncMasterN 1))
- -- Deincrement the number of windows in the master area
- , ((modm , xK_period), sendMessage (IncMasterN (-1)))
- -- toggle the status bar gap
- -- TODO, update this binding with avoidStruts , ((modm , xK_b ), sendMessage ToggleStruts)
- -- Quit xmonad
- , ((modm .|. shiftMask, xK_q), spawn "gnome-session-save --kill")
- -- Restart xmonad
- , ((modm , xK_r ), restart "xmonad" True)
- -- Added for the ResizableTile layouts
- , ((modm , xK_o ), sendMessage MirrorShrink)
- , ((modm , xK_i ), sendMessage MirrorExpand)
- -- To kill Firefox
- , ((modm , xK_6 ), spawn "kill -9 firefox")
- ]
- ++
- --
- -- , mod-[1..3], Switch to workspace N
- -- , mod-shift-[1..3], Move client to workspace N
- [((m .|. modm, k), windows $ f i)
- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_3]
- , (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 .|. modm, 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)]]
- myLayouts = ewmhDesktopsLayout $ avoidStruts $ tiled' ||| Mirror tiled' ||| Full
- where
- -- The default number of windows in the master pane
- nmaster = 1
- -- Default proportion of screen occupied by master pane
- ratio = 1/2
- -- Percent of screen to increment by when resizing panes
- delta = 3/100
- -- Shorthand for ResizableTall
- tiled' = ResizableTall nmaster delta ratio []
- main = do xmonad $ gnomeConfig
- { modMask = mod4Mask
- , borderWidth = 0
- , XMonad.workspaces = map show [1..3]
- , focusFollowsMouse = True
- , keys = myKeys
- , logHook = myLogHook
- , layoutHook = myLayouts
- }