diff --git a/modules/feature/workspaces/autoload/workspaces.el b/modules/feature/workspaces/autoload/workspaces.el index 0d0ba2eee..bc5ffbb67 100644 --- a/modules/feature/workspaces/autoload/workspaces.el +++ b/modules/feature/workspaces/autoload/workspaces.el @@ -445,11 +445,13 @@ the next." ;; ;;;###autoload -(defun +workspaces|delete-associated-workspace (frame) +(defun +workspaces|delete-associated-workspace (&optional frame) "Delete workspace associated with current frame. A workspace gets associated with a frame when a new frame is interactively created." (when persp-mode + (unless frame + (setq frame (selected-frame))) (let ((frame-persp (frame-parameter frame 'workspace))) (when (string= frame-persp (+workspace-current-name)) (+workspace/delete frame-persp))))) @@ -470,9 +472,9 @@ created." (with-selected-frame frame (if (not (persp-frame-list-without-daemon)) (+workspace-switch +workspaces-main t) - (+workspace/new) + (+workspace-switch (format "#%s" (+workspace--generate-id)) t) (set-frame-parameter frame 'workspace (+workspace-current-name))) - (+workspace/display)))) + (run-at-time 0.1 nil #'+workspace/display)))) (defvar +workspaces--project-dir nil) ;;;###autoload diff --git a/modules/feature/workspaces/config.el b/modules/feature/workspaces/config.el index 7c30f758e..bcc76829a 100644 --- a/modules/feature/workspaces/config.el +++ b/modules/feature/workspaces/config.el @@ -65,9 +65,6 @@ renamed.") persp-set-last-persp-for-new-frames t persp-switch-to-added-buffer nil persp-remove-buffers-from-nil-persp-behaviour nil - ;; Don't restore winconf on new frames - persp-init-frame-behaviour t - persp-init-new-frame-behaviour-override 'auto-temp ;; Don't auto-load on startup persp-auto-resume-time -1 ;; auto-save on kill @@ -83,7 +80,8 @@ renamed.") (add-hook 'doom-cleanup-hook #'+workspaces|cleanup-unassociated-buffers) ;; per-frame workspaces - (setq persp-init-new-frame-behaviour-override nil + (setq persp-init-frame-behaviour t + persp-init-new-frame-behaviour-override nil persp-interactive-init-frame-behaviour-override #'+workspaces|associate-frame persp-emacsclient-init-frame-behaviour-override #'+workspaces|associate-frame) ;; delete frame associated with workspace, if it exists