From 7ee7f7ba3b55d89b2cbcf0fedf3bb5c25de7ae2b Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 4 Jul 2015 14:16:59 +0200 Subject: Extension of xmonad.hs --- .xmonad/xmonad.hs | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to '.xmonad/xmonad.hs') diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index 49778c5..7245ad3 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -14,7 +14,7 @@ import Control.Monad.State (get) import XMonad.Layout.Spiral import Data.Ratio import Data.List -import Data.Maybe (fromMaybe, listToMaybe) +import Data.Maybe (fromMaybe, listToMaybe, catMaybes) import XMonad.Layout.Tabbed import XMonad.Prompt import XMonad.Util.Scratchpad @@ -53,6 +53,7 @@ data Host l1 l2 = Host { hName :: HostName , hManageHook :: ManageHook , hWsp :: Integer -> WorkspaceId + , hCoWsp :: String -> Maybe WorkspaceId , hLayoutMod :: l1 -> l2 , hKeysMod :: XConfig Layout -> (KeyMap -> KeyMap) } @@ -60,25 +61,42 @@ data Host l1 l2 = Host defaultHost = Host { hName = "unkown" , hManageHook = composeOne [manageScratchTerm] , hWsp = show + , hCoWsp = const Nothing , hLayoutMod = id , hKeysMod = const id } --hostFromName :: (LayoutClass l1 a, LayoutClass l2 a) => HostName -> Host (l1 a) (l2 a) hostFromName h@("vali") = defaultHost { hName = h - , hManageHook = hManageHook defaultHost - , hWsp = \i -> case Map.lookup i workspaceNames of - Just str -> show i ++ " " ++ str - Nothing -> show i - , hLayoutMod = id + , hManageHook = composeOne [ manageScratchTerm + , className =? ".dwb-wrapped" -?> doShift (wsp 2) + , className =? "Chromium" -?> doShift (wsp 2) + ] + , hWsp = hWsp + , hCoWsp = hCoWsp + , hLayoutMod = mkMod [ hCoWsp "web" >>= \wsp -> onWorkspace wsp (noBorders Full ||| tabbedLayout tabbedBottomAlways) + ] , hKeysMod = \conf -> Map.union $ Map.fromList $ join $ map (spawnBindings conf) [ (xK_d, ["dwb", "dwb $(xclip -o)"]) ] } where workspaceNames = Map.fromList [ (1, "web") ] + hWsp = wspFromMap workspaceNames + hCoWsp = coWspFromMap workspaceNames hostFromName _ = defaultHost +wspFromMap workspaceNames = \i -> case Map.lookup i workspaceNames of + Just str -> show i ++ " " ++ str + Nothing -> show i + +coWspFromMap workspaceNames = \str -> case filter ((== str) . snd) $ Map.toList workspaceNames of + [] -> Nothing + [(i, _)] -> Just $ wspFromMap workspaceNames i + _ -> Nothing + +mkMod = foldl (.) id . catMaybes + spawnModifiers = [0, controlMask, shiftMask .|. controlMask] spawnBindings conf (k, cmds) = zipWith (\m cmd -> ((modm .|. mod1Mask .|. m, k), spawn cmd)) spawnModifiers cmds where -- cgit v1.2.3