diff options
Diffstat (limited to '.config/emacs/modules/bd--browse.el')
-rw-r--r-- | .config/emacs/modules/bd--browse.el | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/.config/emacs/modules/bd--browse.el b/.config/emacs/modules/bd--browse.el index 22bbb6c..c5e409f 100644 --- a/.config/emacs/modules/bd--browse.el +++ b/.config/emacs/modules/bd--browse.el @@ -33,7 +33,7 @@ icecat, or eww." :type 'dummy :action (lambda (_) (browse-url (concat ,url (selector-input)) ,pref)))) -(defun rip (url) +(defun rip-video (url) "Play URL (or search string) in mpv." (message "Ludu %s" url) (start-process "rip" nil @@ -42,12 +42,22 @@ icecat, or eww." "ytdl://" "ytdl://ytsearch:") url))) -(defun bd/selector-rip () +(defun rip-html (url) + "Open an HTML document in an emacs org buffer." + (with-current-buffer-window url + '((display-buffer-same-window)) + nil + (princ + (shell-command-to-string + (concat "curl --silent " url " | pandoc --from=html --to=org --standalone"))) + (org-mode))) + +(defun bd/selector-rip-video () "Selector source for streaming a video off of youtube." (selector-candidate-create "Search Immediate" :type 'dummy - :action (lambda (_) (rip (selector-input))))) + :action (lambda (_) (rip-video (selector-input))))) (defun bd/selector-search () "Selector source for all search engines." @@ -60,7 +70,7 @@ icecat, or eww." (bd/search-candidate "Urban Dictionary" "https://www.urbandictionary.com/define.php?term=" 0) (bd/search-candidate "Archwiki" "https://wiki.archlinux.org/index.php?title=Special%3ASearch&search=" 0) - (bd/selector-rip) + (bd/selector-rip-video) (bd/search-candidate "Web" "" 1)))) (defun bd/browse-dispatcher () @@ -73,7 +83,7 @@ icecat, or eww." (setopt browse-url-handlers `((,(regexp-opt '("youtube.com" "youtu.be" "vid.puffyan.us" "deezer.page" "deezer.com")) . - (lambda (url &rest _) (rip url)))) + (lambda (url &rest _) (rip-video url)))) url-privacy-level '(email os emacs lastloc cookies)) (use-package elpher @@ -103,7 +113,8 @@ icecat, or eww." :defer 1 :bind (:map eww-mode-map - ("i" . eww-toggle-images)) + ("i" . eww-toggle-images) + ("o" . (lambda () (interactive) (rip-html (eww-current-url))))) :config (setopt eww-search-prefix "https://searx.operationnull.com/searxng/search?q=" eww-auto-rename-buffer 'title |