dotfiles/.xmonad/xmonad.hs
2013-03-21 10:44:30 -07:00

216 lines
9.6 KiB
Haskell

import XMonad
import XMonad.Config.Gnome
import XMonad.Operations
import XMonad.Actions.Commands
import XMonad.Actions.CycleWS
import XMonad.Actions.DeManage
import qualified XMonad.Actions.DynamicWorkspaces as DW
import XMonad.Hooks.DynamicLog as DL
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.ManageHook
import qualified XMonad.StackSet as W
import XMonad.Util.Loggers as LS
import XMonad.Util.Run
import XMonad.Util.WindowProperties
import XMonad.Util.XSelection
import qualified XMonad.Util.EZConfig as EZ
import qualified Data.Map as M
myManageHook :: [ManageHook]
myManageHook =
[ resource =? "Synapse" --> doIgnore ]
{-myManageHook = -}
{-[ resource =? "Do" --> doFloat ]-}
main = xmonad gnomeConfig
{ manageHook = manageHook gnomeConfig <+> composeAll myManageHook
, borderWidth = 2
, focusedBorderColor = "#00BFFF"
}
{-
-- delKeys x = foldr M.delete (keys defaultConfig x) (keysToRemove x)
delKeys = keys defaultConfig
newKeys x = M.union (delKeys x) (myKeys x)
myKeys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
[ ((modMask .|. shiftMask, xK_r ), spawn "if type xmonad; then xmonad --recompile && xmonad --restart; else xmessage xmonad not in \\$PATH: \"$PATH\"; fi") -- %! Restart xmonad
]
++
-- 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_q, xK_w, xK_e] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
-}
{- Reference -- the originals
-- launching and killing programs
[ ((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) -- %! Launch terminal
, ((modMask, xK_p ), spawn "dmenu_run") -- %! Launch dmenu
, ((modMask .|. shiftMask, xK_p ), spawn "gmrun") -- %! Launch gmrun
, ((modMask .|. shiftMask, xK_c ), kill) -- %! Close the focused window
, ((modMask, xK_space ), sendMessage NextLayout) -- %! Rotate through the available layout algorithms
, ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) -- %! Reset the layouts on the current workspace to default
, ((modMask, xK_n ), refresh) -- %! Resize viewed windows to the correct size
-- move focus up or down the window stack
, ((modMask, xK_Tab ), windows W.focusDown) -- %! Move focus to the next window
, ((modMask .|. shiftMask, xK_Tab ), windows W.focusUp ) -- %! Move focus to the previous window
, ((modMask, xK_j ), windows W.focusDown) -- %! Move focus to the next window
, ((modMask, xK_k ), windows W.focusUp ) -- %! Move focus to the previous window
, ((modMask, xK_m ), windows W.focusMaster ) -- %! Move focus to the master window
-- modifying the window order
, ((modMask, xK_Return), windows W.swapMaster) -- %! Swap the focused window and the master window
, ((modMask .|. shiftMask, xK_j ), windows W.swapDown ) -- %! Swap the focused window with the next window
, ((modMask .|. shiftMask, xK_k ), windows W.swapUp ) -- %! Swap the focused window with the previous window
-- resizing the master/slave ratio
, ((modMask, xK_h ), sendMessage Shrink) -- %! Shrink the master area
, ((modMask, xK_l ), sendMessage Expand) -- %! Expand the master area
-- floating layer support
, ((modMask, xK_t ), withFocused $ windows . W.sink) -- %! Push window back into tiling
-- increase or decrease number of windows in the master area
, ((modMask , xK_comma ), sendMessage (IncMasterN 1)) -- %! Increment the number of windows in the master area
, ((modMask , xK_period), sendMessage (IncMasterN (-1))) -- %! Deincrement the number of windows in the master area
-- toggle the status bar gap
--, ((modMask , xK_b ), modifyGap (\i n -> let x = (XMonad.defaultGaps conf ++ repeat (0,0,0,0)) !! i in if n == x then (0,0,0,0) else x)) -- %! Toggle the status bar gap
-- quit, or restart
, ((modMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess)) -- %! Quit xmonad
, ((modMask , xK_q ), spawn "if type xmonad; then xmonad --recompile && xmonad --restart; else xmessage xmonad not in \\$PATH: \"$PATH\"; fi") -- %! Restart xmonad
]
++
-- 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)]]
-}
keysToRemove :: XConfig Layout -> [(KeyMask, KeySym)]
keysToRemove XConfig{modMask = modm} =
[ (modm, xK_p )
, (modm .|. shiftMask, xK_p )
]
{-
myKeys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X())
myKeys conf = EZ.mkKeymap conf $(_emacsKeys conf)
_emacsKeys :: [(String, X())]
_emacsKeys = [
("M-q"
_emacsKeys :: XConfig Layout -> [(String, X())]
_emacsKeys conf =
[ -- Applications
{-("M-t", goto "terminals")-}
{-, ("M-S-t", runColourTerminal)-}
{-, ("M-v M-t", pasteTerminal)-}
{-, ("M-v M-d", manTerminal)-}
{-, ("M-i", goto "browsen")-}
{-, ("M-S-i", runBrowser)-}
{-, ("M-v M-i", pasteBrowser)-}
{-, ("M-p", runCmdLine)-}
{-, ("M-x", WD.changeDir P.defaultXPConfig)-}
{-, ("M-e", goto "muziek")-}
{--- , ("M-o", runMixer)-}
{-, ("M-h", runFileManager)-}
{-, ("M-s", goto "praten")-}
{-, ("M-m", goto "berichten")-}
{-, ("M-S-m", runMail)-}
{-, ("M-u", goto "agenda")-}
{-, ("M-0", goto "schutbord")-}
{-, ("M-w", goto "flim")-}
-- mpd
{-, ("<XF86AudioPlay>", io $ return . fromRight =<< MPD.withMPD MPD.toggle)-}
{-, ("<XF86AudioStop>", io $ return . fromRight =<< MPD.withMPD MPD.stop)-}
{-, ("<XF86AudioNext>", io $ return . fromRight =<< MPD.withMPD MPD.next)-}
{-, ("<XF86AudioPrev>", io $ return . fromRight =<< MPD.withMPD MPD.previous)-}
{-, ("<XF86AudioLowerVolume>", spawn "amixer set Master 2-")-}
{-, ("<XF86AudioRaiseVolume>", spawn "amixer set Master 2+")-}
{-, ("<XF86AudioMute>", spawn "amixer set Master toggle")-}
-- couple of scripts to change brightness, very hardware specific to my laptop
-- brightness
{-, ("<XF86MonBrightnessUp>", spawn "lcd-brightness-inc")-}
{-, ("<XF86MonBrightnessDown>", spawn "lcd-brightness-dec")-}
-- Layouts
, ("M-n", refresh)
, ("M-S-<Space>", setLayout $ XMonad.layoutHook conf)
, ("M-<Space>", sendMessage NextLayout)
, ("M-<Tab>", windows W.focusDown)
, ("M-j", windows W.focusDown)
, ("M-k", windows W.focusUp)
, ("M-<Return>", windows W.focusMaster)
, ("M-S-<Return>", DwmP.dwmpromote)
, ("M-S-j", windows W.swapDown)
, ("M-S-k", windows W.swapUp)
, ("M-g", sendMessage Shrink)
, ("M-l", sendMessage Expand)
, ("M-r", withFocused $ windows . W.sink)
, ("M-,", sendMessage (IncMasterN 1))
, ("M-.", sendMessage (IncMasterN (-1)))
-- Toggle full screen
, ("M-<F12>", sendMessage ToggleStruts >> refresh)
-- Windows
, ("M-[", PWork.workspacePrompt P.defaultXPConfig goto)
, ("M-]", PWin.windowPromptGoto P.defaultXPConfig)
,("M-S-[", PWork.workspacePrompt P.defaultXPConfig shift)
, ("M-c", kill) -- window
, ("M-S-c", WithAll.killAll) ] -- window
-- ++
-- [ ("M-" ++ [num], goto name)
-- | (name, num) <-
-- zip _workspaces (['1' .. '9'] ++ ['0'])]
-- -- Workspaces
-- ++
-- [ ("M-S-" ++ [num], shift name)
-- | (name, num) <-
-- zip _workspaces (['1' .. '9'] ++ ['0'])]
++
[ ("M-<Right>", moveTo Next NonEmptyWS)
, ("M-<Left>", moveTo Prev NonEmptyWS)
, ("M-S-<Right>", moveTo Next EmptyWS)
, ("M-S-<Left>", moveTo Prev EmptyWS)
-- Toggle between current and previous
, ("M-`", toggleWS)
, ("M-S-n", PI.inputPrompt P.defaultXPConfig "New Workspace:" PI.?+ newWorkspaceDir)
, ("M-S-<Backspace>", WithAll.killAll >> DW.removeWorkspace) --buggy, messes with focus and creates flicker, needs to be fixed
, ("M-S-r", DW.renameWorkspace P.defaultXPConfig)
-- -- Commands
-- , ("M-y", runCommand _commands)
-- -- Remember
, ("M1-C-r", runRemember)
-- xmonad
, ("M1-q", restartXMonad)]
-}