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.Layout.WorkspaceDir
- import XMonad.Prompt
- import XMonad.Prompt.Shell
- import XMonad.Prompt.Workspace
- import XMonad.Prompt.AppendFile
- import XMonad.Util.NamedScratchpad
- import XMonad.Util.Run
- import System.Exit
- import qualified XMonad.StackSet as W
- import qualified Data.Map as M
- main :: IO ()
- main = myConfig >>= xmonad
- myConfig = do
- workspaceBar <- spawnPipe "xmobar ~/.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 "" . 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 ]
- , [ title =? x -?> doFloat | x <- namedFloats ]
- , [ className =? x -?> doFloat | x <- genFloats ]
- , [ className =? x -?> doCenterFloat | x <- cenFloats ]
- , [ className =? x -?> doFullFloat | x <- fullFloats ]
- , [ 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")
- ]
- namedFloats = [ "Guitar In"
- , "Save As"
- , "MIDI Setup Property Sheet"
- , "Guitar Property Sheet"
- , "Open"
- , "Open File"
- , "Dynamic"
- , "Chord Dictionary - Version 1.0"
- , "Tuning Dictionary"
- , "Score Checker - Version 1.0"
- , "Shifter Tool - Version 1.0"
- , "Tonality Tool - Version 1.0"
- , "Music Bar"
- , "Trill"
- , "Rehearsal Sign"
- , "Bend"
- , "Tapped Harmonic"
- , "Artificial Harmonic"
- , "Song Fade In/Out"
- , "Tempo Marker"
- , "Tremelo Bar"
- , "Alteration of Pace"
- ]
- fullFloats = [ "Gnome-mplayer"
- , "MPlayer"
- ]
- genFloats = [ "Qsynth"
- , "Qjackctl"
- ]
- cenFloats = [ "Lxappearance"
- , "Nitrogen"
- , "ROX-Filer"
- ]
- 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)
- , ("mutt", "mutt", 0.7, 0.5)
- ]
- 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)
- $ workspaceDir "~"
- $ 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 $
- -- launch a terminal
- [ ((modm, xK_Return), spawn $ XMonad.terminal conf)
- -- close focused window
- , ((modm, xK_Escape ), kill)
- -- Rotate through the available layout algorithms
- , ((modm, xK_grave ), sendMessage NextLayout)
- -- DWM style promoting
- , ((modm, xK_space ), dwmpromote)
- -- Move focus around stack
- , ((modm, xK_j ), windows W.focusDown)
- , ((modm, xK_k ), windows W.focusUp)
- -- Move windows around in stack
- , ((modm .|. shiftMask, xK_j ), windows W.swapDown)
- , ((modm .|. shiftMask, xK_k ), windows W.swapUp)
- -- Navigate around screns/workspaces
- , ((modm, xK_Left ), prevWS)
- , ((modm, xK_Right ), nextWS)
- , ((modm, xK_Tab ), nextScreen)
- , ((modm .|. shiftMask, xK_Tab ), toggleWS)
- -- Resize master area
- , ((modm, xK_s ), sendMessage Shrink)
- , ((modm, xK_x ), sendMessage Expand)
- -- Resize Slaves
- , ((modm, xK_z ), sendMessage MirrorShrink)
- , ((modm, xK_a ), sendMessage MirrorExpand)
- -- Toggle FullScreen for a window
- , ((modm, xK_f ), sendMessage $ Toggle NBFULL)
- -- Push window back into tiling
- , ((modm, xK_t ), withFocused $ windows . W.sink)
- -- Change # of windows in master area
- , ((modm, xK_comma ), sendMessage (IncMasterN 1))
- , ((modm, xK_period ), sendMessage (IncMasterN (-1)))
- -- Quit xmonad
- , ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
- -- Restart xmonad
- , ((modm, xK_q ), spawn "killall xmobar; xmonad --recompile; xmonad --restart")
- -- Change working directory
- , ((modm, xK_d ), changeDir myXPConfig)
- -- Prompts
- , ((modm, xK_p ), shellPrompt myXPConfig)
- , ((modm, xK_n ), appendFilePrompt myXPConfig "/home/zak/bin/notes")
- , ((modm, xK_m ), workspacePrompt myXPConfig $ windows . W.view)
- -- Launch Applications/Volume Control
- , ((modm, xK_w ), spawn "firefox")
- , ((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")
- ]
- ++
- -- Scratchpads (mapped from F12 to F1 keys automatically)
- [ ((0, x), namedScratchpadAction genScratchPads y) | (x,y) <- zip [xK_F12, xK_F11..xK_F1] myScratchPadNames ]
- ++
- -- mod-[1..9], Switch to workspace N
- [((modm, k), windows $ W.greedyView i)
- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
- ]
- ++
- -- Sends/follows a window to another workspace and
- -- places it on top of the slave stack, rather than
- -- replacing the master with the new window
- [((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","irc","aud1","aud2","gimp","sys","misc"]
- 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