diff --git a/src/XMonad/Custom/ProgramWorkSpaces.hs b/src/XMonad/Custom/ProgramWorkSpaces.hs index 8dbe2e8..82449ce 100644 --- a/src/XMonad/Custom/ProgramWorkSpaces.hs +++ b/src/XMonad/Custom/ProgramWorkSpaces.hs @@ -4,6 +4,7 @@ import XMonad import XMonad.Actions.WindowGo import XMonad.Custom.BindingUtils +import XMonad.Custom.Workspaces -- | @@ -56,28 +57,20 @@ myProgramWorkSpaces = map second4 myProgramWorkSpacesConfig -- | Bindings to move/focus to program workspaces -myProgramWorkSpacesBindingsRaw :: [(String, String)] -myProgramWorkSpacesBindingsRaw = (addModifierToBinding myProgramWorkSpaceSuperKey) - . (map quadrupleToPairFront) - $ myProgramWorkSpacesConfig -myProgramWorkSpacesFocusBindingsRaw :: [(String, X ())] -myProgramWorkSpacesFocusBindingsRaw = addWindowViewToBinding myProgramWorkSpacesBindingsRaw +rawFocusBindings :: [(String, X())] +myProgramWorkSpacesShiftBindings :: [(String, X())] +(rawFocusBindings, myProgramWorkSpacesShiftBindings) = + makeWorkspaces myProgramWorkSpaceSuperKey (map quadrupleToPairFront myProgramWorkSpacesConfig) myProgramWorkSpacesFocusBindingsNoLaunch :: [(String, X ())] -myProgramWorkSpacesFocusBindingsNoLaunch = addControlToBinding myProgramWorkSpacesFocusBindingsRaw +myProgramWorkSpacesFocusBindingsNoLaunch = addControlToBinding rawFocusBindings myProgramWorkSpacesFocusBindingsLaunch :: [(String, X ())] -myProgramWorkSpacesFocusBindingsLaunch = zipWithSnd (<+>) myProgramWorkSpacesFocusBindingsRaw +myProgramWorkSpacesFocusBindingsLaunch = zipWithSnd (<+>) rawFocusBindings $ map (\(a,b) -> runOrRaise a b) $ map quadrupleToPairBack myProgramWorkSpacesConfig -myProgramWorkSpacesShiftBindings :: [(String, X ())] -myProgramWorkSpacesShiftBindings = addShiftToBinding - . addWindowShiftToBinding - $ myProgramWorkSpacesBindingsRaw - - myProgramWorkSpacesKeyBindings :: [(String, X ())] myProgramWorkSpacesKeyBindings = concat [ myProgramWorkSpacesFocusBindingsNoLaunch diff --git a/src/XMonad/Custom/Workspaces.hs b/src/XMonad/Custom/Workspaces.hs new file mode 100644 index 0000000..b1dad80 --- /dev/null +++ b/src/XMonad/Custom/Workspaces.hs @@ -0,0 +1,14 @@ +module XMonad.Custom.Workspaces where + +import XMonad + +import XMonad.Custom.BindingUtils + +makeWorkspaces :: String -> [(String, String)] -> ([(String, X ())], [(String, X ())]) +makeWorkspaces m ws= (makeFocusBindings m ws, makeShiftBindings m ws) + +makeFocusBindings :: String -> [(String, String)] -> [(String, X ())] +makeFocusBindings modifier = (addModifierToBinding modifier) . addWindowViewToBinding + +makeShiftBindings :: String -> [(String, String)] -> [(String, X ())] +makeShiftBindings modifier = (addModifierToBinding modifier) . addWindowShiftToBinding . addShiftToBinding diff --git a/xmonad-custom.cabal b/xmonad-custom.cabal index bc7a324..918fea8 100644 --- a/xmonad-custom.cabal +++ b/xmonad-custom.cabal @@ -15,6 +15,7 @@ library XMonad.Custom.ProgramWorkSpaces XMonad.Custom.UniversitySetup XMonad.Custom.Layout + XMonad.Custom.Workspaces hs-source-dirs: src ghc-options: -funbox-strict-fields -Wall -Wno-unused-do-bind build-depends: base