From 8ddc675faa186c4585b7c4b6df93861bd4b16b05 Mon Sep 17 00:00:00 2001 From: David Roundy Date: Thu, 18 Oct 2007 16:56:04 +0200 Subject: add function to rename workspaces. darcs-hash:20071018145604-72aca-d28097e49bc8ba0a939dcc87cbd6fd791682494b.gz --- DynamicWorkspaces.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'DynamicWorkspaces.hs') diff --git a/DynamicWorkspaces.hs b/DynamicWorkspaces.hs index ad003f4..6aad4c5 100644 --- a/DynamicWorkspaces.hs +++ b/DynamicWorkspaces.hs @@ -17,7 +17,7 @@ module XMonadContrib.DynamicWorkspaces ( -- * Usage -- $usage addWorkspace, removeWorkspace, - selectWorkspace, + selectWorkspace, renameWorkspace, toNthWorkspace, withNthWorkspace ) where @@ -38,6 +38,7 @@ import XMonadContrib.XPrompt ( XPConfig ) -- -- > , ((modMask .|. shiftMask, xK_n), selectWorkspace defaultXPConfig layoutHook) -- > , ((modMask .|. shiftMask, xK_BackSpace), removeWorkspace) +-- > , ((modMask .|. shiftMask .|. controlMask, xK_r), renameWorkspace defaultXPConfig) -- -- > -- mod-[1..9] %! Switch to workspace N -- > -- mod-shift-[1..9] %! Move client to workspace N @@ -49,6 +50,13 @@ import XMonadContrib.XPrompt ( XPConfig ) allPossibleTags :: [WorkspaceId] allPossibleTags = map (:"") ['0'..] +renameWorkspace :: XPConfig -> X () +renameWorkspace conf = workspacePrompt conf $ \w -> + windows $ \s -> let sett wk = wk { tag = w } + setscr scr = scr { workspace = sett $ workspace scr } + sets q = q { current = setscr $ current q } + in sets $ removeWorkspace' w s + toNthWorkspace :: (String -> X ()) -> Int -> X () toNthWorkspace job wnum = do ws <- gets (sort . map tag . workspaces . windowset) case drop wnum ws of -- cgit v1.2.3