jsumners / alfred-emoji

Alfred workflow for searching and copying emoji
741 stars 32 forks source link

feature request: make keyboard shortcuts customizable #87

Open wuesten-fuchs opened 2 years ago

wuesten-fuchs commented 2 years ago

I personally only ever insert emojis directly and never need them in my clipboard.

And I couldn't figure out how to change the keyboard shortcuts but maybe that's super easy to do myself?

Stickyhavr commented 2 years ago

Agreed. 99% of the time I want the workflow to paste directly into the frontmost application. On those rare cases where I want it in the clipboard I would like to use cmd+return to copy to the clipboard instead.

It would be great if this were updated for Alfred 5 and then used the user configuration page to allow you to customize the default action when you push return.

I ended up changing it myself. I'm no coder, so please follow these steps at your own risk:

1) In the workflow, right-click on the top Copy to Clipboard (the one labeled "auto-paste") and configure object. Uncheck both of the checkmarks. Optionally, you could right-click again and edit the note to say "copy" 2) Right-click the bottom Copy to Clipboard action, configure object, and then check both boxes. Optionally, you could edit the note to say auto-paste. 3) Double click on the ⌘ and change the modifier subtext to "Copy {query} to the clipboard instead of pasting" (or whatever you want it to say). [alternatively, instead of these first three steps, you could just switch the outputs of the filters and the cmd key modifier, but I thought my way was easier and less confusing.]

4) Now double click on the script filter. In the bottom left of that window, there should be a folder icon. Click that to reveal the workflow in Finder. 5) It's probably a good idea to quit Alfred preferences while doing the next steps. It might not matter, but that's what I did just to be safe. 6) Open the emoji.js with Textedit. 7) Search for "let verb" 8) Change the verb to "paste" (or insert) and the preposition to "to frontmost app" (or whatever you want it to say). 9) Save and close emoji.js.

Now it should paste automatically by default. The only downside of doing it this hack way is that the alternate actions (control and option keys) also paste instead of going to the clipboard. But in my usage, I use that rarely and don't mind pasting it and then copying it again if I ever do need that functionality.

You might also want to disable the auto-update in case that would cause these hacks to break. Hope that works for you!

jsumners commented 2 years ago

https://github.com/jsumners/alfred-emoji/issues/42#issuecomment-719117275

I did not know Alfred 5 had been released. Reading the release notes, I don't see anything that makes it immediately obvious that keyboard shortcut remapping is possible, but it could be. If someone wants to research that, we welcome PRs.

Stickyhavr commented 2 years ago

I’m not sure either. I just know that I’ve installed a few Alfred 5 workflows and the configuration page has popped up on import and it seemed pretty powerful, but I don’t really know how it works under the hood. This help article was the closest thing I could find:

https://www.alfredapp.com/help/workflows/workflow-configuration/

vitorgalvao commented 1 year ago

It is indeed possible to customise the shortcuts, see for example the 1Password Workflow:

You use a popover like https://github.com/jsumners/alfred-emoji/pull/88 then the mod subtext and action is changed in the code. After #88 I can also make the search and snippet keyword be user-settable, then look into the custom shortcuts.