Support aliases for programs
markwoon opened this issue · comments
I'd like to get away to add synonyms for programs.
Example: I'd like to alias "Cisco AnyConnect Secure Mobility Client" to "vpn" so that I can type "vpn" and still find it.
That would be a nice feature, something I've though would be nice as well in the past. I think the next most important thing is to improve the matching algorithm.
In the meantime, a trick you can use is to add VPN to the beginning of the shortcut, such as: VPN - Cisco AnyConnect.
Typing VPN should find it straight away (after reload), but if not, selecting it from the list will give it further preference in the future.
We welcome Pull Requests as well.
I wrote a shortcut/linking plugin for URLs/system paths, using Electon's shell.openExternal
. It needs some extra work, but I may upload the source soon.
As with all plugins, this plugin requires the alias to be prefixed (in my case, #)
Linking #vpn
to the shortcut Cisco AnyConnect Secure Mobility Client
would be possible by rightclicking your cisco shortcut (not through Hain), copying the target out of the properties of the shortcut and then:
#add vpn "C:\Whatever\The\Path\To\Your\File\Is.exe"
resulting in a persistent command (stored in Hain's localstorage):
#vpn
To remove it again you'd use
#remove vpn
More examples:
#add google www.google.com
results in #google
opening google in your default browser
#add cmd cmd
results in #cmd
opening a command prompt (in the hain directory, though)
If this will currently suffice as a solution (even if it won't, to be honest), I'll share the code soon.
Worth to mention:
- I have only tested this on Windows
- Paths will not be checked to see if they exist
- Apart from URLs and file paths, this also works for single commands recognized by the commandline, but I have yet to figure out if parameters can be passed
- You can pass parameters by manually creating a shortcut, though this is far from nice:
#add test file:///C:\some-shortcut.lnk
withsome-shortcut.lnk
having the targetping google.com
will result in#test
pinging google indefinitely
- You can pass parameters by manually creating a shortcut, though this is far from nice:
- You can use file paths to non-executables (and they will be opened in a default application)
- Example:
#add test file:///C:\Users\Public\Desktop\test.txt
will make#test
open the textfile with your default text editor
- Example:
The above two examples use the file:/// protocol. the three slashes are all necessary
Current source:
https://github.com/lawgsy/hain-plugin-link