summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xemacs.org41
1 files changed, 36 insertions, 5 deletions
diff --git a/emacs.org b/emacs.org
index c888777..65f9751 100755
--- a/emacs.org
+++ b/emacs.org
@@ -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