mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
Merge pull request #309 from ryantrinkle/pass-generate-and-copy
Add XMonad.Prompt.Pass.passGenerateAndCopy
This commit is contained in:
commit
65e7153874
@ -56,6 +56,10 @@
|
||||
pass-otp (https://github.com/tadfisher/pass-otp) has been setup in the running
|
||||
machine.
|
||||
|
||||
Added 'passGenerateAndCopyPrompt', which both generates a new password and
|
||||
copies it to the clipboard. These two actions are commonly desirable to
|
||||
take together, e.g. when establishing a new account.
|
||||
|
||||
Made password prompts traverse symlinks when gathering password names for
|
||||
autocomplete.
|
||||
|
||||
|
@ -46,6 +46,7 @@ module XMonad.Prompt.Pass (
|
||||
passPrompt
|
||||
, passOTPPrompt
|
||||
, passGeneratePrompt
|
||||
, passGenerateAndCopyPrompt
|
||||
, passRemovePrompt
|
||||
, passEditPrompt
|
||||
, passTypePrompt
|
||||
@ -138,6 +139,13 @@ passOTPPrompt = mkPassPrompt "Select OTP" selectOTP
|
||||
passGeneratePrompt :: XPConfig -> X ()
|
||||
passGeneratePrompt = mkPassPrompt "Generate password" generatePassword
|
||||
|
||||
-- | A prompt to generate a password for a given entry and immediately copy it
|
||||
-- to the clipboard. This can be used to override an already stored entry.
|
||||
-- (Beware that no confirmation is asked)
|
||||
--
|
||||
passGenerateAndCopyPrompt :: XPConfig -> X ()
|
||||
passGenerateAndCopyPrompt = mkPassPrompt "Generate and copy password" generateAndCopyPassword
|
||||
|
||||
-- | A prompt to remove a password for a given entry.
|
||||
-- (Beware that no confirmation is asked)
|
||||
--
|
||||
@ -172,6 +180,13 @@ selectOTP passLabel = spawn $ "pass otp --clip \"" ++ escapeQuote passLabel ++ "
|
||||
generatePassword :: String -> X ()
|
||||
generatePassword passLabel = spawn $ "pass generate --force \"" ++ escapeQuote passLabel ++ "\" 30"
|
||||
|
||||
-- | Generate a 30 characters password for a given entry.
|
||||
-- If the entry already exists, it is updated with a new password.
|
||||
-- After generating the password, it is copied to the clipboard.
|
||||
--
|
||||
generateAndCopyPassword :: String -> X ()
|
||||
generateAndCopyPassword passLabel = spawn $ "pass generate --force -c \"" ++ escapeQuote passLabel ++ "\" 30"
|
||||
|
||||
-- | Remove a password stored for a given entry.
|
||||
--
|
||||
removePassword :: String -> X ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user