dalanicolai / gnome-tracker-extension

Ulauncher extension for (deep) search filesystem via the gnome tracker, recoll, docfetcher, locate or calibre index
62 stars 4 forks source link

The extension doesn't work #2

Closed PauloDanielCarneiro closed 5 years ago

PauloDanielCarneiro commented 5 years ago

The only command that seems to work is lc. Is there any configurations or prerequisite?

dalanicolai commented 5 years ago

Hi Paulo,

Well, for the gnome tracker keywords (gt and ts) a gnome tracker database and running daemon is required. For the docfetcher keyword (df) a running docfetcher daemon is required.

I would also like to mention that I simply created this extension for a friend of mine, but as I found it quite usable myself in its current state, I decided to publish it. Another main reason to publish it is that people can use it as a basis for further tweaking/development of the extension. If you know some basic python then (possibly in combination with the ulauncher extension documentation) you can tweak the extension easily to your needs. (For example you could easily make the locate command case-insensitive, or add another keyword e.g. 'lci' for that)

If you have further questions or suggestions then just contact me again.

Cheers, Daniel

On Tue, 12 Feb 2019 at 14:11, Paulo Daniel Carneiro < notifications@github.com> wrote:

The only command that seems to work is lc. Is there any configurations or prerequisite?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dalanicolai/gnome-tracker-extension/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/ARk3X_JDAbjZOPIn1TEaQwlidRHJSKkKks5vMr1mgaJpZM4a2W8o .

dalanicolai commented 5 years ago

This information used to be available on the github https://github.com/dalanicolai/gnome-tracker-extension page. But I see now that I removed too much information after some recent upgrade. I will put the information back there...

On Tue, 12 Feb 2019 at 14:41, dalanicolai dalanicolai@gmail.com wrote:

Hi Paulo,

Well, for the gnome tracker keywords (gt and ts) , a gnome tracker database and running daemon is required. For the docfetcher keyword (df) a running docfetcher daemon is required.

I would also like to mention that I simply created this extension for a friend of mine, but as I found it quite usable myself in its current state, I decided to publish it. Another main reason to publish it is that people can use is as a basis for further tweaking/development of the extension. If you know some basic python then (possibly in combination with the ulauncher extension documentation) you can tweak the extension easily to your needs.

If you have further questions then just contact me again.

On Tue, 12 Feb 2019 at 14:11, Paulo Daniel Carneiro < notifications@github.com> wrote:

The only command that seems to work is lc. Is there any configurations or prerequisite?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dalanicolai/gnome-tracker-extension/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/ARk3X_JDAbjZOPIn1TEaQwlidRHJSKkKks5vMr1mgaJpZM4a2W8o .

protostork commented 5 years ago

Daniel, just wanted to share that I love this extension, thanks for sharing it! This has finally given ulauncher feature-parity with launchy (with a few tweaks).

LinuxOnTheDesktop commented 5 years ago

Thanks for creating this extension.

I tried to use its search-via-locate function on Mint Cinnamon. However, when I do so it says 'loading' indefinitely. Indeed it does that even after I have typed the keyword to start the search and before I have entered any search term.

protostork commented 5 years ago

Hi - I think I had encountered a similar error when I tried it at one point. It might have to do with your locate database not being updated yet, if it's a fresh install (at least on Ubuntu that was the case). (But it could also be some other error, hard to tell without more details).

Can you check if on the command line the following command produces any results?

locate bash (or replace bash with any other known filename on your system)

If it doesn't, you may need to run "sudo updatedb".

LinuxOnTheDesktop commented 5 years ago

Thanks. locate bash returned many results (many of them from within my backups). I ran sudo updatedb anyway. The command seemed to complete successfully. At that point I tried the function in launcher again. Result: once again, no dice.

protostork commented 5 years ago

Thanks. Can you try doing the following on the terminal to maybe diagnose what the issue is?

killall ulauncher ulauncher

Then try searching in ulauncher with locate again and see if it spits out any error messages on the terminal when it fails, which might give a hint of why it's not working. Does the gnome tracker search work ok in ulauncher?

Also, any chance you have renamed the keywords in the config? I think when you redefine the keywords, it doesn't work anymore at the moment...

LinuxOnTheDesktop commented 5 years ago

Thanks. Here is the output. It seems to include something rather significant at its end.

$  sudo killall ulauncher
 ~  $  ulauncher
/usr/lib/python2.7/dist-packages/ulauncher/util/desktop/notification.py:1: PyGIWarning: Notify was imported without specifying a version first. Use gi.require_version('Notify', '0.7') before import to ensure that the right version gets loaded.
  from gi.repository import Notify
