diff --git a/CHANGES.md b/CHANGES.md index 344c19e9..15d0dbe0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -94,6 +94,11 @@ `XMonad.Hooks.DynamicLog.dynamicLogWithPP`, will make the workspace tags clickable in XMobar (for switching focus). + * `XMonad.Layout.VoidBorders` + + Provides a modifier that semi-permanently (requires manual intervention) + disables borders for windows from the layout it modifies. + ### Bug Fixes and Minor Changes * `XMonad.Actions.DynamicProjects` diff --git a/XMonad/Layout/VoidBorders.hs b/XMonad/Layout/VoidBorders.hs new file mode 100644 index 00000000..be4a614b --- /dev/null +++ b/XMonad/Layout/VoidBorders.hs @@ -0,0 +1,64 @@ +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeSynonymInstances #-} + +----------------------------------------------------------------------------- +-- | +-- Module : XMonad.Layout.VoidBorders +-- Copyright : Wilson Sales +-- License : BSD-style (see LICENSE) +-- +-- Maintainer : +-- Stability : unstable +-- Portability : unportable +-- +-- Modifies a layout to set borders to 0 for all windows in the workspace. +-- Unlike XMonad.Layout.NoBorders, this modifier will not restore the window +-- border if the windows are moved to a different workspace or the layout is +-- changed. +-- +-- This modifier's primary use is to eliminate the "border flash" you get +-- while switching workspaces with the `noBorders` modifier. It won't return +-- the borders to their original width, however. +-- +----------------------------------------------------------------------------- + +module XMonad.Layout.VoidBorders ( -- * Usage + -- $usage + voidBorders + ) where + +import XMonad +import XMonad.Layout.LayoutModifier +import XMonad.StackSet (integrate) + +-- $usage +-- You can use this module with the following in your ~\/.xmonad/xmonad.hs +-- file: +-- +-- > import XMonad.Layout.VoidBorders +-- +-- and modify the layouts to call 'voidBorders' on the layouts you want to +-- remove borders from windows: +-- +-- > layoutHook = ... ||| voidBorders Full ||| ... +-- +-- For more detailed instructions on editing the layoutHook see: +-- +-- "XMonad.Doc.Extending#Editing_the_layout_hook" + +data VoidBorders a = VoidBorders deriving (Read, Show) + +voidBorders :: l Window -> ModifiedLayout VoidBorders l Window +voidBorders = ModifiedLayout VoidBorders + +instance LayoutModifier VoidBorders Window where + modifierDescription = const "VoidBorders" + + redoLayout VoidBorders _ Nothing wrs = return (wrs, Nothing) + redoLayout VoidBorders _ (Just s) wrs = do + mapM_ setZeroBorder $ integrate s + return (wrs, Nothing) + +-- | Sets border width to 0 for every window from the specified layout. +setZeroBorder :: Window -> X () +setZeroBorder w = withDisplay $ \d -> io $ setWindowBorderWidth d w 0 diff --git a/xmonad-contrib.cabal b/xmonad-contrib.cabal index 8ac284c5..3089e812 100644 --- a/xmonad-contrib.cabal +++ b/xmonad-contrib.cabal @@ -296,6 +296,7 @@ library XMonad.Layout.TrackFloating XMonad.Layout.TwoPane XMonad.Layout.TwoPanePersistent + XMonad.Layout.VoidBorders XMonad.Layout.WindowArranger XMonad.Layout.WindowNavigation XMonad.Layout.WindowSwitcherDecoration