Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- import Data.Monoid
- import qualified Data.Map as M
- import qualified XMonad.StackSet as W -- manageHook rules
- import System.Environment
- import System.Exit
- import System.IO -- hPutStrLn scope
- import XMonad
- import XMonad.Hooks.DynamicLog -- status
- import XMonad.Hooks.ManageDocks -- dock/tray
- import XMonad.Hooks.UrgencyHook -- notifications
- import XMonad.Layout.Named -- custom layout names
- import XMonad.Layout.NoBorders -- smart borders on solo clients
- import XMonad.Util.Loggers -- not needed?
- import XMonad.Util.Run(spawnPipe) -- spawnPipe and hPutStrLn
- main = do
- myBG <- getEnv "BG" -- $BG = $BLACK
- myFG <- getEnv "FG" -- $FG
- myBLACK <- getEnv "BLACK"
- myBLUE <- getEnv "BLUE"
- myCYAN <- getEnv "CYAN"
- myGREEN <- getEnv "GREEN"
- myMAGENTA <- getEnv "MAGENTA"
- myRED <- getEnv "RED"
- myWHITE <- getEnv "WHITE"
- myYELLOW <- getEnv "YELLOW"
- status <- spawnPipe "dzen2 -bg $BG -fg $FG -fn $FONT -w $WIDTH -ta 'l' " --myDzenStatus -- xmonad status on the left
- conky <- spawnPipe "conky -c ~/.xmonad/conkyrc | dzen2 -bg $BG -fg $FG -fn $FONT -ta 'r' -w $WIDTH -x $WIDTH " --myDzenConky -- conky stats on the right
- xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig
- { terminal = "urxvt"
- , focusFollowsMouse = True
- , borderWidth = 2
- , modMask = mod1Mask
- , workspaces = ["1","2","3","4","5","6","7","8","9"]
- , normalBorderColor = myBG
- , focusedBorderColor = myYELLOW
- , keys = myKeys
- , mouseBindings = myMouseBindings
- , layoutHook = myLayout
- , manageHook = myManageHook
- , logHook = dynamicLogWithPP dzenPP
- { ppOutput = hPutStrLn status
- , ppCurrent = dzenColor myBLACK myYELLOW . pad -- dzenColor $FG $BG
- , ppHidden = dzenColor myFG myBG . pad -- other WS in use but not currently on either monitor
- , ppHiddenNoWindows = dzenColor myBG "" . pad -- unused windows (1-9)
- , ppLayout = dzenColor myRED ""
- , ppSep = " " -- between "9" and layout/title
- , ppTitle = dzenColor myFG "" . pad
- , ppUrgent = dzenColor "" myRED . pad
- , ppVisible = dzenColor myYELLOW myBLACK . pad -- workspace visible on 2nd monitor
- , ppWsSep = ""
- }
- }
- myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
- -- launch a terminal
- [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
- -- launch dmenu
- --, ((modm, xK_p ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
- , ((modm, xK_p ), spawn "dmenu_run -fn $FONT -nb $BG -nf $FG -sb $BLACK -sf $FG")
- -- launch gmrun#
- , ((modm .|. shiftMask, xK_p ), spawn "gmrun")
- -- close focused window
- , ((modm .|. shiftMask, xK_c ), 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 [doesn't seem to be working; reusing bind for pomodoro]
- --, ((modm, xK_n ), refresh)
- , ((modm, xK_n ), spawn "touch ~/.pomodoro_session")
- -- Move focus to the next window
- , ((modm, xK_Tab ), windows W.focusDown)
- -- Move focus to the next window
- , ((modm, xK_j ), windows W.focusDown)
- -- Move focus to the previous window
- , ((modm, xK_k ), 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_h ), sendMessage Shrink)
- -- Expand the master area
- , ((modm, xK_l ), 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
- -- Use this binding with avoidStruts from Hooks.ManageDocks.
- -- See also the statusBar function from Hooks.DynamicLog.
- --
- -- , ((modm , xK_b ), sendMessage ToggleStruts)
- -- Quit xmonad
- , ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
- -- Restart xmonad
- , ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart")
- ]
- ++
- --
- -- mod-[1..9], Switch to workspace N
- --
- -- mod-[1..9], Switch to workspace N
- -- mod-shift-[1..9], Move client to workspace N
- --
- [((m .|. modm, k), windows $ f i)
- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
- , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
- --, (f, m) <- [(W.view, 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)]]
- myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
- -- mod-button1, Set the window to floating mode and move by dragging
- [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
- >> windows W.shiftMaster))
- -- mod-button2, Raise the window to the top of the stack
- , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
- -- mod-button3, Set the window to floating mode and resize by dragging
- , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
- >> windows W.shiftMaster))
- -- you may also bind events to the mouse scroll wheel (button4 and button5)
- ]
- myLayout = avoidStruts $ smartBorders ( mtiled ||| tiled ||| full )
- where
- tiled = named " " $ Tall 1 (3/100) (2/(1+(toRational(sqrt(5)::Double)))) -- golden
- mtiled = named " " $ Mirror tiled
- full = named "#" $ Full
- --
- -- xprop|egrep "WM_CLASS|WM_NAME"
- --
- -- WM_CLASS(STRING) 1st > 'resource'
- -- WM_CLASS(STRING) 2nd > 'className'
- -- WM_NAME(STRING) > 'title'
- --
- myManageHook = composeAll
- [ title =? "Accounts" --> doFloat
- , className =? "Galculator" --> doFloat
- , className =? "MPlayer" --> doFloat
- , title =? "Torrent Options" --> doFloat
- , className =? "VirtualBox" --> doFloat
- , resource =? "chromium-browser" <&&> title =? "Google - Bookmarks - Chromium" --> doFloat
- , resource =? "desktop_window" --> doIgnore
- , className =? "rdesktop" --> doFloat
- , className =? "trayer" --> doIgnore
- , title =? "xmessage" --> doIgnore ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement