3

It sometimes happens that when I mod-L or mod-H in Xmonad my windows don't resize. I believe this is a result of my having accidentally changed the number of windows in my master pane. Sometimes I'm lucky to hit just the right amount of mod-, or mod-. to get back to where I can resize, but not often.

How can I reset a pane to its default values, the ones which Xmonad gives it when starting? My xmonad.hs:

import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Exit
import Graphics.X11.Xlib
import IO (Handle, hPutStrLn)

import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.SetWMName

import XMonad.Layout.IM
import XMonad.Layout.Reflect
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Layout.PerWorkspace
import XMonad.Layout.LayoutHints
import XMonad.Layout.LayoutCombinators hiding ((|||))
import XMonad.Layout.LayoutHints
import XMonad.Layout.NoBorders
import XMonad.Layout.ComboP
import XMonad.Layout.PerWorkspace
import XMonad.Layout.ResizableTile
import XMonad.Layout.Tabbed
import XMonad.Layout.TwoPane
import XMonad.Util.Run (spawnPipe)
import qualified XMonad.StackSet as W
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.NoBorders

main = do
  h <- spawnPipe "/usr/bin/xmobar"
  xmonad defaultConfig
             { workspaces = workspaces'
             , borderWidth = borderWidth'
             , logHook = logHook' h
             , terminal = terminal'
             , modMask = mod4Mask
             , layoutHook = layoutHook'
             , manageHook = manageHook'
             , startupHook = setWMName "LG3D"
             }

customPP :: PP
customPP = defaultPP { ppCurrent = xmobarColor "#AFAF87" "" . wrap "<" ">"
                     , ppTitle =  shorten 80
                     , ppSep =  "<fc=#AFAF87> | </fc>"
                     , ppHiddenNoWindows = xmobarColor "#AFAF87" ""
                     , ppUrgent = xmobarColor "#FFFFAF" "" . wrap "[" "]"
                     }

logHook' :: Handle ->  X ()
logHook' h = dynamicLogWithPP $ customPP { ppOutput = hPutStrLn h }

manageHook' :: ManageHook
manageHook' = composeAll [
  isFullscreen --> doFullFloat
  ]

layoutHook' = customLayout

borderWidth' :: Dimension
borderWidth' = 1

normalBorderColor', focusedBorderColor' :: String
normalBorderColor'  = "#333333"
focusedBorderColor' = "#AFAF87"

workspaces' :: [WorkspaceId]
workspaces' = ["1", "2", "3", "4", "5", "6"]


customLayout = avoidStruts $ layoutHints $ smartBorders (Full ||| resizableTile ||| Mirror resizableTile)
    where
    resizableTile = ResizableTall nmaster delta ratio []
    nmaster = 1
    ratio = toRational (2/(1+sqrt(5)::Double))
    delta = 3/100

terminal' :: String
terminal' = "urxvt"

I edit this file so little that I forget almost everything about Xmonad's API gleaned from laborious picking through the man-pages and haddock compilations between doing so. Is there a fine documentation resource for the Xmonad API that's not a strict reference work?

troutwine
  • 3,721
  • 3
  • 28
  • 62

1 Answers1

6

By default, mod+shift+space resets your layouts. If you don't like the behavior of mod-, and mod-., you can delete them from your config using removeKeysP:

import XMonad.Util.EZConfig -- add this line near the top, to the other imports

main = do
  h <- spawnPipe "/usr/bin/xmobar" -- no change here
  xmonad $ defaultConfig -- note the extra ($) here
             { workspaces = workspaces'
             -- etc.
             } `removeKeysP`
             [ "M-,", "M-." ]

I don't know of a better documentation source than what's available on the documentation tab on xmonad.org.

Daniel Wagner
  • 145,880
  • 9
  • 220
  • 380