xmonad: add mimize events

This commit is contained in:
Dmitriy Pleshevskiy 2023-03-14 11:29:36 +03:00
parent a738fc02e8
commit 7e4dc20f15
Signed by: pleshevskiy
GPG key ID: 79C4487B44403985

View file

@ -16,6 +16,7 @@ import qualified Data.Map.Strict as Map
import Data.Monoid import Data.Monoid
import System.Exit import System.Exit
import XMonad import XMonad
import XMonad.Actions.Minimize (withLastMinimized, minimizeWindow, maximizeWindow)
import XMonad.Actions.CycleSelectedLayouts (cycleThroughLayouts) import XMonad.Actions.CycleSelectedLayouts (cycleThroughLayouts)
import XMonad.Actions.EasyMotion import XMonad.Actions.EasyMotion
( ChordKeys (..), ( ChordKeys (..),
@ -34,12 +35,13 @@ import XMonad.Hooks.ManageHelpers
) )
import XMonad.Hooks.StatusBar import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP import XMonad.Hooks.StatusBar.PP
import XMonad.Layout.BoringWindows (boringWindows) import XMonad.Layout.BoringWindows (boringWindows, focusUp, focusDown, focusMaster, swapUp, swapDown)
import XMonad.Layout.Gaps (gaps) import XMonad.Layout.Gaps (gaps)
import XMonad.Layout.Grid import XMonad.Layout.Grid
import XMonad.Layout.LimitWindows (limitWindows) import XMonad.Layout.LimitWindows (limitWindows)
import XMonad.Layout.NoBorders (smartBorders) import XMonad.Layout.NoBorders (smartBorders)
import XMonad.Layout.Spacing (spacing) import XMonad.Layout.Spacing (spacing)
import XMonad.Layout.Minimize (minimize)
import XMonad.Prompt (XPConfig (..), XPPosition (Top), XPType (..), XPrompt (..), mkComplFunFromList', mkXPromptWithModes) import XMonad.Prompt (XPConfig (..), XPPosition (Top), XPType (..), XPrompt (..), mkComplFunFromList', mkXPromptWithModes)
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import XMonad.Util.EZConfig import XMonad.Util.EZConfig
@ -102,7 +104,7 @@ main' dbus =
keys = myKeys, keys = myKeys,
mouseBindings = myMouseBindings, mouseBindings = myMouseBindings,
-- hooks, layouts -- hooks, layouts
layoutHook = myLayout, layoutHook = myLayoutHook,
manageHook = myManageHook, manageHook = myManageHook,
handleEventHook = myEventHook, handleEventHook = myEventHook,
logHook = myPolybarLogHook dbus, logHook = myPolybarLogHook dbus,
@ -158,7 +160,7 @@ myPolybarLogHook dbus = myLogHook <+> dynamicLogWithPP (polybarHook dbus)
-- The available layouts. Note that each layout is separated by |||, -- The available layouts. Note that each layout is separated by |||,
-- which denotes layout choice. -- which denotes layout choice.
-- --
myLayout = avoidStruts . smartBorders $ (Mirror tiled ||| tiled ||| full) myLayoutHook = minimize . boringWindows . avoidStruts . smartBorders $ (Mirror tiled ||| tiled ||| full)
where where
full = Full full = Full
tiled = gapSpaced 5 $ Tall nmaster incRatio ratio tiled = gapSpaced 5 $ Tall nmaster incRatio ratio
@ -280,17 +282,17 @@ myKeys conf =
-- Easy moution to focus windows -- Easy moution to focus windows
("M-s", selectWindow easyMotionConfig >>= (`whenJust` windows . W.focusWindow)), ("M-s", selectWindow easyMotionConfig >>= (`whenJust` windows . W.focusWindow)),
-- Move focus to the next window -- Move focus to the next window
("M-j", windows W.focusDown), ("M-j", focusDown),
-- Move focus to the previous window -- Move focus to the previous window
("M-k", windows W.focusUp), ("M-k", focusUp),
-- Move focus to the master window -- Move focus to the master window
("M-m", windows W.focusMaster), ("M-m", focusMaster),
-- Swap the focused window and the master window -- Swap the focused window and the master window
("M-<Return>", windows W.swapMaster), ("M-<Return>", windows W.swapMaster),
-- Swap the focused window with the next window -- Swap the focused window with the next window
("M-S-j", windows W.swapDown), ("M-S-j", swapDown),
-- Swap the focused window with the previous window -- Swap the focused window with the previous window
("M-S-k", windows W.swapUp) ("M-S-k", swapUp)
] ]
where where
easyMotionConfig = easyMotionConfig =
@ -317,7 +319,10 @@ myKeys conf =
-- Toggle the status bar gap -- Toggle the status bar gap
-- Use this binding with avoidStruts from Hooks.ManageDocks. -- Use this binding with avoidStruts from Hooks.ManageDocks.
-- See also the statusBar function from Hooks.DynamicLog. -- See also the statusBar function from Hooks.DynamicLog.
("M-b", toggleStruts) ("M-b", toggleStruts),
-- Minimize and maximize windows
("M4-m", withFocused minimizeWindow),
("M4-S-m", withLastMinimized maximizeWindow)
] ]
where where
togglePolybar = spawn "polybar-msg cmd toggle &" togglePolybar = spawn "polybar-msg cmd toggle &"