summaryrefslogtreecommitdiff
path: root/.xmonad/xmonad.hs
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2015-07-03 23:41:04 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2015-07-03 23:41:04 +0200
commit888704927fce43a8caa932d6b3bb0158bd78bf0d (patch)
treee6e239634fbf8605088b0ef165836a7e4b068a4f /.xmonad/xmonad.hs
parentbb05ba59e5816c55780fa3ca9b5b6422de2af260 (diff)
downloaddotfiles-888704927fce43a8caa932d6b3bb0158bd78bf0d.tar
dotfiles-888704927fce43a8caa932d6b3bb0158bd78bf0d.tar.gz
dotfiles-888704927fce43a8caa932d6b3bb0158bd78bf0d.tar.bz2
dotfiles-888704927fce43a8caa932d6b3bb0158bd78bf0d.tar.xz
dotfiles-888704927fce43a8caa932d6b3bb0158bd78bf0d.zip
Further work on xmonad.hs (host dependent configs)
Diffstat (limited to '.xmonad/xmonad.hs')
-rw-r--r--.xmonad/xmonad.hs49
1 files changed, 34 insertions, 15 deletions
diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs
index 98352d3..241785a 100644
--- a/.xmonad/xmonad.hs
+++ b/.xmonad/xmonad.hs
@@ -31,6 +31,7 @@ import System.FilePath ((</>))
31import Control.Concurrent 31import Control.Concurrent
32import System.Posix.Process (getProcessID) 32import System.Posix.Process (getProcessID)
33import System.IO.Error 33import System.IO.Error
34import System.IO
34import XMonad.Hooks.ManageHelpers hiding (CW) 35import XMonad.Hooks.ManageHelpers hiding (CW)
35import XMonad.StackSet (RationalRect (..)) 36import XMonad.StackSet (RationalRect (..))
36import Control.Monad (when) 37import Control.Monad (when)
@@ -43,27 +44,52 @@ import XMonad.Layout.IM
43import XMonad.Prompt.MyShell 44import XMonad.Prompt.MyShell
44import XMonad.Prompt.MySsh 45import XMonad.Prompt.MySsh
45 46
46wsp :: Int -> WorkspaceId 47import Network.HostName
47wsp i = case Map.lookup i workspaceNames of 48
48 Just str -> (show i) ++ " " ++ str 49data Host l1 l2 = Host
49 Nothing -> (show i) 50 { hName :: HostName
50wsps = map wsp 51 , hManageHook :: ManageHook
52 , hWsp :: Integer -> WorkspaceId
53 , hLayoutMod :: l1 -> l2
54 }
55
56defaultHost = Host { hName = "unkown"
57 , hManageHook = composeOne [manageScratchTerm]
58 , hWsp = show
59 , hLayoutMod = id
60 }
61
62--hostFromName :: (LayoutClass l1 a, LayoutClass l2 a) => HostName -> Host (l1 a) (l2 a)
63hostFromName h@("vali") = defaultHost { hName = h
64 , hManageHook = hManageHook defaultHost
65 , hWsp = \i -> case Map.lookup i workspaceNames of
66 Just str -> show i ++ " " ++ str
67 Nothing -> show i
68 , hLayoutMod = id
69 }
70 where
71 workspaceNames = Map.fromList [ (1, "web")
72 ]
73hostFromName _ = defaultHost
74
75manageScratchTerm = resource =? "scratchpad" -?> doRectFloat $ RationalRect (1 % 16) (1 % 16) (7 % 8) (7 % 8)
51 76
52main = do 77main = do
53 xmobarProc <- spawnPipe "xmobar" 78 xmobarProc <- spawnPipe "xmobar"
79 host <- getHostName >>= return . hostFromName
54 let myConfig = defaultConfig { 80 let myConfig = defaultConfig {
55 manageHook = manageDocks <+> manageHook' 81 manageHook = manageDocks <+> hManageHook host
56 , terminal = "urxvtc" 82 , terminal = "urxvtc"
57 , layoutHook = smartBorders $ avoidStruts layout' 83 , layoutHook = smartBorders $ avoidStruts layout'
58 , logHook = dynamicLogWithPP xmobarPP' 84 , logHook = dynamicLogWithPP xmobarPP'
59 , modMask = mod4Mask 85 , modMask = mod4Mask
60 , keys = myKeys' 86 , keys = myKeys'
61 , workspaces = take (length numKeys) workspaces' 87 , workspaces = take (length numKeys) $ map (hWsp host) [1..]
62 , startupHook = assimilateKeychain >> (sequence autostart) >> (setDefaultCursor xC_left_ptr) >> banishScreen LowerRight >> return () 88 , startupHook = assimilateKeychain >> (sequence autostart) >> (setDefaultCursor xC_left_ptr) >> banishScreen LowerRight >> return ()
63 , normalBorderColor = "#202020" 89 , normalBorderColor = "#202020"
64 , focusedBorderColor = "white" 90 , focusedBorderColor = "white"
65 } 91 }
66 layout' = defaultLayouts 92 layout' = hLayoutMod host $ defaultLayouts
67 defaultLayouts = spiralWithDir East CW (1 % 2) ||| tabbedLayout tabbedBottom ||| noBorders Full ||| simplestFloat 93 defaultLayouts = spiralWithDir East CW (1 % 2) ||| tabbedLayout tabbedBottom ||| noBorders Full ||| simplestFloat
68 tabbedLayout t = renamed [Replace "Tabbed"] $ reflectHoriz $ t CustomShrink $ tabbedTheme 94 tabbedLayout t = renamed [Replace "Tabbed"] $ reflectHoriz $ t CustomShrink $ tabbedTheme
69 tabbedTheme = defaultTheme { activeColor = "black" 95 tabbedTheme = defaultTheme { activeColor = "black"
@@ -118,13 +144,6 @@ assimilateKeychain' = tryIOError $ do
118 144
119numKeys = [xK_parenleft, xK_parenright, xK_braceright, xK_plus, xK_braceleft, xK_bracketright, xK_bracketleft, xK_exclam, xK_equal, xK_asterisk] 145numKeys = [xK_parenleft, xK_parenright, xK_braceright, xK_plus, xK_braceleft, xK_bracketright, xK_bracketleft, xK_exclam, xK_equal, xK_asterisk]
120 146
121workspaces' = wsps [1..]
122workspaceNames = Map.fromList
123 []
124
125manageHook' = composeOne
126 []
127
128instance Shrinker CustomShrink where 147instance Shrinker CustomShrink where
129 shrinkIt _ "" = [""] 148 shrinkIt _ "" = [""]
130 shrinkIt s cs = cs : shrinkIt s ((reverse . drop 4 . reverse $ cs) ++ "...") 149 shrinkIt s cs = cs : shrinkIt s ((reverse . drop 4 . reverse $ cs) ++ "...")