aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Actions/Plane.hs
diff options
context:
space:
mode:
authorMalebria <malebria@riseup.net>2008-05-27 00:53:37 +0200
committerMalebria <malebria@riseup.net>2008-05-27 00:53:37 +0200
commite75ee0b296748adbb808a6930d72c20242a31c1e (patch)
tree85fa02473551dba6ed5f37f21f98fb08ac8d62df /XMonad/Actions/Plane.hs
parent1253e611f75763796affa3e16e199d8a5a7f33b6 (diff)
downloadXMonadContrib-e75ee0b296748adbb808a6930d72c20242a31c1e.tar.gz
XMonadContrib-e75ee0b296748adbb808a6930d72c20242a31c1e.tar.xz
XMonadContrib-e75ee0b296748adbb808a6930d72c20242a31c1e.zip
Use lines instead of columns in configuration (similar to GNOME and KDE)
darcs-hash:20080526225337-1ef02-3e20f3958a0ec394f837a32af42c9738812ed24d.gz
Diffstat (limited to '')
-rw-r--r--XMonad/Actions/Plane.hs31
1 files changed, 20 insertions, 11 deletions
diff --git a/XMonad/Actions/Plane.hs b/XMonad/Actions/Plane.hs
index 639368a..a3bb6c3 100644
--- a/XMonad/Actions/Plane.hs
+++ b/XMonad/Actions/Plane.hs
@@ -9,7 +9,7 @@
-- Portability : unportable
--
-- This module has functions to navigate through workspaces in a bidimensional
--- manner. It allows the organization of workspaces in columns, and provides
+-- manner. It allows the organization of workspaces in lines, and provides
-- functions to move and shift windows in all four directions (left, up, right
-- and down) possible in a surface.
--
@@ -76,8 +76,8 @@ data Limits
-- There're two parameters that must be provided to navigate, and it's a good
-- idea to use them with the same values in each keybinding.
--
--- The first is the number of columns in which the workspaces are going to be
--- organized. It's possible to use a number of columns that is not a divisor
+-- The first is the number of lines in which the workspaces are going to be
+-- organized. It's possible to use a number of lines that is not a divisor
-- of the number of workspaces, but the results are better when using a
-- divisor. If it's not a divisor, the last line will have the remaining
-- workspaces.
@@ -87,7 +87,7 @@ data Limits
-- | Shift a window to the next workspace in 'Direction'. Note that this will
-- also move to the next workspace.
planeShift
- :: Int -- ^ Number of columns.
+ :: Int -- ^ Number of lines.
-> Limits
-> Direction
-> X ()
@@ -108,30 +108,39 @@ planeMove = plane greedyView
plane ::
(WorkspaceId -> WindowSet -> WindowSet) -> Int -> Limits -> Direction ->
X ()
-plane function columns limits direction = do
+plane function numberLines limits direction = do
state <- get
xconf <- ask
- let vertical f =
- if column >= areasColumn
- then mod (f currentWS columns) $ areasLine * columns
- else mod (f currentWS columns) $ (areasLine + 1) * columns
+ let
horizontal f =
if line < areasLine
then mod (f column) columns + lineNumber
else mod (f column) areasColumn + lineNumber
+ vertical f =
+ if column >= areasColumn
+ then mod (f currentWS columns) $ areasLine * columns
+ else mod (f currentWS columns) $ (areasLine + 1) * columns
+
+ lineNumber = line * columns
areasLine = div areas columns
areasColumn = mod areas columns
- lineNumber = line * columns
line = div currentWS columns
column = mod currentWS columns
+
+ columns =
+ if mod areas numberLines == 0 then preColumns else preColumns + 1
+
currentWS = fromJust mCurrentWS
+ preColumns = div areas numberLines
mCurrentWS = elemIndex (currentTag $ windowset state) areaNames
+ areas = length areaNames
+
run condition position =
when (limits == Circular || condition) $
windows $ function $ areaNames !! position
- areas = length areaNames
+
areaNames = workspaces $ config $ xconf
when (isJust mCurrentWS) $