Better setup secondary-browser urls

This commit is contained in:
Case Duckworth 2021-12-31 15:45:31 -06:00
parent de667256b0
commit a5d0c182a5
2 changed files with 15 additions and 17 deletions

21
init.el
View File

@ -121,22 +121,10 @@
#'+browse-url-with-mpv
browse-url-secondary-browser-function)
args)))
(cons (rx ; non-eww-friendly websites
(or
"github.com"
"gitlab.com"
"google.com"
"imgur.com"
"pixelfed" "instagram.com" "bibliogram.art"
"reddit.com" "teddit.net"
"tildes.net"
"taskiq"
"twitter.com" "nitter.net"
"streamable.com"
))
browse-url-secondary-browser-function)
(cons "." ; everything else
#'eww-browse-url)))
(cons (lambda (url) ; non-eww-friendly websites
(cl-member url +browse-url-secondary-browser-regexps
:test 'string-match-p))
#'browse-url-secondary-browser-function)))
;; Transform URLs before passing to `browse-url'
(:option +browse-url-transformations `((,(rx "//" (or "youtube.com"
"youtu.be"))
@ -157,7 +145,6 @@
(:option calendar-location-name _location-name
calendar-latitude _location-latitude
calendar-longitude _location-longitude))
(setup compile
(:option compilation-always-kill t
compilation-ask-about-save nil

View File

@ -63,6 +63,17 @@ named NAME, defaulting to \"+browse-url-with-VIEWER\", and the variable
"Image URL: "
:name "+browse-image-with-mpv")
;;; Easily add extra domains to open in `browse-url-secondary-browser-function'
;; I like to open most websites in eww, but a lot of website on the modern web
;; just make that hard to do. Right now I have a list in `browse-url-handlers'
;; with domains in an (rx (or ...)) form, but that's not super easy to config.
;; With this custom setting, I'm making it a list that'll be way easier to
;; customize.
(defcustom +browse-url-secondary-browser-regexps nil
"List of URL regexps to open with `browse-url-secondary-browser-function'."
:type '(repeat regexp))
;;; URL Transformation Functions
;; There's a lot of bad websites out there. Luckily we can easily redirect
;; requests to more privacy-respecting, or just less javascript-ridden, sites