Ulauncher: Feature: (optionally) set ulauncher text input from command-line

Created on 17 Oct 2018  路  8Comments  路  Source: Ulauncher/Ulauncher

I would like to propose having a command line option (e.g. --init "...") to pass a certain initial string value for the ulauncher to search.
E.g. you call ulauncher --init "jump " and an ulauncher window pops up with "jump " already input to it (so it would trigger an extension with keyword 'jump').

Why?

Allowing this we might set custom Linux keyboard shortcuts for invoking certain convenient extensions. Say I use e.g. the 'jump' extension tons of times a day. It's much more appealing to hit e.g. 'Super+J' and having ulauncher appear with the triggering keyword "jump " than 'Trigger ulauncher' + 'Enter "jump "'...

How?

I think the proposed optional initial input should be a minor change when calling the window instance, but it opens a range of possibilities to customize ulauncher behavior externally from the Linux environment.
What do you think of this? Any opinions, ideas or suggestions on implementing something like this?

feature

Most helpful comment

I'm also interested in this feature. However, I found a workaround using xautomation on Ubuntu.

I map this script to the shortcut I want :

#!/usr/bin/env bash

ulauncher-toggle
sleep 0.1
xte 'str jump '

Prerequisites :

sudo apt install xautomation wmctrl

All 8 comments

I don't think it's very hard, but with the other things that are planned now it's not likely to get a high prio.

Would it be welcome if I implement it and do a pull request? :)
(Might need to ask some detail or get a first brief direction on where to look at though)

@gornostal wants to keep Ulauncher maintainable, so he doesn't accept all feature PR's (which is good and insightful of him). I also think that PR's should not be encouraged for every situation. Quoting myself from a recent PR:

Reviewing PR's often needs more effort from maintainers than making the changes themselves. In particular "drive-by" contributions when the author doesn't want to invest time into understanding how everything works, styleguides etc. The "constructive" feedback loop with code reviews is nicer, but really time consuming.

Note that this statement is mine, not official Ulauncher policy, and I don't know your competence or willingness to invest time on this. I'm not trying to discourage you, but rather helping you make a more informed choice.

If you want to be efficient with you own time you should wait for @gornostal's response as well as the Python 3 migration to get merged, so you don't have to rebase or rewrite.

But this might take some time. So if you're able to help yourself, in a hurry and/or curious, then go ahead. This is how you learn stuff.

@jbriales I see how this feature could be useful, but I want to keep the app simple.
So if more people come and request this feature then I'll implement it or accept a PR.

I'll keep this issue open for that reason.

And yeah, we are working on Python 3 migration so only bug fixes or PRs to non-python files may be accepted at this stage.

than 'Trigger ulauncher' + 'Enter "jump "'...

BTW, you can change "jump" keyword to something shorter, like "j". Go to Preferences -> Extension -> Type in a new keyword -> Press Save.

I guess you already knew that, but if you didn't that may be helpful.

Great, I understand the points.
Let's see if anyone gets interest on this. I'm pretty busy myself nowadays, so I think it makes sense to wait until migration to Python 3 is ready anyway. Meanwhile I'll keep it in my wishlist :)

I've been thinking about this a bit and it's also on my wish list now (but not urgent).

I would prefer using the extension id + keyword id rather than a keyword. This is less user friendly of course, but it's more rigid. Keyword id could be optional, since most extensions only has one.

Ex: ulauncher --init=com.github.username.reponame/keyword_id

Advantages:

  • Low risk of accidentally breaking custom keyboard shortcuts. This could otherwise happen if you change the keyword, and I think it could happen if you install an extension with the same default keyword as an existing extension.
  • Extension developers could add instructions on how to trigger the extension directly (otherwise this is more cumbersome, since they can't know user-defined keywords).
  • Users could deactivate a keyword from Ulauncher (replacing the text with an empty string from the extension preferences), but still trigger it with a command / custom keybinding.

I also would prefer if I wasn't able to select or delete the keyword if an extension is to be triggered directly. I'd rather not show any keyword at all, or show the extension icon instead.

I'm also interested in this feature. However, I found a workaround using xautomation on Ubuntu.

I map this script to the shortcut I want :

#!/usr/bin/env bash

ulauncher-toggle
sleep 0.1
xte 'str jump '

Prerequisites :

sudo apt install xautomation wmctrl
Was this page helpful?
0 / 5 - 0 ratings

Related issues

arthurlogilab picture arthurlogilab  路  3Comments

Warmuser picture Warmuser  路  3Comments

altla picture altla  路  5Comments

frdrk picture frdrk  路  4Comments

ibot3 picture ibot3  路  6Comments