Skip to content
This repository has been archived by the owner on Jun 29, 2019. It is now read-only.

Support aliases for programs #239

Open
markwoon opened this issue May 23, 2017 · 5 comments
Open

Support aliases for programs #239

markwoon opened this issue May 23, 2017 · 5 comments

Comments

@markwoon
Copy link

markwoon commented May 23, 2017

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.

@cpriest
Copy link
Member

cpriest commented May 23, 2017

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.

@cpriest
Copy link
Member

cpriest commented May 23, 2017

We welcome Pull Requests as well.

@lawgsy
Copy link

lawgsy commented Jul 11, 2017

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 with some-shortcut.lnk having the target ping google.com will result in #test pinging google indefinitely
  • 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

The above two examples use the file:/// protocol. the three slashes are all necessary

@lawgsy
Copy link

lawgsy commented Jul 11, 2017

@bcampardou
Copy link

@lawgsy Nice job. Could we get it working with arguments ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants