Closed wolph closed 2 years ago
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.
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:
Add a modifier key (I like command, but you could do shift as you wanted) and change the subtext to be useful:
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:
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!
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:
And then when you hit the right arrow key you can take a particular action:
Thanks @BanjoCam I added the feature in the v2.6 workflow.
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 :)