2021-02-07 21:01:04 +00:00
|
|
|
;;; funcs.el --- eaf Layer functions File for Spacemacs
|
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2021-02-07 21:01:04 +00:00
|
|
|
;;
|
|
|
|
;; Author: Daniel Nicolai <dalanicolai@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2021-02-07 21:01:04 +00:00
|
|
|
|
2021-01-11 19:15:51 +00:00
|
|
|
(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))))
|
2021-03-18 05:18:57 +00:00
|
|
|
(unless browser
|
2021-01-11 19:15:51 +00:00
|
|
|
(eaf-restart-process))))))
|
|
|
|
|
|
|
|
(defun spacemacs/open-with-eaf ()
|
|
|
|
(interactive)
|
|
|
|
(eaf-open (buffer-file-name)))
|