This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+tools/eaf/funcs.el
2021-02-07 21:34:50 +01:00

37 lines
1.2 KiB
EmacsLisp

(defun duckduckgo ()
(interactive)
(eaf-open-browser "www.duckduckgo.com"))
(defun wikipedia ()
(interactive)
(eaf-open-browser "www.wikipedia.com"))
(defun youtube ()
(interactive)
(eaf-open-browser "www.youtube.com"))
(defun eaf-toggle-dark-mode ()
(interactive)
(if (not (eq major-mode 'eaf-mode))
(message "Not in eaf-mode buffer")
(let* ((app-name eaf--buffer-app-name)
(app-dark-mode
(intern
(format "eaf-%s-dark-mode"
(if (string= app-name "pdf-viewer")
"pdf"
app-name))))
(current-state (cdr (assoc app-dark-mode eaf-var-list))))
(let ((browser (string= app-name "browser")))
(cond ((member current-state '("true" "follow" "ignore"))
(eaf-set app-dark-mode "false")
(when browser
(eaf-proxy-refresh_page)))
(t
(eaf-set app-dark-mode "true")
(when browser
(eaf-proxy-insert_or_dark_mode))))
(when (not browser)
(eaf-restart-process))))))
(defun spacemacs/open-with-eaf ()
(interactive)
(eaf-open (buffer-file-name)))