31 lines
921 B
EmacsLisp
31 lines
921 B
EmacsLisp
;;; module-browser.el --- open webpages -*- lexical-binding: t; -*-
|
|
;;;
|
|
;;; Commentary:
|
|
;;;
|
|
;;; Modern web browsers suck. Open a webpage from within Emacs, and
|
|
;;; allow opening with a sucky browser if you really have to.
|
|
;;;
|
|
;;; Code:
|
|
|
|
(require 'eww)
|
|
(setq shr-max-image-proportion 0.7)
|
|
(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 'module-browser)
|
|
|
|
;;; module-browser.el ends here.
|