diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-07-03 23:41:04 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-07-03 23:41:04 +0200 |
commit | 888704927fce43a8caa932d6b3bb0158bd78bf0d (patch) | |
tree | e6e239634fbf8605088b0ef165836a7e4b068a4f /.xmonad/xmonad.hs | |
parent | bb05ba59e5816c55780fa3ca9b5b6422de2af260 (diff) | |
download | dotfiles-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.hs | 49 |
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 ((</>)) | |||
31 | import Control.Concurrent | 31 | import Control.Concurrent |
32 | import System.Posix.Process (getProcessID) | 32 | import System.Posix.Process (getProcessID) |
33 | import System.IO.Error | 33 | import System.IO.Error |
34 | import System.IO | ||
34 | import XMonad.Hooks.ManageHelpers hiding (CW) | 35 | import XMonad.Hooks.ManageHelpers hiding (CW) |
35 | import XMonad.StackSet (RationalRect (..)) | 36 | import XMonad.StackSet (RationalRect (..)) |
36 | import Control.Monad (when) | 37 | import Control.Monad (when) |
@@ -43,27 +44,52 @@ import XMonad.Layout.IM | |||
43 | import XMonad.Prompt.MyShell | 44 | import XMonad.Prompt.MyShell |
44 | import XMonad.Prompt.MySsh | 45 | import XMonad.Prompt.MySsh |
45 | 46 | ||
46 | wsp :: Int -> WorkspaceId | 47 | import Network.HostName |
47 | wsp i = case Map.lookup i workspaceNames of | 48 | |
48 | Just str -> (show i) ++ " " ++ str | 49 | data Host l1 l2 = Host |
49 | Nothing -> (show i) | 50 | { hName :: HostName |
50 | wsps = map wsp | 51 | , hManageHook :: ManageHook |
52 | , hWsp :: Integer -> WorkspaceId | ||
53 | , hLayoutMod :: l1 -> l2 | ||
54 | } | ||
55 | |||
56 | defaultHost = 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) | ||
63 | hostFromName 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 | ] | ||
73 | hostFromName _ = defaultHost | ||
74 | |||
75 | manageScratchTerm = resource =? "scratchpad" -?> doRectFloat $ RationalRect (1 % 16) (1 % 16) (7 % 8) (7 % 8) | ||
51 | 76 | ||
52 | main = do | 77 | main = 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 | ||
119 | numKeys = [xK_parenleft, xK_parenright, xK_braceright, xK_plus, xK_braceleft, xK_bracketright, xK_bracketleft, xK_exclam, xK_equal, xK_asterisk] | 145 | numKeys = [xK_parenleft, xK_parenright, xK_braceright, xK_plus, xK_braceleft, xK_bracketright, xK_bracketleft, xK_exclam, xK_equal, xK_asterisk] |
120 | 146 | ||
121 | workspaces' = wsps [1..] | ||
122 | workspaceNames = Map.fromList | ||
123 | [] | ||
124 | |||
125 | manageHook' = composeOne | ||
126 | [] | ||
127 | |||
128 | instance Shrinker CustomShrink where | 147 | instance 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) ++ "...") |