1
0
mirror of https://github.com/xmonad/xmonad-contrib.git synced 2025-08-02 21:21:51 -07:00
Files
.github
XMonad
Actions
Config
Doc
Hooks
Layout
DecorationEx
Groups
MultiToggle
Accordion.hs
AutoMaster.hs
AvoidFloats.hs
BinaryColumn.hs
BinarySpacePartition.hs
BorderResize.hs
BoringWindows.hs
ButtonDecoration.hs
CenterMainFluid.hs
CenteredIfSingle.hs
CenteredMaster.hs
Circle.hs
CircleEx.hs
Column.hs
Columns.hs
Combo.hs
ComboP.hs
Cross.hs
Decoration.hs
DecorationAddons.hs
DecorationEx.hs
DecorationMadness.hs
Dishes.hs
DragPane.hs
DraggingVisualizer.hs
Drawer.hs
Dwindle.hs
DwmStyle.hs
FixedAspectRatio.hs
FixedColumn.hs
FocusTracking.hs
Fullscreen.hs
Gaps.hs
Grid.hs
GridVariants.hs
Groups.hs
Hidden.hs
HintedGrid.hs
HintedTile.hs
IM.hs
IfMax.hs
ImageButtonDecoration.hs
IndependentScreens.hs
LayoutBuilder.hs
LayoutCombinators.hs
LayoutHints.hs
LayoutModifier.hs
LayoutScreens.hs
LimitWindows.hs
MagicFocus.hs
Magnifier.hs
Master.hs
Maximize.hs
MessageControl.hs
Minimize.hs
Monitor.hs
Mosaic.hs
MosaicAlt.hs
MouseResizableTile.hs
MultiColumns.hs
MultiDishes.hs
MultiToggle.hs
Named.hs
NoBorders.hs
NoFrillsDecoration.hs
OnHost.hs
OneBig.hs
PerScreen.hs
PerWorkspace.hs
PositionStoreFloat.hs
Reflect.hs
Renamed.hs
ResizableThreeColumns.hs
ResizableTile.hs
ResizeScreen.hs
Roledex.hs
ShowWName.hs
SideBorderDecoration.hs
SimpleDecoration.hs
SimpleFloat.hs
Simplest.hs
SimplestFloat.hs
SortedLayout.hs
Spacing.hs
Spiral.hs
Square.hs
StackTile.hs
StateFull.hs
Stoppable.hs
SubLayouts.hs
TabBarDecoration.hs
Tabbed.hs
TallMastersCombo.hs
ThreeColumns.hs
ToggleLayouts.hs
TrackFloating.hs
TwoPane.hs
TwoPanePersistent.hs
VoidBorders.hs
WindowArranger.hs
WindowNavigation.hs
WindowSwitcherDecoration.hs
WorkspaceDir.hs
ZoomRow.hs
Prompt
Util
Doc.hs
Prelude.hs
Prompt.hs
scripts
tests
.gitignore
.hlint.yaml
.mailmap
CHANGES.md
CONTRIBUTING.md
LICENSE
NIX.md
README.md
Setup.lhs
cabal.haskell-ci
cabal.project
flake.nix
stack-master.yaml
stack.yaml
xmonad-contrib.cabal
Tony Zorman b1b3c4c469 ~/.xmonad/xmonad.hs -> xmonad.hs
With XDG support so firmly ingrained now, it's about time we stop
hard-coding the configuration path in the docs.
2023-12-22 18:17:17 +01:00

89 lines
3.2 KiB
Haskell

{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeSynonymInstances #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Layout.VoidBorders
-- Description : Set borders to 0 for all windows in the workspace.
-- Copyright : Wilson Sales <spoonm@spoonm.org>
-- License : BSD-style (see LICENSE)
--
-- Maintainer : <spoonm@spoonm.org>
-- Stability : unstable
-- Portability : unportable
--
-- Modifies a layout to set borders to 0 for all windows in the workspace.
--
-- Unlike "XMonad.Layout.NoBorders", the 'voidBorders' modifier will not
-- restore the window border if the windows are moved to a different workspace
-- or the layout is changed. There is, however, a companion 'normalBorders'
-- modifier which explicitly restores the border.
--
-- This modifier's primary use is to eliminate the "border flash" you get
-- while switching workspaces with the "XMonad.Layout.NoBorders" modifier.
--
-----------------------------------------------------------------------------
module XMonad.Layout.VoidBorders ( -- * Usage
-- $usage
voidBorders
, normalBorders
) where
import XMonad
import XMonad.Layout.LayoutModifier
import XMonad.StackSet (integrate)
-- $usage
-- You can use this module with the following in your @xmonad.hs@
-- file:
--
-- > import XMonad.Layout.VoidBorders
--
-- and modify the layouts to call 'voidBorders' on the layouts you want to
-- remove borders from windows, and 'normalBorders' on the layouts you want
-- to keep borders for:
--
-- > layoutHook = ... ||| voidBorders Full ||| normalBorders Tall ...
--
-- For more detailed instructions on editing the layoutHook see
-- <https://xmonad.org/TUTORIAL.html#customizing-xmonad the tutorial> and
-- "XMonad.Doc.Extending#Editing_the_layout_hook".
data VoidBorders a = VoidBorders deriving (Read, Show)
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)
voidBorders :: l Window -> ModifiedLayout VoidBorders l Window
voidBorders = ModifiedLayout VoidBorders
data NormalBorders a = NormalBorders deriving (Read, Show)
instance LayoutModifier NormalBorders Window where
modifierDescription = const "NormalBorders"
redoLayout NormalBorders _ Nothing wrs = return (wrs, Nothing)
redoLayout NormalBorders _ (Just s) wrs = do
mapM_ resetBorders $ integrate s
return (wrs, Nothing)
normalBorders :: l Window -> ModifiedLayout NormalBorders l Window
normalBorders = ModifiedLayout NormalBorders
-- | Sets border width to 0 for every window from the specified layout.
setZeroBorder :: Window -> X ()
setZeroBorder w = setBorders w 0
-- | Resets the border to the value read from the current configuration.
resetBorders :: Window -> X ()
resetBorders w = asks (borderWidth . config) >>= setBorders w
setBorders :: Window -> Dimension -> X ()
setBorders w bw = withDisplay $ \d -> io $ setWindowBorderWidth d w bw