aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ViewPrev.hs28
1 files changed, 28 insertions, 0 deletions
diff --git a/ViewPrev.hs b/ViewPrev.hs
new file mode 100644
index 0000000..840dd85
--- /dev/null
+++ b/ViewPrev.hs
@@ -0,0 +1,28 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module : XMonadContrib.ViewPrev
+-- Copyright : (c) Nelson Elhage <nelhage@mit.edu>
+-- License : BSD3-style (see LICENSE)
+--
+-- Maintainer : Nelson Elhage <nelhage@mit.edu>
+-- Stability : unstable
+-- Portability : unportable
+--
+-- A module that implements a command to switch to the previously
+-- viewed workspace
+--
+-----------------------------------------------------------------------------
+
+module XMonadContrib.ViewPrev (
+ viewPrev
+ ) where
+
+import XMonad
+import Operations
+import qualified StackSet as W
+
+viewPrev' :: (Eq a, Eq s, Eq i) => W.StackSet i a s sd -> W.StackSet i a s sd
+viewPrev' x = W.view (W.tag . head . W.hidden $ x) x
+
+viewPrev :: X ()
+viewPrev = windows viewPrev'