From f35083da9f2091591be770f567886c4eeea7a7a5 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@pmade.com>
Date: Wed, 2 Dec 2015 20:07:37 -0700
Subject: [PATCH] Don't auto-delete workspaces

  * Previously I was removing empty workspaces after switching away from
    them, but this seemed to cause a bug when workspaces were defined
    statically in your XMonad configuration.

  * Next up: a function to delete an existing project.
---
 XMonad/Actions/DynamicProjects.hs | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/XMonad/Actions/DynamicProjects.hs b/XMonad/Actions/DynamicProjects.hs
index 8f2ec3e9..90bbe288 100644
--- a/XMonad/Actions/DynamicProjects.hs
+++ b/XMonad/Actions/DynamicProjects.hs
@@ -76,13 +76,13 @@ import qualified XMonad.Util.ExtensibleState as XS
 -- or further configure the workspace/project.
 --
 -- When using the @switchProjectPrompt@ function, workspaces are
--- created and deleted as necessary.  This means you can create new
--- project spaces on the fly as needed.  (These dynamic projects are
+-- created as needed.  This means you can create new project spaces
+-- (and therefore workspaces) on the fly.  (These dynamic projects are
 -- not preserved across restarts.)
 --
 -- Additionally, frequently used projects can be configured statically
 -- in your XMonad configuration.  Doing so allows you to configure the
--- start-up hook.
+-- per-project start-up hook.
 
 --------------------------------------------------------------------------------
 -- $usage
@@ -213,10 +213,7 @@ switchProject p = do
   when (null ws && isNothing (projectStartHook oldp)) $
     XS.modify (\s -> s {projects = Map.delete name $ projects s})
 
-  -- Remove the old workspace (if empty) and activate the new
-  -- workspace.  The project will be activated by the log hook.
-  removeEmptyWorkspace
-  addWorkspace (projectName p)
+  appendWorkspace (projectName p)
 
 --------------------------------------------------------------------------------
 -- | Prompt for a project name and then switch to it.  Automatically