From c04271bf6b9126f635b9b9baf173b2af5380fd84 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 17 Sep 2013 01:36:14 +0200 Subject: Add layout modifier for floating layer support --- MetaTile/Config.hs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'MetaTile/Config.hs') diff --git a/MetaTile/Config.hs b/MetaTile/Config.hs index 71706d8..b553bd4 100644 --- a/MetaTile/Config.hs +++ b/MetaTile/Config.hs @@ -20,7 +20,7 @@ -- ------------------------------------------------------------------------ -module MetaTile.Config (defaultConfig, Default(..)) where +module MetaTile.Config (Default(..)) where -- -- Useful imports @@ -34,7 +34,10 @@ import qualified MetaTile.Core as MetaTile ,layoutHook,modMask,terminal,normalBorderColor,focusedBorderColor,defaultBorderWidth,focusFollowsMouse ,handleEventHook,clickJustFocuses,rootMask,frameMask,clientMask) +import Prelude hiding (Floating) import MetaTile.Layout +import MetaTile.Layout.Floating +import MetaTile.Layout.LayoutModifier import MetaTile.Operations import qualified MetaTile.StackSet as W import Data.Bits ((.|.)) @@ -128,7 +131,7 @@ startupHook = return () -- | The available layouts. Note that each layout is separated by |||, which -- denotes layout choice. -layout = tiled ||| Mirror tiled ||| Full +layout = floating $ tiled ||| Mirror tiled ||| Full where -- default tiling algorithm partitions the screen into two panes tiled = Tall nmaster delta ratio @@ -209,6 +212,9 @@ keys conf@(XConfig {MetaTile.modMask = modMask}) = M.fromList $ , ((modMask, xK_h ), sendMessage Shrink) -- %! Shrink the master area , ((modMask, xK_l ), sendMessage Expand) -- %! Expand the master area + -- floating layer support + , ((modMask, xK_t ), withFocused sink) -- %! Push window back into tiling + -- increase or decrease number of windows in the master area , ((modMask , xK_comma ), sendMessage (IncMasterN 1)) -- %! Increment the number of windows in the master area , ((modMask , xK_period), sendMessage (IncMasterN (-1))) -- %! Deincrement the number of windows in the master area @@ -237,12 +243,16 @@ keys conf@(XConfig {MetaTile.modMask = modMask}) = M.fromList $ -- | Mouse bindings: default actions bound to mouse events mouseBindings :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ()) mouseBindings (XConfig {MetaTile.modMask = modMask}) = M.fromList + -- mod-button1 %! Set the window to floating mode and move by dragging + [ ((modMask, button1), \w -> focus w >> mouseMoveWindow w) -- mod-button2 %! Raise the window to the top of the stack - [ ((modMask, button2), windows . (W.shiftMaster .) . W.focusWindow) + , ((modMask, button2), windows . (W.shiftMaster .) . W.focusWindow) + -- mod-button3 %! Set the window to floating mode and resize by dragging + , ((modMask, button3), \w -> focus w >> mouseResizeWindow w) -- you may also bind events to the mouse scroll wheel (button4 and button5) ] -instance (a ~ Choose Tall (Choose (Mirror Tall) Full)) => Default (XConfig a) where +instance (a ~ ModifiedLayout Floating (Choose Tall (Choose (Mirror Tall) Full))) => Default (XConfig a) where def = XConfig { MetaTile.workspaces = workspaces , MetaTile.layoutHook = layout @@ -264,11 +274,6 @@ instance (a ~ Choose Tall (Choose (Mirror Tall) Full)) => Default (XConfig a) wh , MetaTile.rootMask = rootMask } --- | The default set of configuration values itself -{-# DEPRECATED defaultConfig "Use def (from Data.Default, and re-exported by MetaTile and MetaTile.Config) instead." #-} -defaultConfig :: XConfig (Choose Tall (Choose (Mirror Tall) Full)) -defaultConfig = def - -- | Finally, a copy of the default bindings in simple textual tabular format. help :: String help = unlines ["The default modifier key is 'alt'. Default keybindings:", -- cgit v1.2.3