EXWM: Move ambrevar/helm-pass-for-page upstream
parent
fcce215ec8
commit
d7e7572bbf
|
@ -112,40 +112,7 @@
|
|||
(exwm-input-set-key (kbd "s-E") #'helm-eww-switch-other-window))
|
||||
|
||||
(when (fboundp 'helm-pass)
|
||||
;; REVIEW: Shared upstream: https://gitlab.com/jabranham/helm-pass/issues/13.
|
||||
(defun ambrevar/helm-pass-for-page ()
|
||||
"Default prompt to current exwm-title"
|
||||
(interactive)
|
||||
(require 'helm-pass)
|
||||
(helm :sources 'helm-pass-source-pass
|
||||
:input (cond
|
||||
((derived-mode-p 'eww-mode)
|
||||
(let* ((url (replace-regexp-in-string ".*//\\([^/]*\\).*" "\\1" (eww-current-url)))
|
||||
(domain (split-string url "\\.")))
|
||||
(concat (nth (- (length domain) 2) domain) "." (nth (1- (length domain)) domain))))
|
||||
((and (derived-mode-p 'exwm-mode) exwm-title)
|
||||
(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))
|
||||
(exwm-input-set-key (kbd "s-p") #'helm-pass))
|
||||
|
||||
;;; External application shortcuts.
|
||||
(defun ambrevar/exwm-start (command)
|
||||
|
|
Loading…
Reference in New Issue