xmonad-contrib-0.18.1: Community-maintained extensions for xmonad

Copyright | (c) 2014 Igor Babuschkin Antoine R. Dumont
License | BSD3-style (see LICENSE)
Maintainer | Antoine R. Dumont <eniotna.t@gmail.com>
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell2010

XMonad.Prompt.Pass

Contents

- Usage
- Retrieving passwords
- Editing passwords
- One-time-passwords

Description

A thin wrapper around the standard `pass(1)` UNIX utility.

This module provides several prompts to ease password manipulation (generate, read, edit, remove); all of them benefit from the completion system provided by XMonad.Prompt. Specifically, we provide

- various functions to lookup passwords in the password-store:

  + `passPrompt` copies the password directly to the clipboard.

  + `passOTPPrompt` copies a one-time-password to the clipboard (this uses pass-otp).

  + `passTypePrompt` and `passOTPTypePrompt` work like the above, respectively, but use `xdotool` to type out the password.

- `passGeneratePrompt` generates a password for a given password label that the user inputs.
- `passEditPrompt` edits a password for a given password label that the user inputs.
- `passRemovePrompt` deletes a stored password for a given password label that the user inputs.

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:

- The password store implementation is here.
- Inspired by http://babushk.in/posts/combining-xmonad-and-pass.html

Synopsis

- passPrompt :: XPConfig -> X ()
- passPrompt' :: String -> XPConfig -> X ()
- passTypePrompt :: XPConfig -> X ()
- passEditPrompt :: XPConfig -> X ()
- passEditPrompt' :: String -> XPConfig -> X ()
- passRemovePrompt :: XPConfig -> X ()
- passRemovePrompt' :: String -> XPConfig -> X ()
- passGeneratePrompt :: XPConfig -> X ()
- passGeneratePrompt' :: String -> XPConfig -> X ()
- passGenerateAndCopyPrompt :: XPConfig -> X ()
- passGenerateAndCopyPrompt' :: String -> XPConfig -> X ()
- passOTPPrompt :: XPConfig -> X ()
- passOTPTypePrompt :: XPConfig -> X ()

# Usage

You can use this module with the following in your `xmonad.hs`:

    import XMonad.Prompt.Pass

Then add a keybinding for `passPrompt`, `passGeneratePrompt`, `passRemovePrompt`, `passEditPrompt` or `passTypePrompt`:

      , ((modMask , xK_p)                              , passPrompt def)
      , ((modMask .|. controlMask, xK_p)               , passGeneratePrompt def)
      , ((modMask .|. shiftMask, xK_p)                 , passEditPrompt def)
      , ((modMask .|. controlMask  .|. shiftMask, xK_p), passRemovePrompt def)

You can also use the versions that let you specify a custom prompt:

      , ((modMask , xK_p)                              , passPrompt' "Ask 'pass' for" def)

Note that, by default, we do not use fuzzy matching in this module. To enable this feature, import the XMonad.Prompt.FuzzyMatch module and add the relevant functions to your prompt configuration:

    myXPConfig :: XPConfig
    myXPConfig = def
      { searchPredicate = fuzzyMatch
      , sorter          = fuzzySort
      }

    , ((modMask , xK_p), passPrompt myXPConfig)

For detailed instructions on:

- editing your key bindings, see the tutorial.
- how to setup the password store, see http://git.zx2c4.com/password-store/about/ or `man 1 pass`.

# Retrieving passwords

passPrompt :: XPConfig -> X () Source #

A prompt to retrieve a password from a given entry.

passPrompt' :: String -> XPConfig -> X () Source #

The same as `passPrompt` but with a user-specified prompt.

passTypePrompt :: XPConfig -> X () Source #

A prompt to type in a password for a given entry. This doesn't touch the clipboard.

# Editing passwords

passEditPrompt :: XPConfig -> X () Source #

A prompt to edit a given entry. This doesn't touch the clipboard.

passEditPrompt' :: String -> XPConfig -> X () Source #

The same as `passEditPrompt` but with a user-specified prompt.

passRemovePrompt :: XPConfig -> X () Source #

A prompt to remove a password for a given entry. (Beware that no confirmation is asked)

passRemovePrompt' :: String -> XPConfig -> X () Source #

The same as `passRemovePrompt` but with a user-specified prompt.

passGeneratePrompt :: XPConfig -> X () Source #

A prompt to generate a password for a given entry. This can be used to override an already stored entry. (Beware that no confirmation is asked)

passGeneratePrompt' :: String -> XPConfig -> X () Source #

The same as `passGeneratePrompt` but with a user-specified prompt.

passGenerateAndCopyPrompt :: XPConfig -> X () Source #

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' :: String -> XPConfig -> X () Source #

The same as `passGenerateAndCopyPrompt` but with a user-specified prompt.

# One-time-passwords

passOTPPrompt :: XPConfig -> X () Source #

A prompt to retrieve a OTP from a given entry. Note that you will need to use the pass-otp extension for this to work.

passOTPTypePrompt :: XPConfig -> X () Source #

A prompt to retrieve a OTP from a given entry. Note that you will need to use the pass-otp extension for this to work.