simplify creation of (program) work spaces

This commit is contained in:
Maximilian Keßler 2022-07-17 09:44:08 +02:00
parent b7d544e638
commit 0516f51ba6
3 changed files with 22 additions and 14 deletions

View file

@ -4,6 +4,7 @@ import XMonad
import XMonad.Actions.WindowGo import XMonad.Actions.WindowGo
import XMonad.Custom.BindingUtils import XMonad.Custom.BindingUtils
import XMonad.Custom.Workspaces
-- | -- |
@ -56,28 +57,20 @@ myProgramWorkSpaces = map second4 myProgramWorkSpacesConfig
-- | Bindings to move/focus to program workspaces -- | Bindings to move/focus to program workspaces
myProgramWorkSpacesBindingsRaw :: [(String, String)]
myProgramWorkSpacesBindingsRaw = (addModifierToBinding myProgramWorkSpaceSuperKey)
. (map quadrupleToPairFront)
$ myProgramWorkSpacesConfig
myProgramWorkSpacesFocusBindingsRaw :: [(String, X ())] rawFocusBindings :: [(String, X())]
myProgramWorkSpacesFocusBindingsRaw = addWindowViewToBinding myProgramWorkSpacesBindingsRaw myProgramWorkSpacesShiftBindings :: [(String, X())]
(rawFocusBindings, myProgramWorkSpacesShiftBindings) =
makeWorkspaces myProgramWorkSpaceSuperKey (map quadrupleToPairFront myProgramWorkSpacesConfig)
myProgramWorkSpacesFocusBindingsNoLaunch :: [(String, X ())] myProgramWorkSpacesFocusBindingsNoLaunch :: [(String, X ())]
myProgramWorkSpacesFocusBindingsNoLaunch = addControlToBinding myProgramWorkSpacesFocusBindingsRaw myProgramWorkSpacesFocusBindingsNoLaunch = addControlToBinding rawFocusBindings
myProgramWorkSpacesFocusBindingsLaunch :: [(String, X ())] myProgramWorkSpacesFocusBindingsLaunch :: [(String, X ())]
myProgramWorkSpacesFocusBindingsLaunch = zipWithSnd (<+>) myProgramWorkSpacesFocusBindingsRaw myProgramWorkSpacesFocusBindingsLaunch = zipWithSnd (<+>) rawFocusBindings
$ map (\(a,b) -> runOrRaise a b) $ map (\(a,b) -> runOrRaise a b)
$ map quadrupleToPairBack myProgramWorkSpacesConfig $ map quadrupleToPairBack myProgramWorkSpacesConfig
myProgramWorkSpacesShiftBindings :: [(String, X ())]
myProgramWorkSpacesShiftBindings = addShiftToBinding
. addWindowShiftToBinding
$ myProgramWorkSpacesBindingsRaw
myProgramWorkSpacesKeyBindings :: [(String, X ())] myProgramWorkSpacesKeyBindings :: [(String, X ())]
myProgramWorkSpacesKeyBindings = concat [ myProgramWorkSpacesKeyBindings = concat [
myProgramWorkSpacesFocusBindingsNoLaunch myProgramWorkSpacesFocusBindingsNoLaunch

View file

@ -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

View file

@ -15,6 +15,7 @@ library
XMonad.Custom.ProgramWorkSpaces XMonad.Custom.ProgramWorkSpaces
XMonad.Custom.UniversitySetup XMonad.Custom.UniversitySetup
XMonad.Custom.Layout XMonad.Custom.Layout
XMonad.Custom.Workspaces
hs-source-dirs: src hs-source-dirs: src
ghc-options: -funbox-strict-fields -Wall -Wno-unused-do-bind ghc-options: -funbox-strict-fields -Wall -Wno-unused-do-bind
build-depends: base build-depends: base