From af75f133e9e8dd5faabae4dc86881d200cd8ffcd Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 2 Nov 2009 23:45:49 +0530 Subject: [PATCH] more xmonad.hs cleanup --- .xmonad/xmonad.hs | 107 +++++++++------------------------------------- 1 file changed, 20 insertions(+), 87 deletions(-) diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index 622dd8f..6195979 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -30,30 +30,13 @@ import Data.Maybe import qualified XMonad.StackSet as W import qualified Data.Map as M --- The preferred terminal program, which is used in a binding below and by --- certain contrib modules. --- -- myTerminal = "urxvt;ps -U $USER |grep dzen2|awk '{print $1}'|xargs kill -USR1" +-- mterminal = "urxvtc" - --- Width of the window border in pixels. --- mborderWidth = 1 - --- modMask lets you specify which modkey you want to use. The default --- is mod1Mask ("left alt"). You may also consider using mod3Mask --- ("right alt"), which does not conflict with emacs keybindings. The --- "windows key" is usually mod4Mask. --- mmodMask = mod4Mask --- | The default number of workspaces (virtual screens) and their names. --- By default we use numeric strings, but any string may be used as a --- workspace name. The number of workspaces is determined by the length --- of this list. --- -- A tagging example: --- -- > workspaces = ["web", "irc", "code" ] ++ map show [4..9] -- mworkspaces :: [WorkspaceId] @@ -65,49 +48,45 @@ mnormalBorderColor = "#999999" mfocusedBorderColor = "#dd0000" -- Custom keys -mkeys = [ ("M-S-n", sendMessage MirrorShrink) -- Expand current window - , ("M-S-t", sendMessage MirrorExpand) -- Shrink current window - - -- Bring dzen to the front - , ("M-S-b", spawn "ps -U hunner|grep dzen2|awk '{print $1}'|xargs kill -USR1") - - -- Toggle the border of the currently focused window - , ("M-b" , withFocused toggleBorder) - - -- Gridselect to pick windows - --, ((modMask , xK_g ), goToSelected defaultGSConfig) - --, ((modMask , xK_g ), goToSelected gsconfig3) - --, ("M-g" , warpToCentre >> wsgrid) - --, ("M-g" , wsgrid) - , ("M-g" , warpToCentre >> promptedWs) +-- +mkeys = [ ("M-S-n", sendMessage MirrorShrink ) -- Expand current window + , ("M-S-t", sendMessage MirrorExpand ) -- Shrink current window + , ("M-b" , withFocused toggleBorder ) -- Toggle the border of the currently focused window + , ("M-g" , warpToCentre >> promptedWs) -- Gridselect to pick windows + , ("M-S-b", spawn "ps -U hunner|grep dzen2|awk '{print $1}'|xargs kill -USR1") -- Bring dzen to the front -- Goes to window or bring up window - , ("M-S-g", gotoMenu) - , ("M-S-b", bringMenu) + --, ("M-S-g", gotoMenu) + --, ("M-S-b", bringMenu) + , ("M-S-g", warpToCentre >> goToSelected gsConfig ) -- Multimedia , ("" , spawn "mpc toggle" ) -- play/pause mpd , ("" , spawn "mpc stop" ) -- stop mpd , ("" , spawn "mpc prev" ) -- prev song , ("" , spawn "mpc next" ) -- next song - , ("" , spawn "amixer -q -- sset Headphone togglemute") -- toggle mute via custom script , ("", spawn "mpc volume -3" ) -- volume down via custom script , ("", spawn "mpc volume +3" ) -- volume up via custom script - , ("M-S-" , removeWorkspace) + , ("" , spawn "amixer -q -- sset Headphone togglemute") -- toggle mute via custom script -- Dynamic workspace commands + , ("M-S-" , removeWorkspace) , ("M-S-w" , selectWorkspace myXPConfig) + , ("M-S-r" , renameWorkspace myXPConfig) , ("M-m" , withWorkspace myXPConfig (windows . W.shift)) , ("M-S-m" , withWorkspace myXPConfig (windows . copy)) - , ("M-S-r" , renameWorkspace myXPConfig) ] -- Don't auto-assign the key shortcuts -- ++ -- zip (map (("M-" ++) . show) [1..9]) (map (withNthWorkspace W.greedyView) [0..]) -- ++ -- zip (map (("M-S-" ++) . show) [1..9]) (map (withNthWorkspace W.shift) [0..]) + where -- Make the mouse jump to the middle of the screen for gridselect + warpToCentre = gets (W.screen . W.current . windowset) >>= \x -> warpToScreen x 0.5 0.5 + promptedWs = wsgrid >>= \x -> whenJust x $ \y -> windows $ W.greedyView y + wsgrid = gridselect gsConfig =<< gets (map (\x -> (x,x)) . (map W.tag . W.workspaces . windowset)) + --wsgrid = gridselect gsConfig =<< gets (map (\x -> (x,x)) . (map W.tag . uncurry (++) . partition (isJust . W.stack) . W.workspaces . windowset)) -- (map W.tag . W.workspaces . windowset)) -warpToCentre = gets (W.screen . W.current . windowset) >>= \x -> warpToScreen x 0.5 0.5 {- [10:28] dschoepe : gets (map W.tag . W.workspaces . windowset) should work @@ -118,10 +97,6 @@ warpToCentre = gets (W.screen . W.current . windowset) >>= \x -> warpToScreen x [10:34] aavogt : needs imports of Data.List and Data.Maybe -} ---wsgrid = gridselect gsConfig =<< gets (map (\x -> (x,x)) . (map W.tag . uncurry (++) . partition (isJust . W.stack) . W.workspaces . windowset)) -- (map W.tag . W.workspaces . windowset)) -wsgrid = gridselect gsConfig =<< gets (map (\x -> (x,x)) . (map W.tag . W.workspaces . windowset)) -promptedWs = wsgrid >>= \x -> whenJust x $ \y -> windows $ W.greedyView y - {- - Fancy gsConfig gsConfig = defaultGSConfig { gs_navigate = neiu `M.union` gs_navigate (defaultGSConfig`asTypeOf`gsConfig) } @@ -153,34 +128,9 @@ gsConfig = defaultGSConfig -- jump back to the center with the spacebar, regardless of the current position. reset = M.singleton (0,xK_space) (const (0,0)) ------------------------------------------------------------------------- --- Mouse bindings: default actions bound to mouse events --- -mmouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $ - - -- mod-button1, Set the window to floating mode and move by dragging - [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w)) - - -- mod-button2, Raise the window to the top of the stack - , ((modMask, button2), (\w -> focus w >> windows W.swapMaster)) - - -- mod-button3, Set the window to floating mode and resize by dragging - , ((modMask, button3), (\w -> focus w >> mouseResizeWindow w)) - - -- you may also bind events to the mouse scroll wheel (button4 and button5) - ] - ------------------------------------------------------------------------ -- Layouts: --- You can specify and transform your layouts by modifying these values. --- If you change layout bindings be sure to use 'mod-shift-space' after --- restarting (with 'mod-q') to reset your layout state to the new --- defaults, as xmonad preserves your old layout settings by default. --- --- The available layouts. Note that each layout is separated by |||, --- which denotes layout choice. --- mlayout = smartBorders Full ||| tiled ||| Mirror tiled ||| simplestFloat where -- default tiling algorithm partitions the screen into two panes @@ -191,26 +141,15 @@ mlayout = smartBorders Full ||| tiled ||| Mirror tiled ||| simplestFloat nmaster = 1 -- Default proportion of screen occupied by master pane - ratio = 1/2 - --ratio = toRational (2/(1+sqrt(5)::Double)) -- golden + --ratio = 1/2 + ratio = toRational (2/(1+sqrt(5)::Double)) -- golden -- Percent of screen to increment by when resizing panes delta = 3/100 ------------------------------------------------------------------------ -- Window rules: - --- Execute arbitrary actions and WindowSet manipulations when managing --- a new window. You can use this to, for example, always float a --- particular program, or have a client always appear on a particular --- workspace. --- --- To find the property name associated with a program, use -- > xprop | grep WM_CLASS --- and click on the client you're interested in. --- --- To match on the WM_NAME, you can use 'title' in the same way that --- 'className' and 'resource' are used below. -- mmanageHook = composeAll [ className =? "MPlayer" --> doFloat @@ -234,7 +173,6 @@ mfocusFollowsMouse = True {- [14:25] dschoepe : Hunner: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8798#a8798 [14:25] dschoepe : that should work in darcs -[14:27] Hunner : awesome. I'll check it [14:28] dschoepe : Hunner: you probably want something like `flip (/="cellwriterclass") `fmap` className' as shouldFollow [14:28] dschoepe : err, without the flip @@ -262,11 +200,6 @@ main = do , workspaces = mworkspaces , normalBorderColor = mnormalBorderColor , focusedBorderColor = mfocusedBorderColor - - -- key bindings - , mouseBindings = mmouseBindings - - -- hooks, layouts , layoutHook = mlayout , manageHook = mmanageHook , handleEventHook = pickyFocusEventHook