mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
The links were broken due to: 1. Incorrect quotes (' instead of " for module links and occasionally vice-versa). 2. Changes in the name of the "target" module not reflected in the "source" docs. 3. Typos to begin with. 4. Use of `<foo>` in the docs is rendered as just `foo` with a link to `/foo`. 5. Similarly for `"Foo"` if it starts with a capital letter (and hence could be a module). 6. Markup inside `@` code blocks still being applied. e.g. `@M-<arrow-keys>@` is rendered as `M-arrow-keys` with a spurious hyperlink from arrow-keys to `/arrow-keys`, which is confusing. Three links from XMonad.Util.Run have been removed outright, since they're no longer examples of the usage of 'runProcessWithInput'. WmiiActions has been gone since 2008, while XMonad.Prompt.Directory and XMonad.Layout.WorkspaceDir haven't been using 'runProcessWithInput' since 2020 and 2012, respectively. In some cases the `<foo>` were surrounded with @, especially in the case of key definitions, for consistency. (This wasn't done everywhere, because it looks ugly in the source.) MoreManageHelpers has never been in xmonad-contrib. ManageHelpers seems to fill the expected role. In the case of the module description for X.H.ManageDebug the quotes were simply removed because none of the likely options to make the link work were successful.
79 lines
2.9 KiB
Haskell
79 lines
2.9 KiB
Haskell
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, PatternGuards #-}
|
|
-----------------------------------------------------------------------------
|
|
-- |
|
|
-- Module : XMonad.Layout.ResizeScreen
|
|
-- Description : A layout transformer to have a layout respect a given screen geometry.
|
|
-- Copyright : (c) 2007 Andrea Rossato
|
|
-- License : BSD-style (see xmonad/LICENSE)
|
|
--
|
|
-- Maintainer : andrea.rossato@unibz.it
|
|
-- Stability : unstable
|
|
-- Portability : unportable
|
|
--
|
|
-- A layout transformer to have a layout respect a given screen
|
|
-- geometry. Mostly used with "XMonad.Layout.Decoration" (the
|
|
-- Horizontal and the Vertical version will react to SetTheme and
|
|
-- change their dimension accordingly.
|
|
-----------------------------------------------------------------------------
|
|
|
|
module XMonad.Layout.ResizeScreen
|
|
( -- * Usage:
|
|
-- $usage
|
|
resizeHorizontal, resizeVertical
|
|
, resizeHorizontalRight, resizeVerticalBottom
|
|
, withNewRectangle
|
|
, ResizeScreen (..)
|
|
, ResizeMode
|
|
) where
|
|
|
|
import XMonad
|
|
import XMonad.Layout.Decoration
|
|
|
|
-- $usage
|
|
-- You can use this module by importing it into your
|
|
-- @~\/.xmonad\/xmonad.hs@ file:
|
|
--
|
|
-- > import XMonad.Layout.ResizeScreen
|
|
--
|
|
-- and modifying your layoutHook as follows (for example):
|
|
--
|
|
-- > layoutHook = resizeHorizontal 40 Full
|
|
--
|
|
-- 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".
|
|
|
|
resizeHorizontal :: Int -> l a -> ModifiedLayout ResizeScreen l a
|
|
resizeHorizontal i = ModifiedLayout (ResizeScreen L i)
|
|
|
|
resizeVertical :: Int -> l a -> ModifiedLayout ResizeScreen l a
|
|
resizeVertical i = ModifiedLayout (ResizeScreen T i)
|
|
|
|
resizeHorizontalRight :: Int -> l a -> ModifiedLayout ResizeScreen l a
|
|
resizeHorizontalRight i = ModifiedLayout (ResizeScreen R i)
|
|
|
|
resizeVerticalBottom :: Int -> l a -> ModifiedLayout ResizeScreen l a
|
|
resizeVerticalBottom i = ModifiedLayout (ResizeScreen B i)
|
|
|
|
withNewRectangle :: Rectangle -> l a -> ModifiedLayout ResizeScreen l a
|
|
withNewRectangle r = ModifiedLayout (WithNewScreen r)
|
|
|
|
data ResizeScreen a = ResizeScreen ResizeMode Int
|
|
| WithNewScreen Rectangle
|
|
deriving (Read, Show)
|
|
|
|
data ResizeMode = T | B | L | R deriving (Read, Show)
|
|
|
|
instance LayoutModifier ResizeScreen a where
|
|
modifyLayout m ws (Rectangle x y w h)
|
|
| ResizeScreen L i <- m = resize $ Rectangle (x + fi i) y (w - fi i) h
|
|
| ResizeScreen R i <- m = resize $ Rectangle x y (w - fi i) h
|
|
| ResizeScreen T i <- m = resize $ Rectangle x (y + fi i) w (h - fi i)
|
|
| ResizeScreen B i <- m = resize $ Rectangle x y w (h - fi i)
|
|
| WithNewScreen r <- m = resize r
|
|
where resize = runLayout ws
|
|
|
|
pureMess (ResizeScreen d _) m
|
|
| Just (SetTheme t) <- fromMessage m = Just $ ResizeScreen d (fi $ decoHeight t)
|
|
pureMess _ _ = Nothing
|