/usr/lib/python2.7/dist-packages/ulauncher/ui/windows/PreferencesUlauncherDialog.py:6: PyGIWarning: WebKit2 was imported without specifying a version first. Use gi.require_version('WebKit2', '4.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gio, Gtk, WebKit2, GLib
/usr/lib/python2.7/dist-packages/ulauncher/util/image_loader.py:3: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gtk, Gio, GLib, GdkPixbuf
/usr/lib/python2.7/dist-packages/ulauncher/util/image_loader.py:3: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gtk, Gio, GLib, GdkPixbuf
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ulauncher/api/client/Client.py", line 52, in on_message
    self.extension.trigger_event(event)
  File "/usr/lib/python2.7/dist-packages/ulauncher/api/client/Extension.py", line 52, in trigger_event
    action = listener.on_event(event, self)
  File "/home/nicholas/.cache/ulauncher_cache/extensions/com.github.dalanicolai.gnome-tracker-extension/main.py", line 110, in on_event
    for i in results:
UnboundLocalError: local variable 'results' referenced before assignment
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ulauncher/api/client/Client.py", line 52, in on_message
    self.extension.trigger_event(event)
  File "/usr/lib/python2.7/dist-packages/ulauncher/api/client/Extension.py", line 52, in trigger_event
    action = listener.on_event(event, self)
  File "/home/nicholas/.cache/ulauncher_cache/extensions/com.github.dalanicolai.gnome-tracker-extension/main.py", line 110, in on_event
    for i in results:
UnboundLocalError: local variable 'results' referenced before assignment
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ulauncher/api/client/Client.py", line 52, in on_message
    self.extension.trigger_event(event)
  File "/usr/lib/python2.7/dist-packages/ulauncher/api/client/Extension.py", line 52, in trigger_event
    action = listener.on_event(event, self)
  File "/home/nicholas/.cache/ulauncher_cache/extensions/com.github.dalanicolai.gnome-tracker-extension/main.py", line 110, in on_event
    for i in results:
UnboundLocalError: local variable 'results' referenced before assignment
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ulauncher/api/client/Client.py", line 52, in on_message
    self.extension.trigger_event(event)
  File "/usr/lib/python2.7/dist-packages/ulauncher/api/client/Extension.py", line 52, in trigger_event
    action = listener.on_event(event, self)
  File "/home/nicholas/.cache/ulauncher_cache/extensions/com.github.dalanicolai.gnome-tracker-extension/main.py", line 110, in on_event
    for i in results:
UnboundLocalError: local variable 'results' referenced before assignment
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ulauncher/api/client/Client.py", line 52, in on_message
    self.extension.trigger_event(event)
  File "/usr/lib/python2.7/dist-packages/ulauncher/api/client/Extension.py", line 52, in trigger_event
    action = listener.on_event(event, self)
  File "/home/nicholas/.cache/ulauncher_cache/extensions/com.github.dalanicolai.gnome-tracker-extension/main.py", line 110, in on_event
    for i in results:
UnboundLocalError: local variable 'results' referenced before assignment

Also, yes, I did rename the keyword to search via `locate'.

EDIT: and attempting the search really hammers my CPU (> 10% constant use, I imagine on a single core) even if I hide ulauncher.

protostork commented 5 years ago

Cool, will look into to see if I can reproduce, but I think it may be related to the keyword change. In the meantime, see if you can rename the locate keyword in the config back to 'lc' and see if it works?

As a stopgap for now, it's possible to change keywords but you need to hack the core files of the plugin, as well as the config. You'd need to edit the keyword variables in ~/.cache/ulauncher_cache/extensions/com.github.dalanicolai.gnome-tracker-extension/main.py to the new keyword (but those changes occasionally seem to get restored to defaults by ulauncher, so it may not be a permanent solution - but you can make a small shell script to back it up, or perhaps disable write permissions on the file?).

LinuxOnTheDesktop commented 5 years ago

Thank you.

When I reset the keyword to lc everything does indeed work. I will stick to using that default.

dalanicolai commented 5 years ago

Hi @LinuxOnTheDesktop,

Thanks for reporting the problem about the keywords. I quickly had a look at it and, as you already found yourself, I also found the problem is related to changing the keywords. However, I think the bug does not come from this extension but is probably a bug in the ulauncher extension API. The keywords are defined in the manifest.json file in the ~/.cache/ulauncher_cache/extensions/com.github.dalanicolai.gnome-tracker-extension directory. The feature to set the keyword is handled by the extension API and not by the extension itself (information about it is found here http://docs.ulauncher.io/en/latest/extensions/tutorial.html). Unfortunately, changing the default keyword in the manifest file also does not work. I will notify the Ulauncher developers about this problem and report back to you...

dalanicolai commented 5 years ago

@desigit Thanks for the support!

protostork commented 5 years ago

Thanks @LinuxOnTheDesktop , glad it's working now.

@PauloDanielCarneiro Absolute pleasure, glad to be able to contribute. I have just submitted a pull request for what might be a fix for the bug for the user-preferences setting of keywords. It seems to work fine at my end (though I'm not sure I've done everything correctly with the git pulls, pushes, etc). Do let me know if it works for you.

dalanicolai commented 5 years ago

@desigit Thanks for the fix. I guess you mistakingly addressed PauloDanielCarneiro instead of me dalanicolai (I am also a Daniel). Anyway, I replied you already in the pull request. Seems I was wrong about blaming the API. But things seem to work fine now so I will close this issue for now...