From 4d5a97bd8e044044fc29351de50bd9a111c743f3 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 30 Aug 2022 09:41:03 -0500 Subject: [PATCH] adding eww-mpv command to launch mpv from eww with link --- README.org | 33 ++++++++++++++++++++++++++++++--- init.el | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/README.org b/README.org index ceabe9a0..b6955a27 100644 --- a/README.org +++ b/README.org @@ -1278,7 +1278,23 @@ These two packages created by Prot are interesting to me and may help to make su Builtin webbrowser for emacs. Trying it out as a text only browser for things. #+begin_src emacs-lisp +(defun chris/eww-mpv () + "Launch the url in mpv" + (interactive) + (let ((pt (avy-with ace-link-eww + (avy-process + (mapcar #'cdr (ace-link--eww-collect)) + (avy--style-fn avy-style))))) + + (when (number-or-marker-p pt) + (goto-char pt) + (let ((url (get-text-property (point) 'shr-url))) + (if (start-process "mpv" "mpv-output" "mpv" url) + (message (concat"mpv started => " url)) + (message "mpv failed, maybe this isn't a link?")))))) +(general-def 'normal eww-mode-map + "gv" 'chris/eww-mpv) #+end_src ** Completion @@ -1853,7 +1869,10 @@ Ace link provides an avy like search for links. Upon using the keybindings prese ("\\*Bongo-Elfeed Queue\\*" (display-buffer-in-side-window) (side . bottom) - (window-height . 0.25)))) + (window-height . 0.25)) + ("\\*Async Shell Command\\*" + (display-buffer-no-window)) + )) #+end_src Since I like to make my window manager handle a lot of the window management, I will create a helper function for closing windows. @@ -2498,9 +2517,9 @@ Let's add org-msg to write emails in org-mode '(cfw:face-saturday ((t :weight bold))) '(cfw:face-holiday ((t :weight bold))) ;; '(cfw:face-grid ((t :foreground "DarkGrey"))) - ;; '(cfw:face-default-content ((t :foreground "#bfebbf"))) + '(cfw:face-default-content ((t :height 0.7))) ;; '(cfw:face-periods ((t :foreground "cyan"))) - '(cfw:face-day-title ((t :background nil))) + '(cfw:face-day-title ((t (:background nil)))) '(cfw:face-default-day ((t :weight bold :inherit cfw:face-day-title))) '(cfw:face-annotation ((t :inherit cfw:face-day-title))) '(cfw:face-disable ((t :inherit cfw:face-day-title))) @@ -2510,6 +2529,14 @@ Let's add org-msg to write emails in org-mode '(cfw:face-toolbar ((t :foreground "Steelblue4" :background "Steelblue4"))) '(cfw:face-toolbar-button-off ((t :weight bold))) '(cfw:face-toolbar-button-on ((t :weight bold)))) + (setq cfw:fchar-junction ?╋ + cfw:fchar-vertical-line ?┃ + cfw:fchar-horizontal-line ?━ + cfw:fchar-left-junction ?┣ + cfw:fchar-right-junction ?┫ + cfw:fchar-top-junction ?┯ + cfw:fchar-top-left-corner ?┏ + cfw:fchar-top-right-corner ?┓) :general (chris/leader-keys :states 'normal diff --git a/init.el b/init.el index 79ed99c6..e246fcc0 100644 --- a/init.el +++ b/init.el @@ -938,7 +938,23 @@ If on a: (add-hook 'imenu-after-jump-hook #'pulsar-recenter-top) (add-hook 'imenu-after-jump-hook #'pulsar-reveal-entry)) +(defun chris/eww-mpv () + "Launch the url in mpv" + (interactive) + (let ((pt (avy-with ace-link-eww + (avy-process + (mapcar #'cdr (ace-link--eww-collect)) + (avy--style-fn avy-style))))) + + (when (number-or-marker-p pt) + (goto-char pt) + (let ((url (get-text-property (point) 'shr-url))) + (if (start-process "mpv" "mpv-output" "mpv" url) + (message (concat"mpv started => " url)) + (message "mpv failed, maybe this isn't a link?")))))) +(general-def 'normal eww-mode-map + "gv" 'chris/eww-mpv) (use-package vertico :init @@ -1313,7 +1329,10 @@ targets." ("\\*Bongo-Elfeed Queue\\*" (display-buffer-in-side-window) (side . bottom) - (window-height . 0.25)))) + (window-height . 0.25)) + ("\\*Async Shell Command\\*" + (display-buffer-no-window)) + )) (defun chris/kill-buffer-frame () "Kills the active buffer and frame" @@ -1731,9 +1750,9 @@ targets." '(cfw:face-saturday ((t :weight bold))) '(cfw:face-holiday ((t :weight bold))) ;; '(cfw:face-grid ((t :foreground "DarkGrey"))) - ;; '(cfw:face-default-content ((t :foreground "#bfebbf"))) + '(cfw:face-default-content ((t :height 0.7))) ;; '(cfw:face-periods ((t :foreground "cyan"))) - '(cfw:face-day-title ((t :background nil))) + '(cfw:face-day-title ((t (:background nil)))) '(cfw:face-default-day ((t :weight bold :inherit cfw:face-day-title))) '(cfw:face-annotation ((t :inherit cfw:face-day-title))) '(cfw:face-disable ((t :inherit cfw:face-day-title))) @@ -1743,6 +1762,14 @@ targets." '(cfw:face-toolbar ((t :foreground "Steelblue4" :background "Steelblue4"))) '(cfw:face-toolbar-button-off ((t :weight bold))) '(cfw:face-toolbar-button-on ((t :weight bold)))) + (setq cfw:fchar-junction ?╋ + cfw:fchar-vertical-line ?┃ + cfw:fchar-horizontal-line ?━ + cfw:fchar-left-junction ?┣ + cfw:fchar-right-junction ?┫ + cfw:fchar-top-junction ?┯ + cfw:fchar-top-left-corner ?┏ + cfw:fchar-top-right-corner ?┓) :general (chris/leader-keys :states 'normal