mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
Add passEditPrompt to Xmonad.Prompt.Pass
This commit is contained in:
parent
6b8a8f9c8d
commit
ed32ccd080
@ -279,6 +279,8 @@
|
|||||||
|
|
||||||
- New function `passTypePrompt` which uses `xdotool` to type in a password
|
- New function `passTypePrompt` which uses `xdotool` to type in a password
|
||||||
from the store, bypassing the clipboard.
|
from the store, bypassing the clipboard.
|
||||||
|
- New function `passEditPrompt` for editing a password from the
|
||||||
|
store.
|
||||||
- Now handles password labels with spaces and special characters inside
|
- Now handles password labels with spaces and special characters inside
|
||||||
them.
|
them.
|
||||||
|
|
||||||
|
@ -8,23 +8,33 @@
|
|||||||
-- Stability : unstable
|
-- Stability : unstable
|
||||||
-- Portability : unportable
|
-- Portability : unportable
|
||||||
--
|
--
|
||||||
-- This module provides 4 <XMonad.Prompt> to ease password manipulation (generate, read, remove):
|
-- This module provides 5 <XMonad.Prompt>s to ease password
|
||||||
|
-- manipulation (generate, read, edit, remove):
|
||||||
--
|
--
|
||||||
-- - two to lookup passwords in the password-store; one of which copies to the
|
-- - two to lookup passwords in the password-store; one of which
|
||||||
-- clipboard, and the other uses @xdotool@ to type the password directly.
|
-- copies to the clipboard, and the other uses @xdotool@ to type the
|
||||||
|
-- password directly.
|
||||||
--
|
--
|
||||||
-- - one to generate a password for a given password label that the user inputs.
|
-- - one to generate a password for a given password label that the
|
||||||
|
-- user inputs.
|
||||||
--
|
--
|
||||||
-- - one to delete a stored password for a given password label that the user inputs.
|
-- - one to edit a password for a given password label that the user
|
||||||
|
-- inputs.
|
||||||
--
|
--
|
||||||
-- All those prompts benefit from the completion system provided by the module <XMonad.Prompt>.
|
-- - one to delete a stored password for a given password label that
|
||||||
|
-- the user inputs.
|
||||||
--
|
--
|
||||||
-- The password store is setup through an environment variable PASSWORD_STORE_DIR,
|
-- All those prompts benefit from the completion system provided by
|
||||||
-- or @$HOME\/.password-store@ if it is unset.
|
-- the module <XMonad.Prompt>.
|
||||||
|
--
|
||||||
|
-- The password store is setup through an environment variable
|
||||||
|
-- PASSWORD_STORE_DIR, or @$HOME\/.password-store@ if it is unset.
|
||||||
|
-- The editor is determined from the environment variable EDITOR.
|
||||||
--
|
--
|
||||||
-- Source:
|
-- Source:
|
||||||
--
|
--
|
||||||
-- - The password store implementation is <http://git.zx2c4.com/password-store the password-store cli>.
|
-- - The <https://www.passwordstore.org/ password store>
|
||||||
|
-- implementation is <http://git.zx2c4.com/password-store here>.
|
||||||
--
|
--
|
||||||
-- - Inspired by <http://babushk.in/posts/combining-xmonad-and-pass.html>
|
-- - Inspired by <http://babushk.in/posts/combining-xmonad-and-pass.html>
|
||||||
--
|
--
|
||||||
@ -36,6 +46,7 @@ module XMonad.Prompt.Pass (
|
|||||||
passPrompt
|
passPrompt
|
||||||
, passGeneratePrompt
|
, passGeneratePrompt
|
||||||
, passRemovePrompt
|
, passRemovePrompt
|
||||||
|
, passEditPrompt
|
||||||
, passTypePrompt
|
, passTypePrompt
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@ -58,10 +69,12 @@ import XMonad.Util.Run (runProcessWithInput)
|
|||||||
--
|
--
|
||||||
-- > import XMonad.Prompt.Pass
|
-- > import XMonad.Prompt.Pass
|
||||||
--
|
--
|
||||||
-- Then add a keybinding for 'passPrompt', 'passGeneratePrompt' or 'passRemovePrompt':
|
-- Then add a keybinding for 'passPrompt', 'passGeneratePrompt',
|
||||||
|
-- 'passRemovePrompt', 'passEditPrompt' or 'passTypePrompt':
|
||||||
--
|
--
|
||||||
-- > , ((modMask , xK_p) , passPrompt xpconfig)
|
-- > , ((modMask , xK_p) , passPrompt xpconfig)
|
||||||
-- > , ((modMask .|. controlMask, xK_p) , passGeneratePrompt xpconfig)
|
-- > , ((modMask .|. controlMask, xK_p) , passGeneratePrompt xpconfig)
|
||||||
|
-- > , ((modMask .|. shiftMask, xK_p) , passEditPrompt xpconfig)
|
||||||
-- > , ((modMask .|. controlMask .|. shiftMask, xK_p), passRemovePrompt xpconfig)
|
-- > , ((modMask .|. controlMask .|. shiftMask, xK_p), passRemovePrompt xpconfig)
|
||||||
--
|
--
|
||||||
-- For detailed instructions on:
|
-- For detailed instructions on:
|
||||||
@ -131,6 +144,12 @@ passRemovePrompt = mkPassPrompt "Remove password" removePassword
|
|||||||
passTypePrompt :: XPConfig -> X ()
|
passTypePrompt :: XPConfig -> X ()
|
||||||
passTypePrompt = mkPassPrompt "Type password" typePassword
|
passTypePrompt = mkPassPrompt "Type password" typePassword
|
||||||
|
|
||||||
|
-- | A prompt to edit a given entry.
|
||||||
|
-- This doesn't touch the clipboard.
|
||||||
|
--
|
||||||
|
passEditPrompt :: XPConfig -> X ()
|
||||||
|
passEditPrompt = mkPassPrompt "Edit password" editPassword
|
||||||
|
|
||||||
-- | Select a password.
|
-- | Select a password.
|
||||||
--
|
--
|
||||||
selectPassword :: String -> X ()
|
selectPassword :: String -> X ()
|
||||||
@ -147,6 +166,11 @@ generatePassword passLabel = spawn $ "pass generate --force \"" ++ escapeQuote p
|
|||||||
removePassword :: String -> X ()
|
removePassword :: String -> X ()
|
||||||
removePassword passLabel = spawn $ "pass rm --force \"" ++ escapeQuote passLabel ++ "\""
|
removePassword passLabel = spawn $ "pass rm --force \"" ++ escapeQuote passLabel ++ "\""
|
||||||
|
|
||||||
|
-- | Edit a password stored for a given entry.
|
||||||
|
--
|
||||||
|
editPassword :: String -> X ()
|
||||||
|
editPassword passLabel = spawn $ "pass edit \"" ++ escapeQuote passLabel ++ "\""
|
||||||
|
|
||||||
-- | Type a password stored for a given entry using xdotool.
|
-- | Type a password stored for a given entry using xdotool.
|
||||||
--
|
--
|
||||||
typePassword :: String -> X ()
|
typePassword :: String -> X ()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user