diff options
author | Thanos Apollo <[email protected]> | 2023-07-20 22:35:13 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-07-20 22:35:13 +0300 |
commit | e9b82d9f8ab139ea7455913b6b2cbcede3371232 (patch) | |
tree | 902efddcb2073b06600a078b7a47bc70eb25f878 /emacs.org | |
parent | e8cf189920dee83e7597291ed45fa2fdb24236a4 (diff) |
emacs: Add Pass Launcher
Diffstat (limited to 'emacs.org')
-rwxr-xr-x | emacs.org | 41 |
1 files changed, 36 insertions, 5 deletions
@@ -241,13 +241,44 @@ Fonts and basic appearance settings for each device (setq counsel-describe-variable-function #'helpful-variable) #+end_src * Pass -** Misc Functions +** Pass Launcher #+begin_src emacs-lisp - (defun smtp-get-pass () + (defun thanos/pass () (interactive) - "get password for smtp" - (insert - (password-store-get-field "fastmail.com/[email protected]" "smtp"))) + (let* ((entry (ivy-read "Search for: " (password-store-list)))) + (when entry + (condition-case err + (let* ((user (password-store-get-field entry "user")) + (pass (password-store-get entry))) + (start-process-shell-command + "xdotool" nil + (if user + (format "sleep 0.1 && xdotool getactivewindow type '%s' && xdotool getactivewindow key Tab && xdotool getactivewindow type '%s'" user pass) + (format "sleep 0.1 && xdotool getactivewindow type 'thanosapollo' && xdotool getactivewindow key Tab && xdotool getactivewindow type '%s'" pass)))))))) + + (defun thanos/edit-pass () + (interactive) + (let* ((entry (ivy-read "Search for: " (password-store-list)))) + (when entry + (password-store-edit entry)))) + + (defun thanos/pass-launcher () + (interactive) + (let* ((choice (completing-read "Choose an action: " '("GET" "EDIT"))) + (ivy-height 100)) + (with-selected-frame + (make-frame '((name . "thanos/emacs-launcher") + (minibuffer . only) + (fullscreen . 0) + (undecorated . t) + (internal-border-width . 10) + (width . 80) + (height . 11))) + (unwind-protect + (if (equal choice "get") + (thanos/pass) + (thanos/edit-pass)) + (delete-frame))))) #+end_src ** Keybindings #+begin_src emacs-lisp |