-
-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dmenu support #47
Conversation
action/completion.go
Outdated
[[ -n $password ]] || exit | ||
|
||
if [[ $typeit -eq 0 ]]; then | ||
pass show -c "$password" 2>/dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does gopass
install as pass
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, that's by mistake and worked for me because I alias pass=gopass
... 😄 Thankfully still WIP and will be update, thanks for pointing out anyway! 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might make more sense overall to switch on os.Args[0]
as gopassmenu
or passmenu
and just run xdotool
from within the program
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.Args[0]
👍
action/list.go
Outdated
filter := c.Args().First() | ||
|
||
// Don't show a tree only new lines | ||
if raw { | ||
//TODO(metalmatze): Support filtering |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do:
list, err := s.Store.List()
for _, v := range list {
if smth(v) {
fmt.Println(v)
}
}
1ec7945
to
0a14cf0
Compare
Also it trims the first line's spaces
4713d4f
to
389a245
Compare
I reworked the PR and got completely rid of the bash script. We simply don't need it. Tested on my system. 😊 |
Called dmenu from within the binary made this one obsolete, dropping it
return s.copyToClipboard(name, content) | ||
} | ||
|
||
// dmenu runs it with the provided strings and returns the selected string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me (i.e. a person unfamiliar with dmenu) this comment is not very helpful.
What is dmenu?
Why does it need/how does it use completion?
Why do we need to run dmenu in here?
} | ||
|
||
if typeit { | ||
return exec.Command("xdotool", "type", "--clearmodifiers", string(content)).Run() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is xdotool
and why is it called here? What is typeit
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So xdotool
is a fake keyboard/mouse input, window management, and more. It is used to type the secret into the focused element on your screen. This can be a terminal, Slack Desktop App. Everything that has a keyboard input. It types the secret's chars into that field one after another.
@@ -20,36 +19,34 @@ func (s *Action) Show(c *cli.Context) error { | |||
return s.List(c) | |||
} | |||
|
|||
if c.Bool("clip") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not related to dmenu. Please remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a first sight, but clip and dmenu use the clipboard in the background. We only want to copy the first line of the secret into the clipboard with gopass show -c
and also with gopass completion dmenu
. So instead of doing the first line extraction inside the copyToClipboard
func is moved it to the store with a func First(name string)
that returns only the first line of the secret.
@@ -303,6 +304,21 @@ func (r *RootStore) Get(name string) ([]byte, error) { | |||
return store.Get(strings.TrimPrefix(name, store.alias)) | |||
} | |||
|
|||
// First returns the first line of the plaintext of a single key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to dmenu. Please remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the other comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Support gopass list --raw that just prints lines * Add gopass completion dmenu command * Create func First for RootStore that only returns first line of content - Also it trims the first line's spaces * Implement dmenu support without bash scripts by calling from within * Add a section about dmenu support to the README * Drop obsolete gopass list --raw support - Called dmenu from within the binary made this one obsolete, dropping it
Update api.md
Closes #43
The passmenu works but doesn't support mounts.
This add the script into the binary, just like auto completion for bash & zsh.
Some parts are still WIP and are probably going to change.
Usage:
eval "$(pass completion dmenu)"
What do you think @notandy & @fortytw2?