From fd11b6f28e309fdd5baa61ffcce6becbd22f7526 Mon Sep 17 00:00:00 2001 From: nelhage Date: Fri, 10 Aug 2007 03:26:53 +0000 Subject: [PATCH] ViewPrev.hs Add a ViewPrev extension which gives a viewPrev command to view the previously visible workspace. --- ViewPrev.hs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 ViewPrev.hs diff --git a/ViewPrev.hs b/ViewPrev.hs new file mode 100644 index 00000000..840dd85d --- /dev/null +++ b/ViewPrev.hs @@ -0,0 +1,28 @@ +----------------------------------------------------------------------------- +-- | +-- Module : XMonadContrib.ViewPrev +-- Copyright : (c) Nelson Elhage +-- License : BSD3-style (see LICENSE) +-- +-- Maintainer : Nelson Elhage +-- 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'