import XMonad import qualified XMonad.StackSet as W import XMonad hiding ((|||)) -- actions import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen) import XMonad.Actions.CopyWindow import XMonad.Actions.CycleWS import XMonad.Actions.Navigation2D import XMonad.Actions.CycleSelectedLayouts import XMonad.Actions.GridSelect import XMonad.Actions.SwapWorkspaces import XMonad.Actions.WindowBringer -- layouts modifiers import XMonad.Layout.Spacing import XMonad.Layout.LayoutModifier import XMonad.Layout.LayoutCombinators ((|||)) -- import XMonad.Layout.Gaps -- import XMonad.Layout.ShowWName -- Layouts import XMonad.Layout.GridVariants (Grid(Grid)) import XMonad.Layout.SimplestFloat import XMonad.Layout.Spiral import XMonad.Layout.ResizableTile import XMonad.Layout.Tabbed import XMonad.Layout.ThreeColumns -- hooks import XMonad.Hooks.SetWMName -- import XMonad.Hooks.WallpaperSetter -- utilities import XMonad.Util.SpawnOnce import XMonad.Util.EZConfig (additionalKeys) myStartupHook :: X () myStartupHook = do spawnOnce "nitrogen --restore &" spawnOnce "picom &" spawnOnce "deadd-notification-center &" -- spawnOnce "firefox &" spawnOnce "sxhkd &" setWMName "XMonad" -- defaults -- myFont :: String -- myFont = "Roboto" myModMask :: KeyMask myModMask = mod4Mask myTerminal :: String myTerminal = "st" myBrowser :: String myBrowser = "firefox" -- myEditor :: String -- myEditor = "vim" -- ~defaults~ -- wm variables nBorder = "#bf00ff" fBorder = "#FB027F" myBorderWidth = 2 myExtraWorkspaces = [(xK_0, "10")] -- ,(xK_minus, "tmp"),(xK_equal, "swap")] myWorkspaces = ["1","2","3","4","5","6","7","8", "9"] ++ (map snd myExtraWorkspaces) myLayoutHook = windowGaps 2 3 -- ~wm variables~ -- functions windowGaps i j = spacingRaw False (Border i i i i) True (Border j j j j) True $ layoutHook def -- ~functions~ -- keybindings myKeys = [ ((mod4Mask, xK_Return), spawn myTerminal), ((mod1Mask, xK_w), kill1), ((mod1Mask .|. shiftMask, xK_k), kill1), -- view prev/next workspaces ((mod1Mask, xK_h), prevWS), ((mod1Mask, xK_l), nextWS), -- move to prev/next workspaces ((mod1Mask .|. shiftMask, xK_h), shiftToPrev >> prevWS), ((mod1Mask .|. shiftMask, xK_l), shiftToNext >> nextWS), -- modify gaps on runtime ((mod1Mask, xK_equal), incWindowSpacing 1), ((mod1Mask, xK_minus), decWindowSpacing 1), ((mod1Mask .|. shiftMask, xK_equal), incScreenSpacing 1), ((mod1Mask .|. shiftMask, xK_minus), decScreenSpacing 1), ((mod4Mask .|. shiftMask, xK_Return), windows W.swapMaster), -- Swap the focused window and the master window -- directional navigation of windows ((mod4Mask, xK_l), windowGo R False), ((mod4Mask, xK_h), windowGo L False), ((mod4Mask, xK_k), windowGo U False), ((mod4Mask, xK_j), windowGo D False), -- swap adjacent windows ((mod4Mask .|. shiftMask, xK_l), windowSwap R False), ((mod4Mask .|. shiftMask, xK_h), windowSwap L False), ((mod4Mask .|. shiftMask, xK_k), windowSwap U False), ((mod4Mask .|. shiftMask, xK_j), windowSwap D False), -- cycle through windows ((mod1Mask, xK_j), windows W.focusDown), ((mod1Mask, xK_k), windows W.focusUp), -- grid select ((mod1Mask, xK_n), goToSelected defaultGSConfig), -- windowbringer ((mod1Mask, xK_b), bringMenu), ((mod1Mask, xK_g), gotoMenu) ] ++ [ -- for extra workspace(s) ((myModMask, key), (windows $ W.greedyView ws)) | (key,ws) <- myExtraWorkspaces ] ++ [ -- also for extra workspaces ((myModMask .|. shiftMask, key), (windows $ W.shift ws)) | (key,ws) <- myExtraWorkspaces ] ++ [ -- to swap workspaces ((mod4Mask .|. controlMask, k), windows $ swapWithCurrent i) | (i, k) <- zip myWorkspaces [xK_1 ..] ] -- ~keybindings~ main = do xmonad $ def { terminal = myTerminal, focusFollowsMouse = True, borderWidth = myBorderWidth, modMask = myModMask, workspaces = myWorkspaces, normalBorderColor = nBorder, focusedBorderColor = fBorder, -- mouseBindings = myMouseBindings, -- hooks, layouts layoutHook = myLayoutHook, --manageHook = myManageHook, --handleEventHook = myEventHook, -- logHook = wallpaperSetterHook, startupHook = myStartupHook } `additionalKeys` myKeys