[emacs] Add func for scrobbling in eww

This commit is contained in:
2025-10-01 09:19:29 -04:00
parent 9d6b6bf02b
commit d177a8f6ec

View File

@ -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)