Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import XMonad
- import XMonad.Hooks.ManageHelpers
- import XMonad.Hooks.DynamicLog
- import XMonad.Hooks.ManageDocks
- import XMonad.Hooks.SetWMName
- import XMonad.Hooks.InsertPosition
- import XMonad.Actions.CycleWS
- import XMonad.Actions.DwmPromote
- import XMonad.Layout.NoBorders
- import XMonad.Layout.IM
- import XMonad.Layout.PerWorkspace
- import XMonad.Layout.Reflect
- import XMonad.Layout.ResizableTile
- import XMonad.Layout.MultiToggle
- import XMonad.Layout.MultiToggle.Instances
- import XMonad.Prompt
- import XMonad.Prompt.Shell
- import XMonad.Prompt.Workspace
- import XMonad.Prompt.AppendFile
- import XMonad.Util.NamedScratchpad
- import XMonad.Util.Run
- import qualified XMonad.StackSet as W
- import qualified Data.Map as M
- import System.Exit
- main :: IO ()
- main = myConfig >>= xmonad
- myConfig = do
- workspaceBar <- spawnPipe "xmobar -x 0 ~/.xmobarrc"
- return defaultConfig {
- terminal = "urxvtc",
- startupHook = setWMName "LG3D",
- manageHook = myManageHook,
- borderWidth = 1,
- normalBorderColor = black4,
- focusedBorderColor = orange,
- layoutHook = myLayouts,
- workspaces = myWorkspaces,
- keys = myKeys,
- logHook = myLogHook workspaceBar
- }
- -------------------------
- -- LOGGING/STATUS BARS --
- -------------------------
- myLogHook bar = dynamicLogWithPP $ defaultPP {
- ppCurrent = xmobarColor orange "" . pad
- , ppVisible = xmobarColor orange grey1 . pad
- , ppHidden = xmobarColor white "" . pad . removeNSP
- , ppHiddenNoWindows = xmobarColor grey2 "" . pad . removeNSP
- , ppSep = "| "
- , ppWsSep = ""
- , ppLayout = (++ " ") . xmobarColor orange "" . layoutNames
- , ppTitle = xmobarColor white ""
- , ppOutput = hPutStrLn bar
- }
- where
- removeNSP x
- | x == "NSP" = []
- | otherwise = x
- layoutNames x
- | x == "ResizableTall" = "|"
- | x == "Mirror ResizableTall" = "-"
- | x == "Full" = "[]"
- | x == "IM ReflectX IM Full" = "|=|"
- | otherwise = x
- ------------------
- -- WINDOW RULES --
- ------------------
- myManageHook = namedScratchpadManageHook genScratchPads <+> (composeOne . concat $
- [ [ className =? x <&&> resource =? y -?> doFloat | (x,y) <- specFloats ]
- , [ className =? x -?> doFloat | x <- genFloats ]
- , [ className =? x -?> doCenterFloat | x <- cenFloats ]
- , [ isFullscreen -?> doFullFloat ]
- , [ return True -?> insertPosition Below Newer ]
- ] ) <+> manageDocks <+> (composeOne . concat $
- [ [ className =? x -?> doShift y | (x,y) <- autoShifts ]])
- where
- specFloats = [ ("Namoroka", "Extension")
- , ("Namoroka", "Download")
- , ("Namoroka", "Mozilla")
- , ("Namoroka", "Dialog")
- , ("Namoroka", "Browser")
- ]
- genFloats = [ "Qsynth"
- , "MPlayer"
- ]
- cenFloats = [
- ]
- autoShifts = [ ("Gimp", "gimp")
- , ("Qsynth", "misc")
- , ("Qjackctl", "misc")
- , ("Hydrogen", "aud1")
- , ("Tuxguitar", "aud2")
- ]
- -----------------
- -- SCRATCHPADS --
- -----------------
- myScratchPads= [ ("terminal", "", 0.5, 0.33)
- , ("htop", "htop", 0.8, 0.8)
- , ("notes", "tail -F ~/bin/notes -s 60 -n 20", 0.2, 0.6)
- ]
- genScratchPads = map createPad myScratchPads
- where
- createPad (name,spawn,w,h)
- | name == "terminal" = NS name
- (myTerm name)
- (resource =? name)
- (customFloating $ W.RationalRect ((1 - w)/2) ((1 - h)/2) w h)
- | otherwise = NS name
- ((myTerm name) ++ " -e " ++ spawn)
- (resource =? name)
- (customFloating $ W.RationalRect ((1 - w)/2) ((1 - h)/2) w h)
- myScratchPadNames = map getName myScratchPads
- where getName (x,_,_,_) = x
- ------------
- -- PROMPT --
- ------------
- myXPConfig :: XPConfig
- myXPConfig = defaultXPConfig
- { font = myFont
- , bgColor = black2
- , fgColor = white
- , bgHLight = black3
- , fgHLight = orange
- , borderColor = black
- , position = Top
- , height = 17
- }
- -------------
- -- LAYOUTS --
- -------------
- myLayouts = smartBorders
- $ avoidStruts
- $ onWorkspace "gimp" gimp
- $ mkToggle (single NBFULL)
- $ tiled ||| Mirror tiled
- where
- tiled = ResizableTall nmaster delta ratio []
- nmaster = 1
- delta = 1/20
- ratio = goldenRatio
- gimp = withIM (0.11) (Role "gimp-toolbox")
- $ reflectHoriz
- $ withIM (0.15) (Role "gimp-dock") Full
- ------------------
- -- KEY BINDINGS --
- ------------------
- myKeys :: XConfig t -> M.Map (KeyMask, KeySym) (X ())
- myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
- [ ((modm, xK_Return), spawn $ XMonad.terminal conf)
- , ((modm, xK_Escape ), kill)
- , ((modm, xK_grave ), sendMessage NextLayout)
- , ((modm, xK_space ), dwmpromote)
- , ((modm, xK_j ), windows W.focusDown)
- , ((modm, xK_k ), windows W.focusUp)
- , ((modm .|. shiftMask, xK_j ), windows W.swapDown)
- , ((modm .|. shiftMask, xK_k ), windows W.swapUp)
- , ((modm, xK_Left ), prevWS)
- , ((modm, xK_Right ), nextWS)
- , ((modm, xK_Tab ), nextScreen)
- , ((modm .|. shiftMask, xK_Tab ), toggleWS)
- , ((modm, xK_s ), sendMessage Shrink)
- , ((modm, xK_x ), sendMessage Expand)
- , ((modm, xK_z ), sendMessage MirrorShrink)
- , ((modm, xK_a ), sendMessage MirrorExpand)
- , ((modm, xK_f ), sendMessage $ Toggle NBFULL)
- , ((modm, xK_t ), withFocused $ windows . W.sink)
- , ((modm, xK_comma ), sendMessage (IncMasterN 1))
- , ((modm, xK_period ), sendMessage (IncMasterN (-1)))
- , ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
- , ((modm, xK_q ), spawn "killall xmobar; xmonad --recompile; xmonad --restart")
- , ((modm, xK_p ), shellPrompt myXPConfig)
- , ((modm, xK_n ), appendFilePrompt myXPConfig "/home/zak/bin/notes")
- , ((modm, xK_m ), workspacePrompt myXPConfig $ windows . W.view)
- , ((modm, xK_o ), spawn "~/bin/scripts/startut")
- , ((modm, xK_u ), spawn powerTab)
- , ((0, 0x1008FF11), spawn "amixer -q set Master 5-")
- , ((0, 0x1008FF12), spawn "amixer -q set Master 0")
- , ((0, 0x1008FF13), spawn "amixer -q set Master 5+")
- , ((0, 0x1008FF14), spawn "ncmpcpp toggle")
- , ((0, 0x1008FF15), spawn "ncmpcpp stop")
- , ((0, 0x1008FF16), spawn "ncmpcpp prev")
- , ((0, 0x1008FF17), spawn "ncmpcpp next")
- ]
- ++
- [ ((0, x), namedScratchpadAction genScratchPads y) | (x,y) <- zip [xK_F12, xK_F11..xK_F1] myScratchPadNames ]
- ++
- [((modm, k), windows $ W.greedyView i) | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]]
- ++
- [((modm .|. shiftMask, k), (windows $ W.shift i) >> (windows $ W.greedyView i) >> (windows $ W.swapDown))
- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]]
- ------------
- -- COLORS --
- ------------
- orange = "#ebac54"
- white = "#ffffff"
- black = "#000000"
- black1 = "#1f1f1f"
- black2 = "#1c1c1c"
- black3 = "#2c2c2c"
- black4 = "#3f3f3f"
- grey1 = "#4f4f4f"
- grey2 = "#7f7f7f"
- --------------------------------
- -- SOME UGLY/LONG DEFINITIONS --
- --------------------------------
- myWorkspaces = ["www","dev","mus","chat","net","gimp","ex1","ex2","ex3"]
- myFont = "-*-proggycleanszcp-medium-r-normal-*-13-80-96-96-c-70-iso8859-1"
- myTerm x = "urxvtc +sb -fn '" ++ myFont ++ "' -fb '" ++ myFont ++ "' -fi '" ++ myFont ++ "' -name " ++ x
- powerTab = "wine .wine/drive_c/'Program Files'/'Power Tab Software'/'Power Tab Editor 1.7'/PTEditor.exe"
- goldenRatio = toRational $ 2/(1 + sqrt 5 :: Double)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement