<commit_before>-----------------------------------------------------------------------------
-- |
-- Module      :  XMonadContrib.Accordion
-- Copyright   :  (c) <EMAIL>
-- License     :  BSD
--
-- Maintainer  :  <EMAIL>
-- Stability   :  unstable
-- Portability :  unportable
--
-- Layout that puts non-focused windows in ribbons at the top and bottom
-- of the screen.
-----------------------------------------------------------------------------

module XMonadContrib.Accordion (
    -- * Usage
    -- $usage
    accordion) where

import XMonad
import Operations
import qualified StackSet as W
import Graphics.X11.Xlib
import Data.Ratio

-- $usage
-- > import XMonadContrib.Accordion
-- > defaultLayouts = [ accordion ]

accordion :: Eq a => Layout a
accordion = Layout { doLayout = accordionLayout
                    , modifyLayout = const $ return Nothing }

accordionLayout :: Eq a => Rectangle -> W.Stack a -> X [(a, Rectangle)]
accordionLayout sc ws = return $ (zip ups tops) ++
                               [(W.focus ws, mainPane)] ++
                               (zip dns bottoms)
 where ups    = W.up ws
       dns    = W.down ws
       (top, allButTop) = splitVerticallyBy (1%8) sc
       (center, bottom) = splitVerticallyBy (6%7) allButTop
       (allButBottom, _) = splitVerticallyBy (7%8) sc
       mainPane | ups /= [] && dns /= [] = center
                | ups /= []              = allButTop
                | dns /= []              = allButBottom
                | otherwise              = sc
       tops   = if ups /= [] then splitVertically (length ups) top else []
       bottoms= if dns /= [] then splitVertically (length dns) bottom else []<commit_msg>move Accordian to use idModify.<commit_after>-----------------------------------------------------------------------------
-- |
-- Module      :  XMonadContrib.Accordion
-- Copyright   :  (c) <EMAIL>
-- License     :  BSD
--
-- Maintainer  :  <EMAIL>
-- Stability   :  unstable
-- Portability :  unportable
--
-- Layout that puts non-focused windows in ribbons at the top and bottom
-- of the screen.
-----------------------------------------------------------------------------

module XMonadContrib.Accordion (
    -- * Usage
    -- $usage
    accordion) where

import XMonad
import Operations
import qualified StackSet as W
import Graphics.X11.Xlib
import Data.Ratio
import XMonadContrib.LayoutHelpers ( idModify )

-- $usage
-- > import XMonadContrib.Accordion
-- > defaultLayouts = [ accordion ]

accordion :: Eq a => Layout a
accordion = Layout { doLayout = accordionLayout, modifyLayout = idModify }

accordionLayout :: Eq a => Rectangle -> W.Stack a -> X [(a, Rectangle)]
accordionLayout sc ws = return $ (zip ups tops) ++
                               [(W.focus ws, mainPane)] ++
                               (zip dns bottoms)
 where ups    = W.up ws
       dns    = W.down ws
       (top, allButTop) = splitVerticallyBy (1%8) sc
       (center, bottom) = splitVerticallyBy (6%7) allButTop
       (allButBottom, _) = splitVerticallyBy (7%8) sc
       mainPane | ups /= [] && dns /= [] = center
                | ups /= []              = allButTop
                | dns /= []              = allButBottom
                | otherwise              = sc
       tops   = if ups /= [] then splitVertically (length ups) top else []
       bottoms= if dns /= [] then splitVertically (length dns) bottom else []
{'fraction_non_alphanumeric': 0.19528718703976436, 'fraction_numerical': 0.00471281296023564, 'mean_word_length': 1.5044247787610618, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5120827', 'n_tokens_mistral': 992, 'n_tokens_neox': 943, 'n_words': 279}