app/calendar: don't require :feature workspaces
This commit is contained in:
parent
21da187361
commit
f6f2c92373
1 changed files with 22 additions and 10 deletions
|
@ -1,24 +1,36 @@
|
|||
;;; app/calendar/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +calendar--wconf nil)
|
||||
|
||||
(defun +calendar--init ()
|
||||
(if-let* ((win (cl-loop for win in (doom-visible-windows)
|
||||
if (string-match-p "^\\*cfw:" (buffer-name (window-buffer it)))
|
||||
return win)))
|
||||
(select-window win)
|
||||
(call-interactively +calendar-open-function)))
|
||||
|
||||
;;;###autoload
|
||||
(defun =calendar ()
|
||||
"Activate (or switch to) `calendar' in its workspace."
|
||||
(interactive)
|
||||
(unless (featurep! :feature workspaces)
|
||||
(user-error ":feature workspaces is required, but disabled"))
|
||||
(+workspace-switch "Calendar" t)
|
||||
(if-let* ((win (cl-loop for win in (doom-visible-windows)
|
||||
if (string-match-p "^\\*cfw" (buffer-name (window-buffer it)))
|
||||
return win)))
|
||||
(select-window win)
|
||||
(call-interactively +calendar-open-function))
|
||||
(+workspace/display))
|
||||
(if (featurep! :feature workspaces)
|
||||
(progn
|
||||
(+workspace-switch "Calendar" t)
|
||||
(+calendar--init)
|
||||
(+workspace/display))
|
||||
(setq +calendar--wconf (current-window-configuration))
|
||||
(delete-other-windows)
|
||||
(+calendar--init)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +calendar/quit ()
|
||||
"TODO"
|
||||
(interactive)
|
||||
(+workspace/delete "Calendar"))
|
||||
(if (featurep! :feature workspaces)
|
||||
(+workspace/delete "Calendar")
|
||||
(doom-kill-matching-buffers "^\\*cfw:")
|
||||
(set-window-configuration +calendar--wconf)
|
||||
(setq +calendar--wconf nil)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +calendar/open-calendar ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue