From da5922a476cebdbbf338f0192165dbbbcd3f7b6f Mon Sep 17 00:00:00 2001 From: bd Date: Sat, 6 Jan 2024 03:06:58 -0700 Subject: eww quality-of-life, handle videos --- .config/emacs/bd-default.el | 30 +++++++++++++++++++++++------- .config/emacs/bd-shells.el | 11 ++++------- 2 files changed, 27 insertions(+), 14 deletions(-) (limited to '.config') diff --git a/.config/emacs/bd-default.el b/.config/emacs/bd-default.el index e7c70d8..39cd231 100644 --- a/.config/emacs/bd-default.el +++ b/.config/emacs/bd-default.el @@ -32,16 +32,21 @@ (concat "/sudo:root@localhost:" buffer-file-name)))) -(defun rip-video () +(defun rip-video (url &rest _) + "Given a url, rip and play the video +with yt-dlp and mpv." + (message "Ludu %s" url) + (start-process-shell-command "rip-video" nil (concat "rip-video " url))) + +(defun parse-and-rip-video () "If region, open SEARCH with mpv in --full-screen. Else, -open URL at point." + open URL at point." (interactive) (let ((URL-OR-SEARCH (if (use-region-p) (buffer-substring (mark) (point)) (shr-url-at-point nil)))) - (message "Ludu %s" URL-OR-SEARCH) - (start-process-shell-command "rip-video" nil (concat "rip-video " URL-OR-SEARCH)))) + (rip-video URL))) ;;;; defaults @@ -107,7 +112,7 @@ open URL at point." :demand t :bind (("C-z C-n" . newsticker-show-news) :map newsticker-treeview-item-mode-map - ("C-j" . rip-video)) + ("C-j" . parse-and-rip-video)) :custom (newsticker-url-list-defaults nil) (newsticker-automatically-mark-items-as-old nil) @@ -130,7 +135,17 @@ open URL at point." (use-package eww :demand t :custom - (eww-auto-rename-buffer 'title)) + ;; default to eww + (browse-url-browser-function 'eww-browse-url) + (shr-use-fonts nil) + (shr-cookie-policy nil) + (shr-max-width 85) + (url-privacy-level '(email os emacs lastloc cookies)) + (eww-search-prefix "https://searx.be/search?q=") + (eww-auto-rename-buffer 'title) + (eww-use-browse-url (regexp-opt '("mailto:" "youtube.com" "youtu.be" "yewtu.be"))) + (browse-url-handlers + `((,(regexp-opt '("youtube.com" "youtu.be" "yewtu.be")) . rip-video)))) (use-package image-dired :bind (("C-c d" . dired-jump)) @@ -138,7 +153,8 @@ open URL at point." (dired-listing-switches "-alh") (dired-guess-shell-alist-user `((,(regexp-opt '(".mkv" ".mov" ".mp4" ".webm" ".m4v" ".wav" ".mp3" ".opus" ".ogv" ".flac")) "mpv &") - (,(regexp-opt '(".pdf")) "zathura &")))) + (,(regexp-opt '(".pdf")) "zathura &") + (,(regexp-opt '(".html")) "icecat &")))) (use-package erc :config diff --git a/.config/emacs/bd-shells.el b/.config/emacs/bd-shells.el index 4574cc6..4054e5d 100644 --- a/.config/emacs/bd-shells.el +++ b/.config/emacs/bd-shells.el @@ -21,23 +21,20 @@ status, and path." (concat "\n" (propertize (system-name) 'face `(:foreground "#edb54b")) - (when current-branch - (concat - (format " %s " (all-the-icons-octicon "git-branch")) - (propertize current-branch 'face `(:foreground "#98d1ce")))) + ;; (when current-branch + ;; (concat + ;; (format " %s " (all-the-icons-octicon "git-branch")) + ;; (propertize current-branch 'face `(:foreground "#98d1ce")))) (format " %s " (all-the-icons-fileicon "gn")) (propertize (bd/get-prompt-path) 'face `(:foreground "#33859d")) (propertize (format-time-string " %a, %R") 'face `(:foreground "#888ba5")) (propertize "\n> " 'face `(:foreground "#c33027"))))) (use-package eshell - :demand :bind (("C-z C-e" . 'eshell-open-buffer) :map eshell-mode-map ("C-q" . 'delete-window) ; mostly for side window ("" . completion-at-point)) - :config - ;; (eshell/addpath "~/Personal/scripts/") :custom (eshell-prompt-function 'bd/eshell-prompt) (eshell-prompt-regexp "^> ") -- cgit v1.2.3