refactor: remove modal editing and BSP layout
- Remove XMonad.Hooks.Modal and editMode functionality - Remove XMonad.Layout.BinarySpacePartition layout - Add window rotation (rotAllUp/Down) mirroring wezterm behavior - Add master pane manipulation with mnemonic bindings: - M-C-Left/Right: control layout (shrink/expand master) - M-S-Left/Right: shift windows (adjust master count) - Add master window operations on Delete key: - M-Delete: focus master - M-S-Delete: swap to master - Add screen navigation via Navigation2D: - M-C-Home: focus left monitor - M-C-End: focus right monitor - Fix M-a t conflict (d=dynamic tiling, t=thunar) - Restore original ppOrder from pre-modal configuration - Consolidate all window management on navigation layer
This commit is contained in:
parent
3063b4e06a
commit
267f4edcf1
1 changed files with 36 additions and 93 deletions
127
src/xmonad.hs
127
src/xmonad.hs
|
|
@ -1,21 +1,17 @@
|
||||||
import Data.List as L
|
import Data.List as L
|
||||||
import Data.Map qualified as M
|
|
||||||
import XMonad
|
import XMonad
|
||||||
import XMonad.Actions.CycleWS
|
import XMonad.Actions.CycleWS
|
||||||
import XMonad.Actions.Navigation2D
|
import XMonad.Actions.Navigation2D
|
||||||
import XMonad.Actions.Submap
|
import XMonad.Actions.RotSlaves
|
||||||
import XMonad.Hooks.DynamicLog
|
import XMonad.Hooks.DynamicLog
|
||||||
import XMonad.Hooks.EwmhDesktops
|
import XMonad.Hooks.EwmhDesktops
|
||||||
import XMonad.Hooks.ManageDocks
|
import XMonad.Hooks.ManageDocks
|
||||||
import XMonad.Hooks.Modal
|
|
||||||
import XMonad.Hooks.StatusBar
|
import XMonad.Hooks.StatusBar
|
||||||
import XMonad.Layout.BinarySpacePartition
|
|
||||||
import XMonad.Layout.NoBorders
|
import XMonad.Layout.NoBorders
|
||||||
import XMonad.Layout.Renamed
|
import XMonad.Layout.Renamed
|
||||||
import XMonad.Layout.Spacing
|
import XMonad.Layout.Spacing
|
||||||
import XMonad.StackSet qualified as W
|
import XMonad.StackSet qualified as W
|
||||||
import XMonad.Util.EZConfig
|
import XMonad.Util.EZConfig
|
||||||
import XMonad.Util.Font
|
|
||||||
import XMonad.Util.Loggers
|
import XMonad.Util.Loggers
|
||||||
|
|
||||||
import Graphics.X11.ExtraTypes.XF86
|
import Graphics.X11.ExtraTypes.XF86
|
||||||
|
|
@ -34,7 +30,6 @@ main = xmonad
|
||||||
. ewmhFullscreen
|
. ewmhFullscreen
|
||||||
. ewmh
|
. ewmh
|
||||||
. withNavigation2DConfig def
|
. withNavigation2DConfig def
|
||||||
. modal [editMode]
|
|
||||||
. withSB myXmobar
|
. withSB myXmobar
|
||||||
$ myConfig
|
$ myConfig
|
||||||
|
|
||||||
|
|
@ -77,24 +72,20 @@ myKeymap =
|
||||||
-- spawning programs
|
-- spawning programs
|
||||||
[ ("M-a n", spawn myTerminal )
|
[ ("M-a n", spawn myTerminal )
|
||||||
, ("M-a e", spawn myLauncher )
|
, ("M-a e", spawn myLauncher )
|
||||||
, ("M-a f", spawn myFileManager)
|
, ("M-a t", spawn myFileManager)
|
||||||
, ("M-a s", spawn myScrot )
|
, ("M-a s", spawn myScrot )
|
||||||
|
|
||||||
|
-- toggling layouts
|
||||||
|
, ("M-a d", sendMessage $ JumpToLayout "dynamic tiling")
|
||||||
|
, ("M-a m", sendMessage $ JumpToLayout "maximised" )
|
||||||
|
, ("M-a f", sendMessage $ JumpToLayout "fullscreen" )
|
||||||
|
|
||||||
-- quit window
|
-- quit window
|
||||||
, ("M-a q", kill)
|
, ("M-a q", kill)
|
||||||
|
|
||||||
-- toggling layouts
|
|
||||||
, ("M-a <Backspace> t", sendMessage $ JumpToLayout "dynamic tiling" )
|
|
||||||
, ("M-a <Backspace> b", sendMessage $ JumpToLayout "binary space partition")
|
|
||||||
, ("M-a <Backspace> m", sendMessage $ JumpToLayout "maximised" )
|
|
||||||
, ("M-a <Backspace> f", sendMessage $ JumpToLayout "fullscreen" )
|
|
||||||
|
|
||||||
-- enable modal modes
|
|
||||||
, ("M-a m e", setMode "edit")
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Modifier Keys
|
-- Layout Navigation
|
||||||
--
|
--
|
||||||
|
|
||||||
-- directional navigation of windows
|
-- directional navigation of windows
|
||||||
|
|
@ -103,16 +94,22 @@ myKeymap =
|
||||||
, ("M-<Down>" , windowGo D False)
|
, ("M-<Down>" , windowGo D False)
|
||||||
, ("M-<Right>" , windowGo R False)
|
, ("M-<Right>" , windowGo R False)
|
||||||
|
|
||||||
-- swap adjacent windows
|
|
||||||
, ("M-S-<Up>" , windowSwap U False)
|
|
||||||
, ("M-S-<Left>" , windowSwap L False)
|
|
||||||
, ("M-S-<Down>" , windowSwap D False)
|
|
||||||
, ("M-S-<Right>", windowSwap R False)
|
|
||||||
|
|
||||||
-- cycle windows
|
-- cycle windows
|
||||||
, ("M-<Page_Up>" , windows W.focusUp )
|
, ("M-<Page_Up>" , windows W.focusUp )
|
||||||
, ("M-<Page_Down>", windows W.focusDown)
|
, ("M-<Page_Down>", windows W.focusDown)
|
||||||
|
|
||||||
|
-- window rotation
|
||||||
|
, ("M-C-<Page_Up>", rotAllUp)
|
||||||
|
, ("M-C-<Page_Down>", rotAllDown)
|
||||||
|
|
||||||
|
-- cycle workspaces
|
||||||
|
, ("M-<Home>", moveTo Prev hiddenWS)
|
||||||
|
, ("M-<End>" , moveTo Next hiddenWS)
|
||||||
|
|
||||||
|
-- focus screens (directional)
|
||||||
|
, ("M-C-<Home>", screenGo L False) -- focus left monitor
|
||||||
|
, ("M-C-<End>", screenGo R False) -- focus right monitor
|
||||||
|
|
||||||
-- switch workspaces
|
-- switch workspaces
|
||||||
, ("M-1", windows $ W.greedyView "code" )
|
, ("M-1", windows $ W.greedyView "code" )
|
||||||
, ("M-2", windows $ W.greedyView "chat" )
|
, ("M-2", windows $ W.greedyView "chat" )
|
||||||
|
|
@ -120,10 +117,6 @@ myKeymap =
|
||||||
, ("M-4", windows $ W.greedyView "games")
|
, ("M-4", windows $ W.greedyView "games")
|
||||||
, ("M-5", windows $ W.greedyView "misc" )
|
, ("M-5", windows $ W.greedyView "misc" )
|
||||||
|
|
||||||
-- cycle workspaces
|
|
||||||
, ("M-<Home>", moveTo Prev hiddenWS)
|
|
||||||
, ("M-<End>" , moveTo Next hiddenWS)
|
|
||||||
|
|
||||||
-- send window to workspace
|
-- send window to workspace
|
||||||
, ("M-S-1", windows $ W.shift "code" )
|
, ("M-S-1", windows $ W.shift "code" )
|
||||||
, ("M-S-2", windows $ W.shift "chat" )
|
, ("M-S-2", windows $ W.shift "chat" )
|
||||||
|
|
@ -131,6 +124,16 @@ myKeymap =
|
||||||
, ("M-S-4", windows $ W.shift "games")
|
, ("M-S-4", windows $ W.shift "games")
|
||||||
, ("M-S-5", windows $ W.shift "misc" )
|
, ("M-S-5", windows $ W.shift "misc" )
|
||||||
|
|
||||||
|
-- master pane manipulation
|
||||||
|
, ("M-C-<Left>", sendMessage Shrink) -- control layout: shrink master
|
||||||
|
, ("M-C-<Right>", sendMessage Expand) -- control layout: expand master
|
||||||
|
, ("M-S-<Left>", sendMessage (IncMasterN (-1))) -- shift windows: fewer in master
|
||||||
|
, ("M-S-<Right>", sendMessage (IncMasterN 1)) -- shift windows: more in master
|
||||||
|
|
||||||
|
-- master window operations
|
||||||
|
, ("M-<Delete>", windows W.focusMaster)
|
||||||
|
, ("M-S-<Delete>", windows W.swapMaster)
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Multimedia
|
-- Multimedia
|
||||||
|
|
@ -145,73 +148,16 @@ myKeymap =
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Modal keybindings
|
|
||||||
--
|
|
||||||
|
|
||||||
editMode :: Mode
|
|
||||||
editMode = mode "edit" $ mkKeysEz
|
|
||||||
--
|
|
||||||
-- Navigation2D / DynamicTiling
|
|
||||||
--
|
|
||||||
|
|
||||||
-- directional navigation of windows
|
|
||||||
[ ("o", windowGo U False)
|
|
||||||
, ("n", windowGo L False)
|
|
||||||
, ("e", windowGo D False)
|
|
||||||
, ("i", windowGo R False)
|
|
||||||
|
|
||||||
-- swap adjacent windows
|
|
||||||
, ("S-o", windowSwap U False)
|
|
||||||
, ("S-n", windowSwap L False)
|
|
||||||
, ("S-e", windowSwap D False)
|
|
||||||
, ("S-i", windowSwap R False)
|
|
||||||
|
|
||||||
-- shrink/expand the master area
|
|
||||||
, ("f", sendMessage Shrink)
|
|
||||||
, ("u", sendMessage Expand)
|
|
||||||
|
|
||||||
-- number of windows in the master area
|
|
||||||
, ("S-f", sendMessage (IncMasterN 1) )
|
|
||||||
, ("S-u", sendMessage (IncMasterN (-1)))
|
|
||||||
|
|
||||||
--
|
|
||||||
-- BinarySpacePartition
|
|
||||||
--
|
|
||||||
|
|
||||||
-- expand windows
|
|
||||||
, ("M-o", sendMessage $ ExpandTowardsBy U 0.01)
|
|
||||||
, ("M-n", sendMessage $ ExpandTowardsBy L 0.01)
|
|
||||||
, ("M-e", sendMessage $ ExpandTowardsBy D 0.01)
|
|
||||||
, ("M-i", sendMessage $ ExpandTowardsBy R 0.01)
|
|
||||||
|
|
||||||
-- shrink windows
|
|
||||||
, ("M-M1-o", sendMessage $ ShrinkFromBy U 0.01)
|
|
||||||
, ("M-M1-n", sendMessage $ ShrinkFromBy L 0.01)
|
|
||||||
, ("M-M1-e", sendMessage $ ShrinkFromBy D 0.01)
|
|
||||||
, ("M-M1-i", sendMessage $ ShrinkFromBy R 0.01)
|
|
||||||
|
|
||||||
-- swap/rotate
|
|
||||||
, ("M-r", sendMessage Rotate)
|
|
||||||
, ("M-s", sendMessage Swap )
|
|
||||||
|
|
||||||
-- split shift
|
|
||||||
, ("M-f", sendMessage $ SplitShift Prev)
|
|
||||||
, ("M-u", sendMessage $ SplitShift Next)
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Layouts
|
-- Layouts
|
||||||
--
|
--
|
||||||
|
|
||||||
myLayouts = myTile ||| myBsp ||| myMax ||| myFull
|
myLayouts = myTile ||| myMax ||| myFull
|
||||||
where
|
where
|
||||||
-- our layouts
|
-- our layouts
|
||||||
myTile = renamed [Replace "dynamic tiling" ] . avoidStruts . myGaps $ Tall nmaster delta ratio
|
myTile = renamed [Replace "dynamic tiling"] . avoidStruts . myGaps $ Tall nmaster delta ratio
|
||||||
myBsp = renamed [Replace "binary space partition"] . avoidStruts . myGaps $ emptyBSP
|
myMax = renamed [Replace "maximised" ] . avoidStruts . myGaps $ Full
|
||||||
myMax = renamed [Replace "maximised" ] . avoidStruts . myGaps $ Full
|
myFull = renamed [Replace "fullscreen" ] . noBorders $ Full
|
||||||
myFull = renamed [Replace "fullscreen" ] . noBorders $ Full
|
|
||||||
-- add a configurable amount of space around windows.
|
-- add a configurable amount of space around windows.
|
||||||
myGaps = spacingRaw False (Border 10 10 10 10) True (Border 10 10 10 10) True
|
myGaps = spacingRaw False (Border 10 10 10 10) True (Border 10 10 10 10) True
|
||||||
-- layout configuration
|
-- layout configuration
|
||||||
|
|
@ -236,11 +182,8 @@ myXmobarPP = def
|
||||||
, ppHiddenNoWindows = grey0 . wrap " " ""
|
, ppHiddenNoWindows = grey0 . wrap " " ""
|
||||||
, ppUrgent = red . wrap " " ""
|
, ppUrgent = red . wrap " " ""
|
||||||
, ppLayout = aqua . wrap (grey0 " <fn=1>[</fn> ") (grey0 " <fn=1>]</fn> ")
|
, ppLayout = aqua . wrap (grey0 " <fn=1>[</fn> ") (grey0 " <fn=1>]</fn> ")
|
||||||
, ppOrder = \case { [ws, l, title, mode] -> [ws, l, mode, title]; xs -> xs }
|
, ppOrder = \[ws, l, _] -> [ws, l]
|
||||||
, ppExtras = [lMode]
|
|
||||||
}
|
}
|
||||||
where
|
|
||||||
lMode = xmobarColorL "#d8a657" "#282828" . fixedWidthL AlignCenter "-" 4 $ logMode
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue