diff options
author | Thanos Apollo <[email protected]> | 2024-05-13 08:42:44 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-05-13 08:42:44 +0300 |
commit | 2e74d58a4f675b5301e69cae105503198d7ff846 (patch) | |
tree | e92cca5c6406898e9ac1eae08653d894c24e3acf /.emacs.d/modules/thanos-pass.el | |
parent | b6d164b032b255767b04a73e8ac0e04b61991048 (diff) | |
parent | 5d6840de02f01c017cc1ce99238d6962331087da (diff) |
Merge branch 'guix-config'
Diffstat (limited to '.emacs.d/modules/thanos-pass.el')
-rw-r--r-- | .emacs.d/modules/thanos-pass.el | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/.emacs.d/modules/thanos-pass.el b/.emacs.d/modules/thanos-pass.el deleted file mode 100644 index 0e996f6..0000000 --- a/.emacs.d/modules/thanos-pass.el +++ /dev/null @@ -1,91 +0,0 @@ -;;; thanos-pass.el --- Pass configuration -*- lexical-binding: t; -*- - -;; Copyright (C) 2023 Thanos Apollo - -;; Author: Thanos Apollo <[email protected]> - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see <https://www.gnu.org/licenses/>. - -;;; Commentary: -;; ╭━━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╭━━━╮ -;; ┃╭╮╭╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃╱╱╱╱╱┃┃┃┃╱╱╱╱╱╱╱╱┃╭━━╯ -;; ╰╯┃┃╰┫╰━┳━━┳━╮╭━━┳━━╮┃┃╱┃┣━━┳━━┫┃┃┃╭━━╮╱╱╱╱┃╰━━┳╮╭┳━━┳━━┳━━╮ -;; ╱╱┃┃╱┃╭╮┃╭╮┃╭╮┫╭╮┃━━┫┃╰━╯┃╭╮┃╭╮┃┃┃┃┃╭╮┃╭━━╮┃╭━━┫╰╯┃╭╮┃╭━┫━━┫ -;; ╱╱┃┃╱┃┃┃┃╭╮┃┃┃┃╰╯┣━━┃┃╭━╮┃╰╯┃╰╯┃╰┫╰┫╰╯┃╰━━╯┃╰━━┫┃┃┃╭╮┃╰━╋━━┃ -;; ╱╱╰╯╱╰╯╰┻╯╰┻╯╰┻━━┻━━╯╰╯╱╰┫╭━┻━━┻━┻━┻━━╯╱╱╱╱╰━━━┻┻┻┻╯╰┻━━┻━━╯ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ -;;; Code: - -(require 'password-store) - -(setf password-store-password-length (+ 20 (random 20))) - -(defun thanos/pass-launcher () - "Launch Emacs as a front-end for pass." - (interactive) - (unwind-protect - (with-selected-frame - (make-frame '((name . "thanos/pass-launcher") - (fullscreen . 0) - (undecorated . t) - (minibuffer . only) - (width . 70) - (height . 15))) - (let* ((choice (completing-read "Choose an action: " - '("AUTO" "COPY PASS" "COPY USERNAME" "EDIT" "GENERATE"))) - (action (pcase choice - ("AUTO" #'(lambda (entry) (let ((user (password-store-get-field entry "user")) (pass (password-store-get entry))) - (start-process-shell-command - "xdotool" nil - (format "sleep 0.3 && xdotool getactivewindow type '%s' && xdotool getactivewindow key Tab && xdotool getactivewindow type '%s'" - (if user user 'thanosapollo) pass))))) - ("COPY PASS" #'password-store-copy) - ("COPY USERNAME" #'(lambda (entry) (password-store-copy-field entry "user"))) - ("EDIT" #'password-store-edit) - ("GENERATE" #'password-store-generate)))) - (funcall action (completing-read "Search: " (password-store-list))) - (delete-frame))))) - -(defun smtp-get-pass () - "Get password for smtp." - (interactive) - (password-store-copy-field "fastmail.com/[email protected]" "smtp")) - -(define-prefix-command 'thanos/pass) -(global-set-key (kbd "C-c p") 'thanos/pass) -(define-key thanos/pass (kbd "i") 'password-store-insert) -(define-key thanos/pass (kbd "e") 'password-store-edit) -(define-key thanos/pass (kbd "g") 'password-store-generate) -(define-key thanos/pass (kbd "c") 'password-store-copy) -(define-key thanos/pass (kbd "s") 'smtp-get-pass) - -(defun thanos/app-launcher () - "Launch Emacs as an Application Launcher." - (interactive) - (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))) - (counsel-linux-app) - (delete-frame))))) - -(provide 'thanos-pass) -;;; thanos-pass.el ends here |