albertlauncher / albert

A fast and flexible keyboard launcher
https://albertlauncher.github.io
Other
7.22k stars 303 forks source link

provide shortcuts for scripts that are in path and are executable #512

Closed arthurzenika closed 7 years ago

arthurzenika commented 7 years ago

I have a bunch of custom scripts in $HOME/bin (that is in my bash path) which I use a lot. But I also use a some software that does not have Desktop shortcuts as understood by gnome and other environments. It would be nice for albert to pick up on those, or at least make it configurable.

ubuntu

awesome

zesty version

v0.12.0

ubuntu zesty webupd8 ppa

add myscript to $HOME/bin, make sure it is in PATH and that it is executable

type myscript and get the shortcut type xeyes and get the shortcut for /usr/bin/xeyes

type myscript and get nothing type xeyes and get nothing

arthurzenika commented 7 years ago

It would also be nice to be able to type "evince" instead of "Document Viewer"

ManuelSchneid3r commented 7 years ago

exec keys in desktop entries come in v0.13. For executables there are at lease two ways. Index it with the files ext and use the alternative actions or use the terminal extension. Read the docs.

ManuelSchneid3r commented 7 years ago

Just realized that the alternative action is part of v0.13 too, please be patient it will be released soon.

vspinu commented 6 years ago

I think this is a pretty common pattern. The problem with files extension is that one cannot allow for symlinks for specific directories, and as executables in bin folder tend to be symlinks they are not shown.

I think "follow symlinks" does a bit too much here. I think it should propose the symlink itself in the completion.

vspinu commented 6 years ago

679 elaborates on this but it's unfortunately closed.

ManuelSchneid3r commented 6 years ago

@vspinu this issue is too old to use it as context. You are doing it wrong. You should not use the files extension to try to index executables. There is the terminal extension that does nothing else but handling the executables in PATH in whichever ways you want it. Run it directly, in your shell, in a terminal, how It should exit, and you can pass params, these are things the files extension will never be able to do for you, simply because its not its responsibility. Further indexing all executables in path would be absolute overkill and pollute your output.

vspinu commented 6 years ago

You are right. Using file extension doesn't make much sense. I just mentioned it because you proposed to use it for execs, which I guess is now no longer relevant.

I am using Terminal extension and it rocks! I just don't like that I have to prefix it with >. IIn my mind Applications and execs are the same and the difference in UI is not warranted. It's inconvenient to each time thing whether it's an application of exec what you want to launch. Would it be possible to add an option to Terminal extension to make ">" prefix optional?

FWIW, the KRunner (which I just ditched after many years of use) does not require prefix for execs and allows for command params.

aj3423 commented 4 years ago

In case anyone also wants to disable the ">" trigger, edit the souce code:

in fle albert/plugins/terminal/src/extension.cpp

void Terminal::Extension::handleQuery(Core::Query * query) const {
    // if ( !query->isTriggered() || query->string().trimmed().isEmpty() )    <----- remove these 2 lines
    //     return;

and file albert/plugins/terminal/src/extension.h

  // QStringList triggers() const override { return {">"}; }   <----- remove this