From b0c55c16b555aa6d5d1a30b327f77b42399ea66e Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 15 Jul 2015 22:26:57 +0200 Subject: Introduced permutations to screen numbers in order to be more intuitive --- .xmonad/xmonad.hs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to '.xmonad') diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index 87d780f..6ee9140 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -52,12 +52,13 @@ import Control.Applicative ((<$>)) type KeyMap = Map (ButtonMask, KeySym) (X ()) -data Host l1 l2 = Host +data Host = Host { hName :: HostName , hManageHook :: ManageHook , hWsp :: Integer -> WorkspaceId , hCoWsp :: String -> Maybe WorkspaceId , hKeysMod :: XConfig Layout -> (KeyMap -> KeyMap) + , hScreenPerm :: [Integer] -> [Integer] } defaultHost = Host { hName = "unkown" @@ -65,9 +66,10 @@ defaultHost = Host { hName = "unkown" , hWsp = show , hCoWsp = const Nothing , hKeysMod = const id + , hScreenPerm = id } ---hostFromName :: (LayoutClass l1 a, LayoutClass l2 a) => HostName -> Host (l1 a) (l2 a) +hostFromName :: HostName -> Host (l1 a) (l2 a) hostFromName h@("vali") = defaultHost { hName = h , hManageHook = composeOne $ catMaybes [ Just manageScratchTerm , (\wsp -> className =? ".dwb-wrapped" -?> doShift wsp) <$> hCoWsp "web" @@ -77,12 +79,16 @@ hostFromName h@("vali") = defaultHost { hName = h , hCoWsp = hCoWsp , hKeysMod = \conf -> Map.union $ Map.fromList $ join $ map (spawnBindings conf) [ (xK_d, ["dwb", "dwb $(xclip -o)"]) ] + , hScreenPerm = hScreenPerm } where workspaceNames = Map.fromList [ (2, "web") ] hWsp = wspFromMap workspaceNames hCoWsp = coWspFromMap workspaceNames + hScreenPerm 1 = 2 + hScreenPerm 2 = 1 + hScreenPerm x = x hostFromName _ = defaultHost wspFromMap workspaceNames = \i -> case Map.lookup i workspaceNames of @@ -123,7 +129,7 @@ main = do , layoutHook = smartBorders $ avoidStruts layout' , logHook = dynamicLogWithPP xmobarPP' , modMask = mod4Mask - , keys = \conf -> hKeysMod host conf $ myKeys' conf + , keys = \conf -> hKeysMod host conf $ myKeys' conf host , workspaces = take (length numKeys) $ map wsp [1..] , startupHook = assimilateKeychain >> (sequence autostart) >> (setDefaultCursor xC_left_ptr) >> banishScreen LowerRight >> return () , normalBorderColor = "#202020" @@ -213,7 +219,7 @@ sshOverrides = map (\h -> mkOverride { oHost = h, oCommand = moshCmd . inTmux } [ "galois", "galois.praseodym.org" ] -myKeys' conf = Map.fromList $ +myKeys' conf host = Map.fromList $ -- launch a terminal [ ((modm, xK_Return), spawn $ (XMonad.terminal conf) ++ " -e tmux") , ((modm .|. controlMask, xK_Return), scratchpadSpawnActionCustom $ (XMonad.terminal conf) ++ " -name scratchpad -title scratchpad -e tmux") @@ -299,7 +305,7 @@ myKeys' conf = Map.fromList $ ] ++ [((m .|. modm .|. controlMask, k), screenWorkspace i >>= (flip whenJust) (windows . f)) - | (i, k) <- zip [0..] [xK_g, xK_c, xK_r, xK_l] + | (i, k) <- zip (hScreenPerm host [0..]) [xK_g, xK_c, xK_r, xK_l] , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] ] where -- cgit v1.2.3