summaryrefslogtreecommitdiff
path: root/org-roam-ui.el
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-10-11 01:46:29 +0200
committerThomas F. K. Jorna <[email protected]>2021-10-11 01:46:29 +0200
commitca8adb497460e39654069ef583d851dd05078cb4 (patch)
treeef194bebfe1154823450daa708396782109dfe82 /org-roam-ui.el
parentbb6fe7325dfe76c0618d34455e56122c3204a3b3 (diff)
parentf495a9499c549d92d64ee3a2e50a239ea769c609 (diff)
chore(preview): merge branches
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."