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