diff options
-rw-r--r-- | init.el | 68 |
1 files changed, 61 insertions, 7 deletions
diff --git a/init.el b/init.el index 7d32117..057934a 100644 --- a/init.el +++ b/init.el | |||
@@ -86,12 +86,51 @@ | |||
86 | browse-url-firefox-arguments '("--new-tab") ; for firefox | 86 | browse-url-firefox-arguments '("--new-tab") ; for firefox |
87 | browse-url-firefox-new-window-is-tab t) | 87 | browse-url-firefox-new-window-is-tab t) |
88 | 88 | ||
89 | (defvar browse-url-mpv-arguments nil | ||
90 | "Arguments to pass to mpv in `browse-url-mpv'.") | ||
91 | |||
92 | (defun browse-url-mpv (url &optional new-window) | ||
93 | "Play `URL' in mpv." | ||
94 | (interactive (browse-url-interactive-arg "Video URL: ")) | ||
95 | (ignore new-window) ;; mpv always opens a new window | ||
96 | (let* ((url (browse-url-encode-url url)) | ||
97 | (process-environment (browse-url-process-environment))) | ||
98 | (message "Playing %s in mpv..." url) | ||
99 | (apply #'start-process | ||
100 | (concat "mpv " url) nil | ||
101 | "mpv" | ||
102 | (append | ||
103 | browse-url-mpv-arguments | ||
104 | (list url))))) | ||
105 | |||
106 | (defvar browse-url-feh-arguments '("--auto-zoom" | ||
107 | "--geometry" "800x600") | ||
108 | "Arguments to pass to feh in `browse-url-feh'.") | ||
109 | |||
110 | (defun browse-url-feh (url &optional new-window) | ||
111 | "Open `URL' in feh." | ||
112 | (interactive (browse-url-interactive-arg "Video URL: ")) | ||
113 | (ignore new-window) ;; mpv always opens a new window | ||
114 | (let* ((url (browse-url-encode-url url)) | ||
115 | (process-environment (browse-url-process-environment))) | ||
116 | (message "Opening %s in feh..." url) | ||
117 | (apply #'start-process | ||
118 | (concat "feh " url) nil | ||
119 | "feh" | ||
120 | (append | ||
121 | browse-url-feh-arguments | ||
122 | (list url))))) | ||
123 | |||
89 | ;; `browse-url-browser-function' as an alist is deprecated in Emacs 28 for | 124 | ;; `browse-url-browser-function' as an alist is deprecated in Emacs 28 for |
90 | ;; `browse-url-handlers'. | 125 | ;; `browse-url-handlers'. |
91 | (set-default (if (version<= emacs-version "28") | 126 | (set-default (if (version<= emacs-version "28") |
92 | 'browse-url-browser-function | 127 | 'browse-url-browser-function |
93 | 'browse-url-handlers) | 128 | 'browse-url-handlers) |
94 | '(("." . eww-browse-url))) | 129 | `(,(when (executable-find "feh") |
130 | '("\\.jpe?g\\'" . browse-url-feh)) | ||
131 | ,(when (executable-find "mpv") | ||
132 | '("youtube\\.com\\|youtu\\.be" . browse-url-mpv)) | ||
133 | ("." . eww-browse-url))) | ||
95 | 134 | ||
96 | ;; Buttonize gemini:// links. | 135 | ;; Buttonize gemini:// links. |
97 | (acdw/add-button-url-regexp-protocol "gemini")) | 136 | (acdw/add-button-url-regexp-protocol "gemini")) |
@@ -296,12 +335,23 @@ | |||
296 | erc-track-mode | 335 | erc-track-mode |
297 | erc-truncate-mode) | 336 | erc-truncate-mode) |
298 | 337 | ||
299 | ;; (setup (:straight erc-hl-nicks) | 338 | (with-eval-after-load 'erc |
300 | ;; (with-eval-after-load 'erc | 339 | (setup (:straight erc-hl-nicks) |
301 | ;; (require 'erc-hl-nicks) | 340 | (:option (append erc-modules) 'hl-nicks |
302 | ;; (:option erc-hl-nicks-minimum-contrast-ratio 4.5) | 341 | erc-hl-nicks-minimum-contrast-ratio 4.5 |
303 | ;; (:hook-into erc-mode))) | 342 | erc-hl-nicks-color-contrast-strategy '(invert contrast)) |
304 | ) | 343 | (:hook-into erc-mode) |
344 | ;; Refresh nick colors after changing modus theme | ||
345 | ;; Ideally, there'd be a hook for /any/ time we changed theme... but | ||
346 | ;; whatever. | ||
347 | (add-hook 'modus-themes-after-load-theme-hook | ||
348 | #'erc-hl-nicks-refresh-colors)) | ||
349 | |||
350 | (setup (:straight erc-image) | ||
351 | (:option (append erc-modules) 'image | ||
352 | erc-image-inline-rescale 'window)) | ||
353 | |||
354 | (erc-update-modules))) | ||
305 | 355 | ||
306 | (setup eshell | 356 | (setup eshell |
307 | (:also-load acdw-eshell | 357 | (:also-load acdw-eshell |
@@ -401,6 +451,10 @@ like a dumbass." | |||
401 | gnus-init-file (expand-file-name "gnus.el" user-emacs-directory)) | 451 | gnus-init-file (expand-file-name "gnus.el" user-emacs-directory)) |
402 | (:global "C-c n" gnus)) | 452 | (:global "C-c n" gnus)) |
403 | 453 | ||
454 | (setup goto-addr | ||
455 | (add-hook 'text-mode-hook #'goto-address-mode) | ||
456 | (add-hook 'prog-mode-hook #'goto-address-prog-mode)) | ||
457 | |||
404 | (setup ibuffer | 458 | (setup ibuffer |
405 | (:option ibuffer-saved-filter-groups | 459 | (:option ibuffer-saved-filter-groups |
406 | '(("default" | 460 | '(("default" |