aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Actions
diff options
context:
space:
mode:
authorMarco TĂșlio Gontijo e Silva <marcot@riseup.net>2008-07-09 02:19:00 +0200
committerMarco TĂșlio Gontijo e Silva <marcot@riseup.net>2008-07-09 02:19:00 +0200
commit570a81e6acc1ad4dd1c5a62a6f5a6432d090e409 (patch)
treee4c39af723a4ab493c938502adce150775fe37a0 /XMonad/Actions
parent00ecf21191566da9e43ed3ddb05b52d397d95485 (diff)
downloadXMonadContrib-570a81e6acc1ad4dd1c5a62a6f5a6432d090e409.tar.gz
XMonadContrib-570a81e6acc1ad4dd1c5a62a6f5a6432d090e409.tar.xz
XMonadContrib-570a81e6acc1ad4dd1c5a62a6f5a6432d090e409.zip
XMonad.Actions.Plane: GConf support
Thanks to Johan Dahlin. darcs-hash:20080709001900-7641b-5cd3532d58f1932d361bb7dc7cb070ae010ece82.gz
Diffstat (limited to 'XMonad/Actions')
-rw-r--r--XMonad/Actions/Plane.hs36
1 files changed, 27 insertions, 9 deletions
diff --git a/XMonad/Actions/Plane.hs b/XMonad/Actions/Plane.hs
index 597f7da..8de7ab6 100644
--- a/XMonad/Actions/Plane.hs
+++ b/XMonad/Actions/Plane.hs
@@ -27,6 +27,7 @@ module XMonad.Actions.Plane
-- * Data types
Direction (..)
, Limits (..)
+ , Lines (..)
-- * Navigating through workspaces
, planeShift
@@ -40,6 +41,7 @@ import Data.Maybe
import XMonad
import XMonad.StackSet hiding (workspaces)
+import XMonad.Util.Run
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@ file:
@@ -52,7 +54,7 @@ import XMonad.StackSet hiding (workspaces)
-- >
-- > myNewkeys (XConfig {modMask = m}) =
-- > fromList
--- > [ ((keyMask .|. m, keySym), function 3 Finite direction)
+-- > [ ((keyMask .|. m, keySym), function (Lines 3) Finite direction)
-- > | (keySym, direction) <- zip [xK_Left .. xK_Down] $ enumFrom ToLeft
-- > , (keyMask, function) <- [(0, planeMove), (shiftMask, planeShift)]
-- > ]
@@ -71,6 +73,14 @@ data Limits
-- other side.
deriving Eq
+-- | The number of lines in which the workspaces will be arranged. 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.
+data Lines
+ = GConf -- ^ Use @gconftool-2@ to find out the number of lines.
+ | Lines Int -- ^ Specify the number of lines explicity.
+
-- $navigating
--
-- There're two parameters that must be provided to navigate, and it's a good
@@ -87,7 +97,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 lines.
+ :: Lines
-> Limits
-> Direction
-> X ()
@@ -98,20 +108,28 @@ shift' ::
shift' area = greedyView area . shift area
-- | Move to the next workspace in 'Direction'.
-planeMove
- :: Int -- ^ Number of columns.
- -> Limits
- -> Direction
- -> X ()
+planeMove :: Lines -> Limits -> Direction -> X ()
planeMove = plane greedyView
plane ::
- (WorkspaceId -> WindowSet -> WindowSet) -> Int -> Limits -> Direction ->
+ (WorkspaceId -> WindowSet -> WindowSet) -> Lines -> Limits -> Direction ->
X ()
-plane function numberLines limits direction = do
+plane function numberLines_ limits direction = do
state <- get
xconf <- ask
+ numberLines <-
+ liftIO $
+ case numberLines_ of
+ Lines numberLines__ ->
+ return numberLines__
+ GConf ->
+ do
+ numberLines__ <-
+ runProcessWithInput "gconftool-2"
+ ["--get", "/apps/panel/applets/workspace_switcher_screen0/prefs/num_rows"] ""
+ return $ read numberLines__
+
let
horizontal f =
if line < areasLine