mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-03 05:31:53 -07:00
.github
XMonad
Actions
Config
Doc
Hooks
Layout
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
Column.hs
Combo.hs
ComboP.hs
Cross.hs
Decoration.hs
DecorationAddons.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
Essentially, whenever the tutorial actually has decent material on the subject matter. The replacement is roughly done as follows: - logHook → tutorial - keybindings → tutorial, as this is thoroughly covered - manageHook → tutorial + X.D.Extending, as the manageHook stuff the tutorial talks about is a little bit of an afterthought. - X.D.Extending (on its own) → tutorial + X.D.Extending - layoutHook → tutorial + X.D.Extending, as the tutorial, while talking about layouts, doesn't necessarily have a huge focus there. - mouse bindings → leave this alone, as the tutorial does not at all talk about them.
82 lines
2.9 KiB
Haskell
82 lines
2.9 KiB
Haskell
{-# LANGUAGE TypeSynonymInstances, MultiParamTypeClasses #-}
|
|
-----------------------------------------------------------------------------
|
|
-- |
|
|
-- Module : XMonad.Layout.SimpleFloat
|
|
-- Description : A basic floating layout.
|
|
-- Copyright : (c) 2007 Andrea Rossato
|
|
-- License : BSD-style (see xmonad/LICENSE)
|
|
--
|
|
-- Maintainer : andrea.rossato@unibz.it
|
|
-- Stability : unstable
|
|
-- Portability : unportable
|
|
--
|
|
-- A basic floating layout.
|
|
-----------------------------------------------------------------------------
|
|
|
|
module XMonad.Layout.SimpleFloat
|
|
( -- * Usage:
|
|
-- $usage
|
|
simpleFloat
|
|
, simpleFloat'
|
|
, SimpleDecoration (..)
|
|
, SimpleFloat (..)
|
|
, shrinkText, CustomShrink(CustomShrink)
|
|
, Shrinker(..)
|
|
) where
|
|
|
|
import XMonad
|
|
import qualified XMonad.StackSet as S
|
|
import XMonad.Actions.MouseResize
|
|
import XMonad.Layout.Decoration
|
|
import XMonad.Layout.SimpleDecoration
|
|
import XMonad.Layout.WindowArranger
|
|
|
|
-- $usage
|
|
-- You can use this module with the following in your
|
|
-- @~\/.xmonad\/xmonad.hs@:
|
|
--
|
|
-- > import XMonad.Layout.SimpleFloat
|
|
--
|
|
-- Then edit your @layoutHook@ by adding the SimpleFloat layout:
|
|
--
|
|
-- > myLayout = simpleFloat ||| Full ||| etc..
|
|
-- > main = xmonad def { layoutHook = myLayout }
|
|
--
|
|
-- 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".
|
|
|
|
-- | A simple floating layout where every window is placed according
|
|
-- to the window's initial attributes.
|
|
--
|
|
-- This version is decorated with the 'SimpleDecoration' style.
|
|
simpleFloat :: Eq a => ModifiedLayout (Decoration SimpleDecoration DefaultShrinker)
|
|
(ModifiedLayout MouseResize (ModifiedLayout WindowArranger SimpleFloat)) a
|
|
simpleFloat = decoration shrinkText def (Simple False) (mouseResize $ windowArrangeAll $ SF 20)
|
|
|
|
-- | Same as 'simpleFloat', but with the possibility of setting a
|
|
-- custom shrinker and a custom theme.
|
|
simpleFloat' :: (Eq a, Shrinker s) => s -> Theme ->
|
|
ModifiedLayout (Decoration SimpleDecoration s)
|
|
(ModifiedLayout MouseResize (ModifiedLayout WindowArranger SimpleFloat)) a
|
|
simpleFloat' s c = decoration s c (Simple False) (mouseResize $ windowArrangeAll $ SF (decoHeight c))
|
|
|
|
newtype SimpleFloat a = SF Dimension deriving (Show, Read)
|
|
instance LayoutClass SimpleFloat Window where
|
|
description _ = "Float"
|
|
doLayout (SF i) sc (S.Stack w l r) = do
|
|
wrs <- mapM (getSize i sc) (w : reverse l ++ r)
|
|
return (wrs, Nothing)
|
|
|
|
getSize :: Dimension -> Rectangle -> Window -> X (Window,Rectangle)
|
|
getSize i (Rectangle rx ry _ _) w = do
|
|
d <- asks display
|
|
bw <- asks (borderWidth . config)
|
|
wa <- io $ getWindowAttributes d w
|
|
let ny = ry + fi i
|
|
x = max rx $ fi $ wa_x wa
|
|
y = max ny $ fi $ wa_y wa
|
|
wh = fi (wa_width wa) + (bw * 2)
|
|
ht = fi (wa_height wa) + (bw * 2)
|
|
return (w, Rectangle x y wh ht)
|