mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -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
|
pass-otp (https://github.com/tadfisher/pass-otp) has been setup in the running
|
||||||
machine.
|
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
|
Made password prompts traverse symlinks when gathering password names for
|
||||||
autocomplete.
|
autocomplete.
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ module XMonad.Prompt.Pass (
|
|||||||
passPrompt
|
passPrompt
|
||||||
, passOTPPrompt
|
, passOTPPrompt
|
||||||
, passGeneratePrompt
|
, passGeneratePrompt
|
||||||
|
, passGenerateAndCopyPrompt
|
||||||
, passRemovePrompt
|
, passRemovePrompt
|
||||||
, passEditPrompt
|
, passEditPrompt
|
||||||
, passTypePrompt
|
, passTypePrompt
|
||||||
@ -138,6 +139,13 @@ passOTPPrompt = mkPassPrompt "Select OTP" selectOTP
|
|||||||
passGeneratePrompt :: XPConfig -> X ()
|
passGeneratePrompt :: XPConfig -> X ()
|
||||||
passGeneratePrompt = mkPassPrompt "Generate password" generatePassword
|
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.
|
-- | A prompt to remove a password for a given entry.
|
||||||
-- (Beware that no confirmation is asked)
|
-- (Beware that no confirmation is asked)
|
||||||
--
|
--
|
||||||
@ -172,6 +180,13 @@ selectOTP passLabel = spawn $ "pass otp --clip \"" ++ escapeQuote passLabel ++ "
|
|||||||
generatePassword :: String -> X ()
|
generatePassword :: String -> X ()
|
||||||
generatePassword passLabel = spawn $ "pass generate --force \"" ++ escapeQuote passLabel ++ "\" 30"
|
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.
|
-- | Remove a password stored for a given entry.
|
||||||
--
|
--
|
||||||
removePassword :: String -> X ()
|
removePassword :: String -> X ()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user