From d177a8f6ec05ce122651b2ec51ea518981919aa2 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Wed, 1 Oct 2025 09:19:29 -0400 Subject: [PATCH] [emacs] Add func for scrobbling in eww --- emacs/.config/doom/config.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/emacs/.config/doom/config.el b/emacs/.config/doom/config.el index 38a40a9..04bc582 100644 --- a/emacs/.config/doom/config.el +++ b/emacs/.config/doom/config.el @@ -402,3 +402,22 @@ Returns the ID string." ))) (add-hook 'org-after-todo-state-change-hook #'send-org-todo-to-endpoint-on-state-change) + +(defun life-scrobble-url () + "Open https://life.lab.unbl.ink/ with scrobble_url set to a URL. +- If in an `eww` buffer, use its current URL. +- Otherwise, use the clipboard/kill ring. +Always open the result in `eww`." + (interactive) + (let* ((url (cond + ;; In eww, grab current page URL + ((derived-mode-p 'eww-mode) + (plist-get eww-data :url)) + ;; Else clipboard + (t (current-kill 0 t)))) + (encoded (url-hexify-string url)) + (scrobble-url (concat "https://life.lab.unbl.ink/?scrobble_url=" encoded))) + (eww scrobble-url))) + +;; Bind globally to C-c l +(global-set-key (kbd "C-c l") #'life-scrobble-url)