EXWM: Generalize helm-pass-for-page
parent
8acbe879ea
commit
4cc7f0fdfb
|
@ -113,9 +113,26 @@
|
|||
(domain (split-string url "\\.")))
|
||||
(concat (nth (- (length domain) 2) domain) "." (nth (1- (length domain)) domain))))
|
||||
((and (derived-mode-p 'exwm-mode) exwm-title)
|
||||
(let* ((url (car (last (split-string exwm-title " "))))
|
||||
(domain (split-string url "\\.")))
|
||||
(concat (nth (- (length domain) 2) domain) "." (nth (1- (length domain)) domain)))))
|
||||
(let* ((title exwm-title) url domain)
|
||||
(with-temp-buffer
|
||||
(insert title)
|
||||
(goto-char (point-min))
|
||||
(while (and (not (eobp))
|
||||
(not (thing-at-point-url-at-point)))
|
||||
(forward-word))
|
||||
(setq url (thing-at-point-url-at-point)))
|
||||
(if (not url)
|
||||
""
|
||||
(if (not (string-match (rx "//"
|
||||
(group
|
||||
(* (not (any "/")))
|
||||
"."
|
||||
(* (not (any "." "/"))))
|
||||
"/")
|
||||
url))
|
||||
""
|
||||
(setq domain (split-string (match-string 1 url) "\\."))
|
||||
(concat (nth (- (length domain) 2) domain) "." (nth (1- (length domain)) domain)))))))
|
||||
:buffer "*helm-pass*"))
|
||||
(exwm-input-set-key (kbd "s-p") #'ambrevar/helm-pass-for-page))
|
||||
|
||||
|
|
Loading…
Reference in New Issue