hainproject / hain

An 'alt+space' launcher for Windows, built with Electron
http://hainproject.github.io/hain/
MIT License
3.2k stars 155 forks source link

Ability to copy a text snippet via a keyword, into clipboard #248

Open princelundgren opened 7 years ago

princelundgren commented 7 years ago

Thanks for the hard work, its a great program, probably the best Windows equivalent to Alfred in MacOS!

Would it be possible to get a snippet feature, where I can program a keyword and a text snippet linked to it, so when I write the keyword in the Hain search and press enter, it will copy the text snippet into the clipboard?

It was probably the most used feature on Alfred when I used MacOS.

It can for instance be used to quickly write your email address. So if I programmed the keyword "email" with my email address connected to the keyword, all I have to do when I want to have my email written somewhere is to just type "email" in Hain, press enter and then my email address will be in the clipboard, ready to paste into anything.

You can also use this to super-quickly get other stuff to the clipboard like your phone number, ASCI emojis, ready programming statements(like having if-else, for-loops, while-loops etc ready to paste) or the ending portion you write on the end of every Email.

It's such an amazing feature to have.

Thanks!

appetizermonster commented 7 years ago

Thanks for the great idea, I think it's possible and simple to make a hain-plugin with this idea. I'll try to make it. but it will takes time.

notatestuser commented 7 years ago

Have you tried this one? It seems to do what you need.

https://github.com/k-meissonnier/hain-plugin-snippet

Take a look at the source as the header in the readme appears to be wrong.

princelundgren commented 7 years ago

@notatestuser thanks for showing me this I didn't know there was somebody already trying this!

while it doesn't allow you to use keywords(like writing "phone" to copy your phone number), it does allow you to get your snippets by writing the first letters/numbers of the snippet(like 054-3.... for your phone). This does however makes it difficult to use some other types of snippets like ASCI-emojis or programming-snippets, where you have to write part of the signs/code instead of the actual name of the snippet(like making a keyword for "shrug" will copy the ASCI-emoji of a shrug, or writing "for-loop" will copy the "comments" and code for a for-loop).

I guess the plugin can be used to make my email and phone number easy to access meanwhile!

Now that I think about it however... Its a lot more comfortable just writing "phone" to copy your phone number than having to write the first digits of your number to get a copy of it(together with having to scroll down the list in the plugin because the 1st option is always the "Add this snippet"-option, kinda feels like my hands has to go all over the keyboard in order to do this process), it kinda feels like I might as well write the whole number anyway.

Sorry if this came out as a bit bashing to the plugin by meissonnier, its a great plugin which does what it says it should, however the lack of keyword function makes it difficult/impossible to use in the use-cases I've brought up as examples.

I'm not saying this plugin is necessary, hain is still a great program, however if this type of easy-to-use "keyword"-snippet plugin was to be made it would make me super happy! :D

cpriest commented 7 years ago

I believe you can register a hotkey that will prepopulate the input field.

Another possibility might be to prefix each snippet with your keyword.