From 6f0f5ce628bfaa8988c07f6067dfd7a81f77390c Mon Sep 17 00:00:00 2001 From: "nicolas.dudebout" Date: Mon, 23 Jan 2012 00:58:43 +0100 Subject: Adding use case for namedScratchpad. Ignore-this: 44201e82bcd708cd7098f060345400f1 darcs-hash:20120122235843-358d5-68faf2afbfa56393817e6ef2ceaedc891da101ba.gz --- XMonad/Util/NamedScratchpad.hs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'XMonad/Util') diff --git a/XMonad/Util/NamedScratchpad.hs b/XMonad/Util/NamedScratchpad.hs index 6fc226d..c3e0452 100644 --- a/XMonad/Util/NamedScratchpad.hs +++ b/XMonad/Util/NamedScratchpad.hs @@ -24,12 +24,14 @@ module XMonad.Util.NamedScratchpad ( namedScratchpadAction, allNamedScratchpadAction, namedScratchpadManageHook, - namedScratchpadFilterOutWorkspace + namedScratchpadFilterOutWorkspace, + namedScratchpadFilterOutWorkspacePP ) where import XMonad import XMonad.Hooks.ManageHelpers (doRectFloat) import XMonad.Actions.DynamicWorkspaces (addHiddenWorkspace) +import XMonad.Hooks.DynamicLog (PP, ppSort) import Control.Monad (filterM) import Data.Maybe (listToMaybe) @@ -160,4 +162,20 @@ namedScratchpadManageHook = composeAll . fmap (\c -> query c --> hook c) namedScratchpadFilterOutWorkspace :: [WindowSpace] -> [WindowSpace] namedScratchpadFilterOutWorkspace = filter (\(W.Workspace tag _ _) -> tag /= scratchpadWorkspaceTag) +-- | Transforms a pretty-printer into one not displaying the NSP workspace. +-- +-- A simple use could be: +-- +-- > logHook = dynamicLogWithPP . namedScratchpadFilterOutWorkspace $ defaultPP +-- +-- Here is another example, when using "XMonad.Layout.IndependentScreens". +-- If you have handles @hLeft@ and @hRight@ for bars on the left and right screens, respectively, and @pp@ is a pretty-printer function that takes a handle, you could write +-- +-- > logHook = let log screen handle = dynamicLogWithPP . namedScratchpadFilterOutWorkspacePP . marshallPP screen . pp $ handle +-- > in log 0 hLeft >> log 1 hRight +namedScratchpadFilterOutWorkspacePP :: PP -> PP +namedScratchpadFilterOutWorkspacePP pp = pp { + ppSort = fmap (. namedScratchpadFilterOutWorkspace) (ppSort pp) + } + -- vim:ts=4:shiftwidth=4:softtabstop=4:expandtab:foldlevel=20: -- cgit v1.2.3