summary refs log tree commit diff stats
path: root/init.el
diff options
context:
space:
mode:
authorCase Duckworth2021-08-28 23:09:15 -0500
committerCase Duckworth2021-08-28 23:09:15 -0500
commit66fde316d31605bcd5dad42c0c7caa6c355f1a56 (patch)
treef9ce05ec32dddc7d922803413e495958fe7def03 /init.el
parentIgnore errors (diff)
downloademacs-66fde316d31605bcd5dad42c0c7caa6c355f1a56.tar.gz
emacs-66fde316d31605bcd5dad42c0c7caa6c355f1a56.zip
Fancify browse-url-set-handlers
Diffstat (limited to 'init.el')
-rw-r--r--init.el34
1 files changed, 25 insertions, 9 deletions
diff --git a/init.el b/init.el index 5ab1559..4de92d4 100644 --- a/init.el +++ b/init.el
@@ -81,15 +81,31 @@
81 browse-url-firefox-new-window-is-tab t) 81 browse-url-firefox-new-window-is-tab t)
82 82
83 (acdw/browse-url-set-handlers 83 (acdw/browse-url-set-handlers
84 `(("\\.jpe?g\\'" . ,(if (executable-find "feh") 84 (list
85 #'browse-url-feh 85 (cons (rx (seq "." (or "jpeg" "jpg" ; images
86 #'eww-browse-url)) 86 "png")
87 ("youtube\\.com\\|youtu\\.be" . ,(if (executable-find "mpv") 87 eos))
88 #'browse-url-mpv 88 (lambda (&rest args)
89 #'eww-browse-url)) 89 (apply (if (executable-find "feh")
90 ("google\\.com" . browse-url-default-browser) 90 #'browse-url-feh
91 ("\\(twitter\\.com\\|t\\.co\\)" . acdw/eww-browse-twitter-url) 91 #'eww-browse-url)
92 ("." . eww-browse-url))) 92 args)))
93 (cons (rx (or "youtube.com" ; videos
94 "youtu.be"
95 (seq "." (or "mp4"
96 "gif")
97 eos)))
98 (lambda (&rest args)
99 (apply (if (executable-find "mpv")
100 #'browse-url-mpv
101 browse-url-secondary-browser-function)
102 args)))
103 (cons (rx (or "google.com" ; websites that don't work with eww
104 "reddit.com"
105 "twitter.com"))
106 browse-url-secondary-browser-function)
107 (cons "." ; everything else
108 #'eww-browse-url)))
93 109
94 ;; Buttonize gemini:// links. 110 ;; Buttonize gemini:// links.
95 (acdw/add-button-url-regexp-protocol "gemini")) 111 (acdw/add-button-url-regexp-protocol "gemini"))