From 8350c91f71825a9f21609316f1bdd59c0a33b6cf Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sun, 8 Sep 2024 18:40:01 +0200 Subject: [PATCH] added ability to open current eww url in system browser...stupid js --- emacs/init.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 5cf6cae..ce1cbf6 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -779,6 +779,19 @@ (setq shr-image-animate nil) (setq browse-url-browser-function 'eww-browse-url) +; for pages that require JS for some stupid reason... +(defun browse-url-xdg-open (url &optional _new-window) + "Open URL using the default browser via `xdg-open'." + (interactive (browse-url-interactive-arg "URL: ")) + (call-process "xdg-open" nil 0 nil url)) + +(defun eww-open-in-default-browser () + "Open the current EWW page in the default system browser." + (interactive) + (browse-url-xdg-open (eww-current-url))) + +(define-key eww-mode-map (kbd "C-c o") 'eww-open-in-default-browser) + (provide 'init) ;;; init.el ends here