diff options
author | Thanos Apollo <[email protected]> | 2023-07-21 15:42:15 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-07-21 15:42:15 +0300 |
commit | bd1eba9fb4676956f270242e122f4f13715f999c (patch) | |
tree | e7a6185a19f6419777f9489bf33473e22d4e0bde | |
parent | d0fdcd8592189d5d2012237092e6f0b5e105c259 (diff) |
emacs: Update password & app launcher
-rwxr-xr-x | emacs.org | 79 |
1 files changed, 49 insertions, 30 deletions
@@ -243,7 +243,10 @@ Fonts and basic appearance settings for each device * Pass ** Pass Launcher #+begin_src emacs-lisp - (defun thanos/pass () + (require 'password-store) + + (defun thanos/get-pass () + "Get password entry." (interactive) (let* ((entry (ivy-read "Search for: " (password-store-list)))) (when entry @@ -253,32 +256,46 @@ Fonts and basic appearance settings for each device (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)))))))) + (format "sleep 0.3 && xdotool getactivewindow type '%s' && xdotool getactivewindow key Tab && xdotool getactivewindow type '%s'" user pass) + (format "sleep 0.3 && xdotool getactivewindow type 'thanosapollo' && xdotool getactivewindow key Tab && xdotool getactivewindow type '%s'" pass)))))))) (defun thanos/edit-pass () + "Edit password entry." (interactive) (let* ((entry (ivy-read "Search for: " (password-store-list)))) (when entry (password-store-edit entry)))) + (defun thanos/generate-pass () + "Generate password entry." + (interactive) + (let* ((entry (ivy-read "Generate: " (password-store-list)))) + (when entry + (password-store-generate entry (+ 20 (random 20))) + (password-store-edit entry) + (insert (format "\nuser:%s" username)) + (server-edit)))) + (defun thanos/pass-launcher () + "Launch Emacs as a front-end for pass." (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))))) + (let* ((ivy-height 100)) + (unwind-protect + (with-selected-frame + (make-frame '((name . "thanos/emacs-launcher") + (minibuffer . only) + (fullscreen . 0) + (undecorated . t) + (internal-border-width . 10) + (width . 80) + (height . 11))) + (let ((choice (completing-read "Choose an action: " '("GET" "EDIT" "GENERATE")))) + (let ((action (pcase choice + ("GET" #'thanos/get-pass) + ("EDIT" #'thanos/edit-pass) + ("GENERATE" #'thanos/generate-pass)))) + (funcall action)) + (delete-frame)))))) #+end_src ** Keybindings #+begin_src emacs-lisp @@ -1357,19 +1374,21 @@ Set aliases for emacs functions and ~PATH~ ** App launcher #+begin_src emacs-lisp - (when (equal (load-file "~/Developer/emacs-projects/emacs-app-launcher/app-launcher.el") t) + (when (or is-zeus + is-hermes) (defun thanos/app-launcher () + "Launch Emacs as an Application Launcher." (interactive) - (let ((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 + (let* ((ivy-height 100)) + (unwind-protect + (with-selected-frame + (make-frame '((name . "thanos/emacs-launcher") + (minibuffer . only) + (fullscreen . 0) + (undecorated . t) + (internal-border-width . 10) + (width . 80) + (height . 11))) (app-launcher-run-app) - (delete-frame)))))) + (delete-frame)))))) #+end_src |