From f3e7a3dbb76f54608cd01b26cfdb3403d9822797 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Wed, 10 Apr 2019 15:55:14 -0700 Subject: xmonad: new layouts --- xmonad.hs | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 7 deletions(-) (limited to 'xmonad.hs') diff --git a/xmonad.hs b/xmonad.hs index 2304e9c..4ea6da9 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -11,15 +11,23 @@ Docs: -} +import Graphics.X11.ExtraTypes.XF86 import XMonad +import XMonad.Actions.CopyWindow import XMonad.Config import XMonad.Hooks.EwmhDesktops (ewmh) import XMonad.Hooks.ManageDocks +import XMonad.Layout.BinarySpacePartition +import XMonad.Layout.Dwindle as Dwindle +import XMonad.Layout.LayoutModifier +import XMonad.Layout.NoBorders +import XMonad.Layout.ResizableTile +import XMonad.Layout.Spacing import XMonad.Layout.Spiral +import XMonad.Layout.Tabbed +import XMonad.Layout.TwoPane import XMonad.Util.CustomKeys (customKeys) -import XMonad.Actions.CopyWindow import XMonad.Util.EZConfig (additionalKeys) -import Graphics.X11.ExtraTypes.XF86 nixBin :: String nixBin = "/home/ben/.nix-profile/bin/" @@ -27,6 +35,10 @@ nixBin = "/home/ben/.nix-profile/bin/" altMask :: KeyMask altMask = mod1Mask +-- Colors +cyan = "#2aa198" -- ^ solarized cyan +base3 = "#eee8d4" -- ^ solarized base3 + insKeys :: XConfig l -> [((KeyMask, KeySym), X ())] insKeys conf@(XConfig {modMask = modMask}) = [ ((modMask, xK_y), spawn $ nixBin <> "passmenu") @@ -61,20 +73,57 @@ insKeys conf@(XConfig {modMask = modMask}) = amixer :: String -> X () amixer cmd = spawn $ "amixer -q sset Master " <> cmd -myLayout :: SpiralWithDir a -myLayout = spiral (6 / 7) +-- | Golden-ratio spiral +goldenSpiral :: SpiralWithDir a +goldenSpiral = spiral (6 / 7) myWorkspaces :: [String] myWorkspaces = ["1:chat", "2:emacs", "3:work"] ++ map show [4 .. 9] ++ ["0"] +addSpace :: l a -> ModifiedLayout Spacing l a +addSpace = spacingRaw + True (Border 5 5 5 5) + True (Border 5 5 5 5) + True + +myTabCfg = def { fontName = "xft:mononoki:size=10:ant" + , activeBorderColor = cyan + , inactiveBorderColor = base3 + , activeColor = base3 + , inactiveColor = base3 + } + +myLayout = avoidStruts $ + noBorders (tabbed shrinkText myTabCfg) -- default tab config + ||| tiled + ||| Mirror tiled + -- ||| noBorders Full + ||| twopane + ||| Mirror twopane + ||| emptyBSP + ||| goldenSpiral + ||| Spiral L Dwindle.CW (3/2) (11/10) -- L means the non-main windows are put to the left. + where + -- The last parameter is fraction to multiply the slave window heights + -- with. Useless here. + tiled = addSpace $ ResizableTall nmaster delta ratio [] + -- In this layout the second pane will only show the focused window. + twopane = addSpace $ TwoPane delta ratio + -- The default number of windows in the master pane + nmaster = 1 + -- Default proportion of screen occupied by master pane + ratio = 1/2 + -- Percent of screen to increment by when resizing panes + delta = 3/100 + myConf = additionalKeys c (insKeys c) where c = def { modMask = mod4Mask -- ^ super instead of alt - , normalBorderColor = "#eee8d4" -- ^ solarized base3 - , focusedBorderColor = "#2aa198" -- ^ solarized cyan + , normalBorderColor = base3 + , focusedBorderColor = cyan , borderWidth = 3 , manageHook = manageDocks <+> manageHook def - , layoutHook = avoidStruts $ myLayout ||| layoutHook def + , layoutHook = myLayout , terminal = "/home/ben/.nix-profile/bin/xterm" , workspaces = myWorkspaces } -- cgit v1.2.3