Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

162 lines
6.5 KiB

-- This is my xmonad configuration. Take it as read that I do not know what I
-- am doing in this file. It is pure magpie behavior with little underlying
-- logic. I do not know Haskell.
-- Sources:
-- Things I have bookmarked: https://pinboard.in/search/u:brennen?query=xmonad
-- Tyler Cipriani's setup: https://github.com/thcipriani/dotfiles/blob/master/xmonad/xmonad.hs
-- http://haskell.org/haskellwiki/Xmonad/Config_archive/John_Goerzen%27s_Configuration
-- http://www.xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Doc-Configuring.html
-- http://hackage.haskell.org/packages/archive/xmonad-contrib/0.8.1/doc/html/XMonad-Doc-Extending.html
-- http://hackage.haskell.org/packages/archive/xmonad-contrib/0.8.1/doc/html/XMonad-Actions-CycleWS.html
-- http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-GridSelect.html
-- I think we do this because otherwise Data.Map.keys would overlap
-- with XMonad.keys:
import qualified Data.Map as M
import System.IO
import qualified XMonad.StackSet as W -- used by the scratchpad stuff below
import XMonad
import XMonad.Actions.CycleWS
import XMonad.Actions.GridSelect
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers(isFullscreen, isDialog, doFullFloat, doCenterFloat)
import XMonad.Layout.Accordion
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Layout.Spacing
import XMonad.Layout.Tabbed
import XMonad.Layout.ToggleLayouts
import XMonad.Util.EZConfig(additionalKeys) -- Easier keybindings, not in use here yet
import XMonad.Util.NamedScratchpad
import XMonad.Util.NamedWindows
import XMonad.Util.Run(runInTerm) -- Need this guy for keybindings to external commands
import XMonad.Util.Run(spawnPipe) -- Need this guy for talking to xmobar
import XMonad.Util.Run(unsafeSpawn) -- Need this guy for keybindings to external commands
-- Tomorrow Night Colors:
colorBackground = "#1d1f21"
colorCurrent = "#282a2e"
colorSelection = "#373b41"
colorForeground = "#c5c8c6"
colorComment = "#969896"
colorRed = "#cc6666"
colorOrange = "#de935f"
colorYellow = "#f0c674"
colorGreen = "#b5bd68"
colorAqua = "#8abeb7"
colorBlue = "#81a2be"
colorPurple = "#b294bb"
-- A breakdown of desired workspaces:
-- [NSP] - named scratchpads; created implicitly by namedScratchpad stuff
-- - one gnome-terminal
-- - one gnome-terminal with a tmux containing a vim with notes
-- top - for monitoring, logs, and remote shells
-- mail - originally for thunderbird, now a rarely-used spare
-- irc - chat clients (weechat, hipchat, slack, signal, etc.)
-- code - development and writing
-- browse - web browser(s)
-- org - a vim with notes file and such
-- media - photos, graphics work, video, file managers, etc.
-- This is some crazy shit, man:
main = do
xmproc <- spawnPipe "xmobar"
xmonad $ ewmh defaultConfig
{ borderWidth = 1
, normalBorderColor = "#281DF2"
, focusedBorderColor = "#24AD09"
, workspaces = ["top", "mail", "irc", "code", "browse", "org", "media"]
-- , terminal = "uxterm"
, terminal = "konsole"
, keys = newKeys
, manageHook = manageDocks <+> myManageHook
<+> manageHook defaultConfig
, layoutHook = myLayout
, logHook = dynamicLogWithPP $ xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "green" "" . shorten 50
}
-- Rebind Mod to the Windows key:
, modMask = mod4Mask
}
newKeys x = M.union (keys defaultConfig x) (M.fromList (myKeys x))
myKeys x =
[ ((modMask x, xK_Right), nextWS)
, ((modMask x, xK_Left), prevWS)
, ((modMask x .|. shiftMask, xK_Down), shiftToNext)
, ((modMask x .|. shiftMask, xK_Up), shiftToPrev)
, ((modMask x .|. shiftMask, xK_Right), shiftNextScreen)
, ((modMask x .|. shiftMask, xK_Left), shiftPrevScreen)
, ((modMask x, xK_z), toggleWS)
, ((modMask x, xK_g), goToSelected defaultGSConfig)
, ((modMask x .|. shiftMask, xK_g), spawn "jump-to-window")
, ((modMask x, xK_grave), namedScratchpadAction scratchpads "scratch")
-- I am not sure why I can't use mod-n here, but it works with mod-shift-n:
, ((modMask x .|. shiftMask, xK_n), namedScratchpadAction scratchpads "notes")
]
myManageHook = composeAll
[ className =? "Gimp" --> doFloat
, className =? "Vncviewer" --> doFloat
, className =? "Nautilus" --> doFloat
, className =? "Svkbd" --> doFloat
, className =? "Google-chrome" --> doShift "web"
, className =? "Firefox" --> doShift "web"
, isFullscreen --> doFullFloat
, namedScratchpadManageHook scratchpads
]
-- Named scratchpads - a terminal and a tmux session for editing notes in. I
-- use gnome-terminal with a role for both of these instead of uxterm with a
-- title, because title gets changed by running stuff inside of xterms, seemingly
-- no matter how things are configured. See also /bin/notesession.
scratchpads =
[ NS "scratch" "gnome-terminal --role scratch" (role =? "scratch")
-- this goes: start-x, start-y, width (1.0 is full screen), height:
(customFloating $ W.RationalRect 0.0 0.0 1.0 0.5)
, NS "notes" "gnome-terminal --role=notesession -e notesession" (role =? "notesession")
(customFloating $ W.RationalRect 0.3 0.0 0.7 0.95)
] where role = stringProperty "WM_WINDOW_ROLE"
myTabConfig = defaultTheme
{ inactiveBorderColor = colorBackground
, activeBorderColor = colorGreen
, activeColor = colorCurrent
, inactiveColor = colorBackground
, inactiveTextColor = colorComment
, activeTextColor = colorForeground
}
-- Originally this was just:
-- myLayout = avoidStruts $ layoutHook defaultConfig
-- ...stole thcipriani's version whole cloth to try out tabs.
myLayout = avoidStruts
$ toggleLayouts tiledSpace
$ smartBorders
$ basicRotate
where
basicRotate = Full ||| tabbed shrinkText myTabConfig ||| fullTiled ||| Mirror fullTiled
-- tiled = spacing 5 $ ResizableTall nmaster delta ratio []
tiledSpace = spacing 60 $ ResizableTall nmaster delta ratio []
fullTiled = ResizableTall nmaster delta ratio []
-- The default number of windows in the master pane
nmaster = 1
-- Default proportion of screen occupied by master pane
ratio = toRational (2/(1 + sqrt 5 :: Double))
-- Percent of screen to increment by when resizing panes
delta = 5/100