about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el71
1 files changed, 36 insertions, 35 deletions
diff --git a/init.el b/init.el index 77a6d1a..adb2bdb 100644 --- a/init.el +++ b/init.el
@@ -189,41 +189,42 @@
189 (add-to-list '+browse-url-secondary-browser-regexps 189 (add-to-list '+browse-url-secondary-browser-regexps
190 (replace-regexp-in-string "\\." "\\\\." domain))) 190 (replace-regexp-in-string "\\." "\\\\." domain)))
191 ;; Set up URL handlers. 191 ;; Set up URL handlers.
192 (require 'chd) 192 (:option browse-url-handlers
193 (+browse-url-set-handlers 193 (list
194 (list 194 (cons (rx ; images
195 (cons (rx ; images 195 "." (or "jpeg" "jpg" "png" "bmp") eos)
196 "." (or "jpeg" "jpg" "png" "bmp") eos) 196 (lambda (&rest args)
197 (lambda (&rest args) 197 (apply
198 (apply 198 (cond ((executable-find "mpv") #'+browse-image-with-mpv)
199 (cond ((executable-find "mpv") #'+browse-image-with-mpv) 199 (t #'eww-browse-url))
200 (t #'eww-browse-url)) 200 args)))
201 args))) 201 (cons (rx (or ;; videos
202 (cons (rx (or ;; videos 202 "youtube.com" "youtu.be" "invidious" "yewtu.be"
203 "youtube.com" "youtu.be" "invidious" "yewtu.be" 203 (seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos)
204 (seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos) 204 ;; music
205 ;; music 205 "soundcloud.com" "bandcamp.com"
206 "soundcloud.com" "bandcamp.com" 206 (seq "." (or "ogg" "mp3" "opus" "m4a") eos)))
207 (seq "." (or "ogg" "mp3" "opus" "m4a") eos))) 207 (lambda (&rest args)
208 (lambda (&rest args) 208 (apply (if (executable-find "mpv")
209 (apply (if (executable-find "mpv") 209 #'+browse-url-with-mpv
210 #'+browse-url-with-mpv 210 browse-url-secondary-browser-function)
211 browse-url-secondary-browser-function) 211 args)))
212 args))) 212 (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites
213 (cons chd/url-regexps #'browse-url-chrome) 213 (lambda (&rest args)
214 (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites 214 (apply browse-url-secondary-browser-function args)))
215 (lambda (&rest args) 215 (cons "xkcd\\.com"
216 (apply browse-url-secondary-browser-function args))) 216 (lambda (&rest args)
217 (cons "xkcd\\.com" 217 (apply (if (fboundp #'xkcd-get)
218 (lambda (&rest args) 218 (progn (require '+xkcd)
219 (apply (if (fboundp #'xkcd-get) 219 #'+xkcd-get-from-url)
220 (progn (require '+xkcd) 220 +browse-url-browser-function)
221 #'+xkcd-get-from-url) 221 args)))
222 +browse-url-browser-function) 222 (cons "." ; everything else
223 args))) 223 (lambda (&rest args)
224 (cons "." ; everything else 224 (apply +browse-url-browser-function args)))))
225 (lambda (&rest args) 225 (with-eval-after-load 'chd
226 (apply +browse-url-browser-function args))))) 226 (add-to-list 'browse-url-handlers
227 (cons chd/url-regexps #'browse-url-chrome)))
227 ;; Transform URLs before passing to `browse-url' 228 ;; Transform URLs before passing to `browse-url'
228 (:option +browse-url-transformations `((,(rx (or "youtube.com" 229 (:option +browse-url-transformations `((,(rx (or "youtube.com"
229 "youtu.be")) 230 "youtu.be"))