mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-12-24 13:22:23 +00:00
add more layouts
This commit is contained in:
parent
5053af3246
commit
b0e1ffdee5
1 changed files with 56 additions and 28 deletions
|
@ -1,3 +1,5 @@
|
|||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# Language ScopedTypeVariables, LambdaCase #-}
|
||||
{-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-unused-binds #-}
|
||||
|
@ -8,6 +10,9 @@ module Config (main) where
|
|||
import Control.Concurrent
|
||||
import Control.Exception ( catch , SomeException)
|
||||
import Control.Monad ( filterM )
|
||||
import Control.Arrow ( second
|
||||
, (***)
|
||||
)
|
||||
import Data.List ( isPrefixOf , isSuffixOf)
|
||||
import System.Exit (exitSuccess)
|
||||
|
||||
|
@ -35,6 +40,7 @@ import XMonad.Layout.LayoutHints
|
|||
import XMonad.Layout.MouseResizableTile
|
||||
import XMonad.Layout.NoBorders
|
||||
import XMonad.Layout.Renamed (renamed, Rename(Replace))
|
||||
import qualified XMonad.Layout.MultiColumns as MultiCol
|
||||
import XMonad.Layout.ResizableTile
|
||||
import XMonad.Layout.Simplest
|
||||
import XMonad.Layout.Spacing (spacingRaw, Border(..), toggleWindowSpacingEnabled)
|
||||
|
@ -42,7 +48,12 @@ import XMonad.Layout.SubLayouts
|
|||
import XMonad.Layout.Tabbed
|
||||
import XMonad.Layout.WindowNavigation ( windowNavigation )
|
||||
import XMonad.Layout.ZoomRow
|
||||
import XMonad.Util.EZConfig ( additionalKeysP , removeKeysP , checkKeymap)
|
||||
import XMonad.Layout.ThreeColumns
|
||||
import XMonad.Util.EZConfig ( additionalKeysP
|
||||
, removeKeysP
|
||||
, checkKeymap
|
||||
, additionalMouseBindings
|
||||
)
|
||||
import XMonad.Util.NamedScratchpad
|
||||
import XMonad.Util.Run
|
||||
import XMonad.Util.SpawnOnce (spawnOnce)
|
||||
|
@ -129,8 +140,8 @@ myTabTheme = def
|
|||
|
||||
-- layoutHints .
|
||||
|
||||
myLayout = -- avoidStruts
|
||||
smartBorders
|
||||
myLayout = avoidStruts
|
||||
$ smartBorders
|
||||
$ MTog.mkToggle1 MTog.FULL
|
||||
$ ToggleLayouts.toggleLayouts resizableTabbedLayout
|
||||
$ layoutHintsToCenter
|
||||
|
@ -139,9 +150,11 @@ myLayout = -- avoidStruts
|
|||
layouts =((rename "Tall" $ onlySpacing $ mouseResizableTile {draggerType = dragger})
|
||||
||| (rename "Horizon" $ onlySpacing $ mouseResizableTileMirrored {draggerType = dragger})
|
||||
||| (rename "BSP" $ spacingAndGaps $ borderResize $ emptyBSP)
|
||||
||| (rename "TabbedRow" $ makeTabbed $ spacingAndGaps $ zoomRow)
|
||||
||| (rename "TabbedGrid" $ makeTabbed $ spacingAndGaps $ Grid False))
|
||||
-- ||| (rename "threeCol" $ spacingAndGaps $ ThreeColMid 1 (3/100) (1/2))
|
||||
||| (rename "FL ThreeCol" $ makeTabbed $ spacingAndGaps $ Mirror $ Flip $ ThreeColMid 1 (3/100) (1/2))
|
||||
||| (rename "ThreeCol" $ makeTabbed $ spacingAndGaps $ ThreeCol 1 (3/100) (1/2))
|
||||
||| (rename "TabbedRow" $ makeTabbed $ spacingAndGaps $ zoomRow))
|
||||
-- ||| (rename "MultiCol" $ spacingAndGaps $ Mirror $ MultiCol.multiCol [1] 3 0.01 0.5)
|
||||
-- ||| (rename "TabbedGrid" $ makeTabbed $ spacingAndGaps $ Grid False))
|
||||
-- ||| (rename "spiral" $ spacingAndGaps $ spiral (9/21))
|
||||
|
||||
rename n = renamed [Replace n]
|
||||
|
@ -158,6 +171,17 @@ myLayout = -- avoidStruts
|
|||
|
||||
-- transform a layout into supporting tabs
|
||||
makeTabbed layout = BoringWindows.boringWindows . windowNavigation . addTabs shrinkText myTabTheme $ subLayout [] Simplest $ layout
|
||||
|
||||
|
||||
-- | Flip a layout, compute its 180 degree rotated form.
|
||||
newtype Flip l a = Flip (l a) deriving (Show, Read)
|
||||
|
||||
instance LayoutClass l a => LayoutClass (Flip l) a where
|
||||
handleMessage (Flip l) = fmap (fmap Flip) . handleMessage l
|
||||
description (Flip l) = "Flip " ++ description l
|
||||
runLayout (W.Workspace i (Flip l) ms) r = (map (second flipRect) *** fmap Flip) <$> runLayout (W.Workspace i l ms) (flipRect r)
|
||||
where screenWidth = fromIntegral $ rect_width r
|
||||
flipRect (Rectangle rx ry rw rh) = Rectangle (screenWidth - rx - (fromIntegral rw)) ry rw rh
|
||||
-- }}}
|
||||
|
||||
-- Startuphook ----------------------------- {{{
|
||||
|
@ -204,6 +228,8 @@ myKeys =
|
|||
, ("M--", sendMessage zoomOut)
|
||||
, ("M-#", sendMessage zoomReset)
|
||||
|
||||
, ("M-S-<Space>", for_ [1..6 :: Int] $ \_ -> sendMessage $ NextLayout)
|
||||
|
||||
|
||||
-- Tabs
|
||||
, ("M-j", ifLayoutName ("Tabbed" `isPrefixOf`) (BoringWindows.focusDown) (windows W.focusDown))
|
||||
|
@ -379,7 +405,9 @@ main = do
|
|||
-- create polybarLogHooks for every monitor and combine them using the <+> monoid instance
|
||||
let polybarLogHooks = composeAll $ map polybarLogHook monitorIndices
|
||||
|
||||
let myConfig = Desktop.desktopConfig
|
||||
let myConfig = flip additionalKeysP myKeys
|
||||
. flip removeKeysP removedKeys
|
||||
$ Desktop.desktopConfig
|
||||
{ terminal = myTerminal
|
||||
, workspaces = if useSharedWorkspaces
|
||||
then (map show [1..9 :: Int]) ++ ["NSP"]
|
||||
|
@ -394,7 +422,7 @@ main = do
|
|||
, normalBorderColor = "#282828"
|
||||
, handleEventHook = handleEventHook Desktop.desktopConfig
|
||||
--, handleEventHook = minimizeEventHook <+> handleEventHook def <+> hintsEventHook -- <+> Ewmh.fullscreenEventHook
|
||||
} `removeKeysP` removedKeys `additionalKeysP` myKeys
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue