Ulauncher: Trigger KeywordQueryEvent without space

Created on 27 Aug 2018  路  6Comments  路  Source: Ulauncher/Ulauncher

Hello, thanks a lot for this nice little tool, I've started using it a month ago and really is awesome!

I have a feature request: I'm currently implementing some actions in an extension to be run directly. The base command I'm testing this with is a suspend action to trigger sleep mode.
I was able to write the extension as expected, but I would really like to be able to skip the space in the KeywordQueryEvent trigger. To run the action I have to input suspend<space>, while I would like to be able to input only suspend.

Would be possible to have this set in a extension option, in order to disable it for extension where is not needed?

I'm willing to try implementing this if you are ok with the idea.

Thank you!

enhancement

All 6 comments

I understand the problem you are talking about.
I remember there was a reason why I implemented it that way. I need to have another look to see if it's possible to launch extension without a space after the keyword

Could this be a duplicate of #191?

@friday Not in my intentions :)

191 behaviour seems to work: if I use suspend<space> ( so no argument ) everything works as expected.

My case is slightly different as I want to avoid tiping the <space> character.

Anyway I won't mind if you prefer closing this and move discussion in the other issue.

I'm not a Ulauncher maintainer, and also not trying to blame anyone (shortcuts and keywords are not the same thing after all). Just interested in this since I made the same observations as you. I think the keyword behavior is good for what they do however, and want to keep the space.

  • Many extensions use very short keywords. Single letters are common as defaults. The "Search files" and "Gnome control center" extensions both use "s" by default. I think I've even seen a third to do this.
  • Once the keyword (+ space) is matched and the result view is rendered, this is exclusive. So no other search results will show. You wouldn't be able to type "suspend" if "s" triggers another extensions result view.
  • As my extension demonstrates (and yours even more it seems), once KeywordQueryEvent is triggered, you can run code which would be annoying for users to do by mistake.

So for keywords I think the current behavior makes sense. But I think Ulauncher could need a new way to index custom applications via extensions instead. In the meanwhile you may want have a look at https://github.com/friday/ulauncher-gnome-settings. I was able to find a couple of tricks to get keywords to behave more like apps.

You can also create desktop entries in ~/.local/share/applications/. Ulauncher index them as apps. Then you wouldn't need the extension at all.

hi @endorama

Sorry, I'm going to have to close this one for the same reason as #306.
I think entering just a keyword should not trigger an extension.

When you want to trigger some action by just entering a keyword, I think it will make more sense to use Shortcuts once #191 is implemented.

Hi @gornostal, fortunately I was able to reach my objective following
@friday suggestion yo create desktop entries!

You could also create desktop entries somewhere in ~/.local/share/.
Ulauncher would index them as apps. Then you wouldn't need the extension at
all

Work a charm and has been super easy!
So thank you, I'll have look at shortcut once done but for now my use case
has been perfectly solved :D

>

Was this page helpful?
0 / 5 - 0 ratings