xmonad: Remove unused layouts

This commit is contained in:
Alexander Kobjolke 2024-03-01 21:38:44 +01:00
parent 05647a01dd
commit bc675f00ac

View file

@ -1,44 +1,39 @@
import XMonad import XMonad
import XMonad.Actions.CycleWS qualified as WS
import XMonad.Actions.Navigation2D (navigation2DP, windowGo, windowSwap) import XMonad.Actions.Navigation2D (navigation2DP, windowGo, windowSwap)
import qualified XMonad.Actions.CycleWS as WS import XMonad.Hooks.EwmhDesktops
import XMonad.Util.Ungrab (unGrab) import XMonad.Hooks.ManageDocks qualified as Docks
import XMonad.Layout.ThreeColumns import XMonad.Hooks.SetWMName
import XMonad.Layout.ToggleLayouts (ToggleLayout(..), toggleLayouts)
import XMonad.Layout.BinarySpacePartition import XMonad.Layout.BinarySpacePartition
import XMonad.Layout.BorderResize (borderResize) import XMonad.Layout.BorderResize (borderResize)
import XMonad.Hooks.EwmhDesktops import XMonad.Layout.ThreeColumns
import XMonad.Hooks.SetWMName import XMonad.Layout.ToggleLayouts (ToggleLayout (..), toggleLayouts)
import qualified XMonad.Hooks.ManageDocks as Docks import XMonad.Util.EZConfig qualified as EZ
import qualified XMonad.Util.EZConfig as EZ import XMonad.Util.Ungrab (unGrab)
import Numeric.Natural
import Control.Monad (when) import Control.Monad (when)
import Text.Printf (printf) import Numeric.Natural
import System.Posix.Process (executeFile)
import System.Info (arch,os)
import System.Environment (getArgs) import System.Environment (getArgs)
import System.FilePath ((</>)) import System.FilePath ((</>))
import System.Info (arch, os)
import System.Posix.Process (executeFile)
import Text.Printf (printf)
compiledConfig = printf "xmonad-%s-%s" arch os compiledConfig = printf "xmonad-%s-%s" arch os
compileRestart resume = do compileRestart resume = do
dirs <- asks directories dirs <- asks directories
whenX (recompile dirs True) $ do whenX (recompile dirs True) $ do
when resume writeStateToFile when resume writeStateToFile
catchIO catchIO
( do ( do
args <- getArgs args <- getArgs
executeFile (cacheDir dirs </> compiledConfig) False args Nothing executeFile (cacheDir dirs </> compiledConfig) False args Nothing
) )
myLayout = borderResize $ Docks.avoidStruts $ layout myLayout = borderResize $ Docks.avoidStruts layout
where where
layout = (emptyBSP ||| columns ||| tiled ||| Full) layout = emptyBSP ||| Full
tiled = Tall nmaster delta ratio
columns = ThreeColMid nmaster delta ratio
nmaster = 1 -- default number of windows in the master pane
ratio = 1/2 -- default proportion occupied by master pane
delta = 3/100 -- percent of screen to increment when resizing
main :: IO () main :: IO ()
main = getDirectories >>= launch myConfig main = getDirectories >>= launch myConfig
@ -48,66 +43,67 @@ main = getDirectories >>= launch myConfig
windowMoveSplit :: Direction2D -> Bool -> X () windowMoveSplit :: Direction2D -> Bool -> X ()
windowMoveSplit direction _ = sendMessage $ MoveSplit direction windowMoveSplit direction _ = sendMessage $ MoveSplit direction
data VolumeCommand = ToggleVolume data VolumeCommand
| LowerVolume Natural = ToggleVolume
| RaiseVolume Natural | LowerVolume Natural
| RaiseVolume Natural
interpretVolumeCommand :: VolumeCommand -> String interpretVolumeCommand :: VolumeCommand -> String
interpretVolumeCommand command = "amixer -q set Master " <> cmd interpretVolumeCommand command = "amixer -q set Master " <> cmd
where where
cmd = case command of cmd = case command of
ToggleVolume -> "toggle" ToggleVolume -> "toggle"
LowerVolume delta -> show delta <> "%-" LowerVolume delta -> show delta <> "%-"
RaiseVolume delta -> show delta <> "%+" RaiseVolume delta -> show delta <> "%+"
changeVolume :: VolumeCommand -> X () changeVolume :: VolumeCommand -> X ()
changeVolume = spawn . interpretVolumeCommand changeVolume = spawn . interpretVolumeCommand
myConfig = ewmhFullscreen $ ewmh $ Docks.docks $ nav $ def myConfig =
{ modMask = mod4Mask -- Use Super instead of Alt ewmhFullscreen $
, terminal = "alacritty" ewmh $
, layoutHook = myLayout Docks.docks $
-- this seems to be necessary to make java gui applications work :( nav $
, startupHook = ewmhDesktopsStartup >> setWMName "LG3D" def
} { modMask = mod4Mask -- Use Super instead of Alt
`EZ.additionalKeysP` , terminal = "alacritty"
[ ("M-S-z", spawn "xscreensaver-command -lock") , layoutHook = myLayout
, ("M-S-r", compileRestart True) , -- this seems to be necessary to make java gui applications work :(
, ("M-S-q", restart "xmonad" True) startupHook = ewmhDesktopsStartup >> setWMName "LG3D"
, ("M-C-s", unGrab *> spawn "scrot -s") }
, ("M-b", sendMessage Docks.ToggleStruts) `EZ.additionalKeysP` [ ("M-S-z", spawn "xscreensaver-command -lock")
, ("M-f", sendMessage (Toggle "Full")) , ("M-S-r", compileRestart True)
, ("M-p", spawn appLauncher) , ("M-S-q", restart "xmonad" True)
, ("M-i", spawn passLauncher) , ("M-C-s", unGrab *> spawn "scrot -s")
, ("M-w", kill) , ("M-b", sendMessage Docks.ToggleStruts)
, ("M-l", WS.toggleWS) , ("M-f", sendMessage (Toggle "Full"))
, ("M-g", WS.prevWS) , ("M-p", spawn appLauncher)
, ("M-r", WS.nextWS) , ("M-i", spawn passLauncher)
, ("M-w", kill)
, ("M-l", WS.toggleWS)
, ("M-g", WS.prevWS)
, ("M-r", WS.nextWS)
, -- backlight control
-- backlight control ("<XF86MonBrightnessDown>", spawn "xbacklight -dec 5")
, ("<XF86MonBrightnessUp>", spawn "xbacklight -inc 5")
, ("<F5>", spawn "xbacklight -dec 5")
, ("<F6>", spawn "xbacklight -inc 5")
, -- volume control
, ("<XF86MonBrightnessDown>", spawn "xbacklight -dec 5") ("<XF86AudioMute>", changeVolume ToggleVolume)
, ("<XF86MonBrightnessUp>", spawn "xbacklight -inc 5") , ("<XF86AudioLowerVolume>", changeVolume $ LowerVolume 5)
, ("<F5>", spawn "xbacklight -dec 5") , ("<XF86AudioRaiseVolume>", changeVolume $ RaiseVolume 5)
, ("<F6>", spawn "xbacklight -inc 5") , ("M-a", sendMessage Balance)
, ("M-S-a", sendMessage Equalize)
-- volume control , ("M-o", sendMessage Rotate)
]
, ("<XF86AudioMute>", changeVolume ToggleVolume)
, ("<XF86AudioLowerVolume>", changeVolume $ LowerVolume 5)
, ("<XF86AudioRaiseVolume>", changeVolume $ RaiseVolume 5)
, ("M-a", sendMessage Balance)
, ("M-S-a", sendMessage Equalize)
, ("M-o", sendMessage Rotate)
]
where where
-- navigate using dvorak bindings -- navigate using dvorak bindings
nav = navigation2DP def ("c", "h", "t", "n") [("M-", windowGo), ("M-C-", windowSwap), ("M-S-", windowMoveSplit)] True nav = navigation2DP def ("c", "h", "t", "n") [("M-", windowGo), ("M-C-", windowSwap), ("M-S-", windowMoveSplit)] True
appLauncher = "rofi -show combi -modes combi -combi-modes window,drun,run,ssh" appLauncher = "rofi -show combi -modes combi -combi-modes window,drun,run,ssh"
passLauncher = "rofi-pass" passLauncher = "rofi-pass"
-- myManageHook :: ManageHook -- myManageHook :: ManageHook
-- myManageHook = composeAll -- myManageHook = composeAll
-- [ className =? "Gimp" --> doFloat -- [ className =? "Gimp" --> doFloat