summaryrefslogtreecommitdiff
path: root/org-roam-ui.el
diff options
context:
space:
mode:
Diffstat (limited to 'org-roam-ui.el')
-rw-r--r--org-roam-ui.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/org-roam-ui.el b/org-roam-ui.el
index 4b07cde..b63e089 100644
--- a/org-roam-ui.el
+++ b/org-roam-ui.el
@@ -36,6 +36,7 @@
(require 'json)
(require 'simple-httpd)
(require 'org-roam)
+(require 'org-roam-dailies)
(require 'websocket)
(defgroup org-roam-ui nil
@@ -168,6 +169,7 @@ This serves the web-build and API over HTTP."
:host 'local
:on-open (lambda (ws) (progn
(setq oru-ws ws)
+ (org-roam-ui--send-variables ws)
(org-roam-ui--send-graphdata)
(when org-roam-ui-update-on-save
(add-hook 'after-save-hook #'org-roam-ui--on-save))
@@ -407,6 +409,15 @@ unchanged."
org-roam-ui-custom-theme))
ui-theme))
+
+(defun org-roam-ui--send-variables (ws)
+ "Send org-roam variables through the websocket WS."
+ (when (boundp 'org-roam-dailies-directory)
+ (websocket-send-text ws (json-encode `((type . "variables")
+ (data .
+ (("dailyDir" . ,(concat org-roam-directory org-roam-dailies-directory))
+ ("roamDir" . ,org-roam-directory))))))))
+
(defun org-roam-ui-sql-to-alist (column-names rows)
"Convert sql result to alist for json encoding.
ROWS is the sql result, while COLUMN-NAMES is the columns to use."