Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import XMonad.Actions.NoBorders
- import XMonad.Actions.WindowGo
- import XMonad hiding (Tall)
- import XMonad.Hooks.DynamicLog
- import XMonad.Hooks.ManageDocks
- import XMonad.Hooks.UrgencyHook
- import XMonad.Layout.HintedTile
- import XMonad.Layout.LayoutHints
- import XMonad.Layout.PerWorkspace
- import XMonad.Layout.NoBorders
- import XMonad.Layout.Spiral
- import XMonad.ManageHook
- import XMonad.Prompt
- import XMonad.Prompt.Shell
- import XMonad.Util.Run
- import Graphics.X11
- import System.Exit
- import System.IO
- import qualified Data.Map as M
- import qualified XMonad.Actions.FlexibleResize as Flex
- import qualified XMonad.StackSet as W
- main = do
- din <- spawnPipe myStatusBar
- din2 <- spawnPipe myTopBar
- xmonad $ myUrgencyHook $ defaultConfig
- { normalBorderColor = "#474751"
- , focusedBorderColor = "#9090a0"
- , terminal = "urxvt"
- , layoutHook = myLayout
- , manageHook = myManageHook <+> manageDocks <+> (doF avoidMaster)
- , workspaces = ["1:www", "2:code", "3:im", "4:misc"] ++ map show [5..9]
- , numlockMask = mod3Mask
- , modMask = mod1Mask
- , keys = myKeys
- , mouseBindings = myMouseBindings
- , borderWidth = 1
- , logHook = dynamicLogWithPP $ myDzenPP din
- , focusFollowsMouse = False
- }
- avoidMaster :: W.StackSet i l a s sd -> W.StackSet i l a s sd
- avoidMaster = W.modify' $ \c -> case c of
- W.Stack t [] (r:rs) -> W.Stack t [r] rs
- otherwise -> c
- myStatusBar = "dzen2 -x '0' -y '0' -h '16' -w '980' -ta 'l' -fg '#f3f3f3' -bg '#474751' -fn '-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1'"
- myTopBar = "zsh /home/smeea/.dzen/status.sh | dzen2 -x '980' -y '0' -h '16' -w '300' -ta 'r' -fg '#f3f3f3' -bg '#474751' -fn '-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1'"
- myUrgencyHook = withUrgencyHook NoUrgencyHook
- myLayout = avoidStruts $ layoutHints $ onWorkspace "1:www" (noBorders Full ||| HintedTile 1 (2/100) (5/6) TopLeft Wide) $ onWorkspace "2:code" (hintedTile Wide ||| hintedTile Tall) $ onWorkspace "3:im" (HintedTile 2 (2/100) (2/3) TopLeft Tall) $ (hintedTile Wide ||| hintedTile Tall ||| noBorders Full ||| spiral (5/6))
- where
- hintedTile = HintedTile nmaster delta ratio TopLeft
- nmaster = 1
- ratio = 3/4
- delta = 2/100
- myXPConfig = defaultXPConfig
- { font = "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"
- , bgColor = "#404045"
- , fgColor = "#f3f3f3"
- , fgHLight = "#f3f3f3"
- , bgHLight = "#606065"
- , borderColor = "#f3f3f3"
- , promptBorderWidth = 0
- , position = Bottom
- , height = 14
- , historySize = 50
- }
- myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
- [ ((mod4Mask, xK_a), spawn "urxvt")
- , ((mod4Mask, xK_n), raiseMaybe (runInTerm "-title ncmpcpp" "ncmpcpp") (title =? "ncmpcpp"))
- , ((mod4Mask, xK_j), raiseMaybe (runInTerm "-title mcabber" "mcabber") (title =? "mcabber"))
- , ((mod4Mask, xK_i), raiseMaybe (runInTerm "-title irssi" "irssi") (title =? "irssi"))
- , ((mod4Mask, xK_m), raiseMaybe (runInTerm "-title mutt" "mutt -y") (title =? "mutt"))
- , ((mod4Mask, xK_r), raiseMaybe (runInTerm "-title newsbeuter" "newsbeuter") (title =? "newsbeuter"))
- , ((mod4Mask, xK_w), runOrRaise "iceweasel" (className =? "Iceweasel"))
- , ((mod4Mask, xK_f), runOrRaise "pcmanfm" (className =? "Pcmanfm"))
- , ((mod4Mask, xK_e), runOrRaise "emacs" (className =? "Emacs"))
- , ((mod4Mask, xK_s), shellPrompt myXPConfig)
- , ((mod4Mask, xK_Print), spawn "scrot")
- , ((mod4Mask, xK_equal), spawn "amixer set PCM playback 5dB+")
- , ((mod4Mask, xK_minus), spawn "amixer set PCM playback 5dB-")
- , ((mod4Mask, xK_p), spawn "mpc toggle")
- , ((mod4Mask, xK_bracketright), spawn "mpc next")
- , ((mod4Mask, xK_bracketleft), spawn "mpc prev")
- , ((modMask, xK_f), sendMessage NextLayout)
- , ((modMask, xK_m), windows W.swapMaster)
- , ((modMask, xK_k), windows W.focusUp)
- , ((modMask, xK_j), windows W.focusDown)
- , ((modMask, xK_h), sendMessage Shrink)
- , ((modMask, xK_l), sendMessage Expand)
- , ((modMask .|. shiftMask, xK_q), io (exitWith ExitSuccess))
- , ((modMask .|. shiftMask, xK_r), spawn "killall conky dzen2" >> restart "xmonad" True)
- , ((modMask, xK_t), withFocused $ windows . W.sink)
- , ((modMask .|. shiftMask, xK_c), kill)
- , ((modMask .|. shiftMask, xK_k), windows W.swapUp)
- , ((modMask .|. shiftMask, xK_j), windows W.swapDown)
- , ((modMask .|. shiftMask, xK_h), sendMessage (IncMasterN 1))
- , ((modMask .|. shiftMask, xK_l), sendMessage (IncMasterN (-1)))
- , ((modMask, xK_b), withFocused toggleBorder)
- ]
- ++
- [ ((m .|. modMask, k), windows $ f i)
- | (i, k) <- zip (XMonad.workspaces conf) [xK_F1 .. xK_F9]
- , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
- ]
- myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
- [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w))
- , ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
- , ((modMask, button3), (\w -> focus w >> Flex.mouseResizeWindow w))
- ]
- myManageHook = composeAll . concat $
- [ [className =? c --> doFloat | c <- myFloats]
- , [title =? t --> doFloat | t <- myOtherFloats]
- , [resource =? r --> doFloat | r <- myIgnores]
- , [className =? "Iceweasel" --> doF (W.shift "1:www")]
- , [title =? "mcabber" --> doF (W.shift "3:im")]
- , [title =? "irssi" --> doF (W.shift "3:im")]
- , [title =? "ncmpcpp" --> doF (W.shift "3:im")]
- ]
- where
- myFloats = ["MPlayer", "Xmessage", "Gimp", "feh", "Wine"]
- myOtherFloats = ["Downloads", "Iceweasel Preferences", "Save As...", "many more..."]
- myIgnores = []
- myDzenPP h = defaultPP
- { ppCurrent = wrap "^bg(#606060)^p()^fg(#f3f3f3)" "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
- , ppHidden = wrap "" "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
- , ppHiddenNoWindows = wrap "^fg(#757575)^bg()^p()" "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
- , ppUrgent = wrap "^fg(#cc9933)^bg()^p()" "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId
- , ppSep = " "
- , ppWsSep = " "
- , ppTitle = dzenColor "#f3f3f3" "" . wrap "< " " >"
- , ppLayout = dzenColor "" "" .
- (\x -> case x of
- "Hinted Tall" -> "^fg(#757575)^i(/home/smeea/.dzen/tall.xbm)"
- "Hinted Wide" -> "^fg(#757575)^i(/home/smeea/.dzen/wide.xbm)"
- "Hinted Full" -> "^fg(#757575)^i(/home/smeea/.dzen/full.xbm)"
- "Hinted Spiral" -> "^fg(#757575)^i(/home/smeea/.dzen/spiral.xbm)"
- )
- , ppOutput = hPutStrLn h
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement