mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
new contrib layout: XMonad.Layout.SimplestFloat - A floating layout like SimpleFloat, but without decoration
This commit is contained in:
parent
b2c1e077b2
commit
0df598fa5d
64
XMonad/Layout/SimplestFloat.hs
Normal file
64
XMonad/Layout/SimplestFloat.hs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
{-# LANGUAGE TypeSynonymInstances, MultiParamTypeClasses #-}
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
-- |
|
||||||
|
-- Module : XMonad.Layout.SimplestFloat
|
||||||
|
-- Copyright : (c) 2008 Jussi Mäki
|
||||||
|
-- License : BSD-style (see xmonad/LICENSE)
|
||||||
|
--
|
||||||
|
-- Maintainer : joamaki@gmail.com
|
||||||
|
-- Stability : unstable
|
||||||
|
-- Portability : unportable
|
||||||
|
--
|
||||||
|
-- A basic floating layout like SimpleFloat but without the decoration.
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
module XMonad.Layout.SimplestFloat
|
||||||
|
( -- * Usage:
|
||||||
|
-- $usage
|
||||||
|
simplestFloat
|
||||||
|
, SimplestFloat
|
||||||
|
) where
|
||||||
|
|
||||||
|
import XMonad
|
||||||
|
import qualified XMonad.StackSet as S
|
||||||
|
import XMonad.Layout.WindowArranger
|
||||||
|
import XMonad.Layout.LayoutModifier
|
||||||
|
|
||||||
|
-- $usage
|
||||||
|
-- You can use this module with the following in your
|
||||||
|
-- @~\/.xmonad\/xmonad.hs@:
|
||||||
|
--
|
||||||
|
-- > import XMonad.Layout.SimplestFloat
|
||||||
|
--
|
||||||
|
-- Then edit your @layoutHook@ by adding the SimplestFloat layout:
|
||||||
|
--
|
||||||
|
-- > myLayouts = simplestFloat ||| Full ||| etc..
|
||||||
|
-- > main = xmonad defaultConfig { layoutHook = myLayouts }
|
||||||
|
--
|
||||||
|
-- For more detailed instructions on editing the layoutHook see:
|
||||||
|
--
|
||||||
|
-- "XMonad.Doc.Extending#Editing_the_layout_hook"
|
||||||
|
|
||||||
|
-- | A simple floating layout where every window is placed according
|
||||||
|
-- to the window's initial attributes.
|
||||||
|
simplestFloat :: Eq a => (ModifiedLayout WindowArranger SimplestFloat) a
|
||||||
|
simplestFloat = (windowArrangeAll $ SF)
|
||||||
|
|
||||||
|
data SimplestFloat a = SF deriving (Show, Read)
|
||||||
|
instance LayoutClass SimplestFloat Window where
|
||||||
|
doLayout SF sc (S.Stack w l r) = do wrs <- mapM (getSize sc) (w : reverse l ++ r)
|
||||||
|
return (wrs, Nothing)
|
||||||
|
description _ = "SimplestFloat"
|
||||||
|
|
||||||
|
getSize :: Rectangle -> Window -> X (Window,Rectangle)
|
||||||
|
getSize (Rectangle rx ry _ _) w = do
|
||||||
|
d <- asks display
|
||||||
|
bw <- asks (borderWidth . config)
|
||||||
|
wa <- io $ getWindowAttributes d w
|
||||||
|
let x = max rx $ fi $ wa_x wa
|
||||||
|
y = max ry $ 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)
|
||||||
|
where
|
||||||
|
fi x = fromIntegral x
|
@ -156,6 +156,7 @@ library
|
|||||||
XMonad.Layout.WindowArranger
|
XMonad.Layout.WindowArranger
|
||||||
XMonad.Layout.WindowNavigation
|
XMonad.Layout.WindowNavigation
|
||||||
XMonad.Layout.WorkspaceDir
|
XMonad.Layout.WorkspaceDir
|
||||||
|
XMonad.Layout.SimplestFloat
|
||||||
XMonad.Prompt.Directory
|
XMonad.Prompt.Directory
|
||||||
XMonad.Prompt
|
XMonad.Prompt
|
||||||
XMonad.Prompt.AppendFile
|
XMonad.Prompt.AppendFile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user