Skip to content
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

How to get the username? #28

Closed
wolph opened this issue Apr 5, 2022 · 4 comments
Closed

How to get the username? #28

wolph opened this issue Apr 5, 2022 · 4 comments

Comments

@wolph
Copy link

wolph commented Apr 5, 2022

Not sure if this is possible somehow, but I often need both the username and the password. It would be nice if shift+enter instead of enter (or something) would copy the username instead :)

@nmajin
Copy link

nmajin commented Apr 5, 2022

I believe this is possible with https://www.alfredapp.com/universal-actions/. I also have a need for this and would like that functionality. I don't know if we can do keyboard shortcuts, but I know we can at least scroll down to the entry and activate the action we want (i.e. Get username, Get password, Get TOTP, etc.).

There is an example built-into Alfred that actually does use a shortcut though, so maybe it is possible with a shortcut. I was messing around with this but was having issues passing the variables through....would need to do some logic.

@BanjoCam
Copy link

BanjoCam commented Jul 4, 2022

I am a relative newcomer to Alfred but I was able to achieve copy username or password with modifier key by editing the workflow. It's pretty quick to achieve. Go to the workflow edit screen, and double click the dot between the first and second nodes:

image

Add a modifier key (I like command, but you could do shift as you wanted) and change the subtext to be useful:

image

Duplicate the "run script" and "copy to clipboard" nodes (right click copy and then right click paste) and drag paths in between them. They should look like this:

SCR-20220704-jx6

Now, double click the bin/bash script node for the pathway with the modifier key. You will see the main bash script that extracts the password. In the 'get_keys' function, you will see two separate spots that start with 'show -q -a Password'. Change the word Password to Username in both of these spots. This section should look like this now:

function get_keys { if [ ! -z "${keePassKeyFile}" ]; then security find-generic-password -a $(id -un) -c 'kpas' -C 'kpas' -s "${keychainItem}" -w "${keychain}" |\ keepassxc-cli show --key-file "${keePassKeyFile}" -q -a Username "${database}" "$1" else security find-generic-password -a $(id -un) -c 'kpas' -C 'kpas' -s "${keychainItem}" -w "${keychain}" |\ keepassxc-cli show -q -a Username "${database}" "$1" fi }

Hit save. Now, try the workflow again. Once you've found the entry you want the username for, hold the modifier and you should see the text at the bottom change to whatever you set the subtext to. When you hit enter while holding the modifier key, it will copy the username instead of the password.

Hope this helps!

@nmajin
Copy link

nmajin commented Jul 8, 2022

This is cool to see a solution for this. I was thinking something similar with the Universal Actions, although I just didn't get anything implemented for it but here is an example with the Case Convert Universal Actions:
Screen Shot 2022-07-07 at 11 32 46 PM
And then when you hit the right arrow key you can take a particular action:
Screen Shot 2022-07-07 at 11 33 00 PM

@Angoll
Copy link
Owner

Angoll commented Nov 12, 2022

Thanks @BanjoCam I added the feature in the v2.6 workflow.

@Angoll Angoll closed this as completed Nov 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants