bassmanitram / actions-for-nautilus

An extension to the Gnome "Files" file manager that allows you to add arbitrary actions to the file selection context menu.
Apache License 2.0
165 stars 16 forks source link

Not working on Ubuntu 22.10 #45

Closed threed-factory-store closed 1 year ago

threed-factory-store commented 1 year ago

Followed the install instructions:

I don't see any commands in the right-click menu of an image file.

bassmanitram commented 1 year ago

Hey there. Can you attach your configuration file (the doc tells you where to find that)

Thanks

On Sat, 15 Apr 2023, 02:23 threed-factory-store, @.***> wrote:

Followed the install instructions:

  • Downloaded and installed the deb
  • Ran Actions for Nautilus Configurator
  • Added my command
  • Restarted Nautilus

I don't see any commands in the right-click menu of an image file.

— Reply to this email directly, view it on GitHub https://github.com/bassmanitram/actions-for-nautilus/issues/45, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAKLWRBJ7SF6CJO6NZPKZLXBHS6PANCNFSM6AAAAAAW7BEVJM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

bassmanitram commented 1 year ago

I have installed the extension on a fresh Ubuntu 22.10 installation and it seems to work in general. A reminder of the installation process:

This will install the deb and restart Nautilus in order to immediately see the extension.

You should then:

You can then be sure that extension is installed and working (I am working on an alternative and cleaner approach to configuration update in Nautilus rather than the timer, but it's actually tougher than it seems :))

After that, the non-appearance of certain actions for certain files is almost certainly because the action hasn't been correctly configured.

However, having your configuration would allow me to confirm this in your particular use case.

bassmanitram commented 1 year ago

@threed-factory-store - do you have any more help for me in addressing this?

threed-factory-store commented 1 year ago

This is so bizarre. I've responded to your emails, but my responses are not showing up here. So here goes:

It looks to me like it's not installed properly. Here's my config file and a screen shot of the right-click menu for an image file. The item I've added is to send an image to my blog. It's a bash script which works fine if I run it by itself.

RightClickMenu

Here's my config file:

{"actions": [{"type": "command", "label": "Run in python3", "command_line": "gnome-terminal -t \"Running Python %b\" --profile \"No Close\" -- python3 %b", "cwd": "%d", "max_items": 1, "mimetypes": ["text/x-python"]}, {"type": "command", "label": "Test all place holders", "command_line": "%O printf '%%s\n' '#b' %b '#B' %B '#c' %c '#d' %d '#D' %D '#f' %f '#F' %F '#h' %h '#m' %m '#M' %M '#n' %n '#o' %o '#O' %O '#p' %p '#s' %s '#u' %u '#U' %U '#w' %w '#W' %W '#x' %x '#X' %X | zenity --title \"Test all place holders\" --text-info", "use_shell": true}, {"type": "command", "label": "Open in gedit", "command_line": "gedit %F", "filetypes": ["!directory", "standard"]}, {"type": "menu", "label": "Folder Actions", "actions": [{"type": "command", "label": "Execute command here", "command_line": "$(zenity --entry --text \"Enter command\" --title \"execute command in %f\" --width 800)", "cwd": "%f", "use_shell": true, "max_items": 1, "filetypes": ["directory"]}, {"type": "command", "label": "Start HTTP server here", "command_line": "gnome-terminal -t \"HTTP Server on %f\" -- python3 -m http.server --bind 127.0.0.1", "cwd": "%f", "max_items": 1, "mimetypes": ["inode/directory"]}]}, {"type": "menu", "label": "Copy details", "actions": [{"type": "command", "label": "Copy name", "command_line": "echo -n %B | xclip -f -selection primary | xclip -selection clipboard", "use_shell": true}, {"type": "command", "label": "Copy path", "command_line": "echo -n %F | xclip -f -selection primary | xclip -selection clipboard", "use_shell": true}, {"type": "command", "label": "Copy URI", "command_line": "echo -n %U | xclip -f -selection primary | xclip -selection clipboard", "use_shell": true}]}, {"type": "command", "label": "Send To Blog", "command_line": "ImageToBlog \"%F\"", "use_shell": true, "min_items": 1, "max_items": 1, "permissions": "read"}]}

threed-factory-store commented 1 year ago

After it's installed, where is the app that shows the right-click menu, and how does it get run?

bassmanitram commented 1 year ago

That config data is invalid JSON - it has had all the intra-string quote escapes removed. Bizarre. Download the one in the sources and place it in ${HOME}/.local/share/actions-for-nautilus and rename it to config.json.

Then stop and restart Nautilus (<ALT>F2, enter nautilus -q, then open Nautilus)

If you want to see debug messages, then follow this section of the README.

bassmanitram commented 1 year ago

The main extension goes in /usr/share//nautilus-python/extensions/actions-for-nautilus, whereas the configurator goes in /usr/share/actions-for-nautilus-configurator. See the makefile for more info.

threed-factory-store commented 1 year ago

This is very odd. I did everything you asked, but it didn't help.

I thought I'd try running /usr/share/nautilus-python/extensions/actions-for-nautilus/actions_for_nautilus.py, and I got this error:

Traceback (most recent call last):

File "/usr/share/nautilus-python/extensions/actions-for-nautilus/./actions_for_nautilus.py", line 2, in

from gi.repository import Nautilus, GObject

ModuleNotFoundError: No module named 'gi'

So I looked into gi.repository (https://pygobject.readthedocs.io/en/latest/getting_started.html#ubuntu-getting-started) and found how to install it on Ubuntu:

sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-4.0

I did that and it said there was nothing to install.

Then I put their hello.py on my system and ran it and it still said Traceback (most recent call last): File "/home/walt/.local/share/actions-for-nautilus/./hello.py", line 3, in import gi

ModuleNotFoundError: No module named 'gi'

I'll be out of town for the next two days, but I'll dig into this more when I get home.

threed-factory-store commented 1 year ago

Had some time before I had to leave.... pip install PyGObject gave me some errors which led me to... sudo apt install pkg-config after which I tried installing PyGObject again which gave me... ....
× Building wheel for pycairo (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [15 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-cpython-310 creating build/lib.linux-x86_64-cpython-310/cairo copying cairo/init.py -> build/lib.linux-x86_64-cpython-310/cairo copying cairo/init.pyi -> build/lib.linux-x86_64-cpython-310/cairo copying cairo/py.typed -> build/lib.linux-x86_64-cpython-310/cairo running build_ext Package cairo was not found in the pkg-config search path. Perhaps you should add the directory containing `cairo.pc' to the PKG_CONFIG_PATH environment variable No package 'cairo' found Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1. [end of output]

I don't know what's going on.

bassmanitram commented 1 year ago

Been searchin'.

gi should be here - /usr/lib/python3/dist-packages/gi - get that out of the way first

If so, then I think for some reason python3 itself isn't configured to look there for the module...

bassmanitram commented 1 year ago

https://bic-berkeley.github.io/psych-214-fall-2016/sys_path.html may help debug "where does python look for modules" - at least the first part tells you how to see the default places that python is looking in. For ME the sys.path has the following elements:

/usr/lib/python310.zip /usr/lib/python3.10 /usr/lib/python3.10/lib-dynload /home/ME/.local/lib/python3.10/site-packages /usr/local/lib/python3.10/dist-packages /usr/lib/python3/dist-packages

threed-factory-store commented 1 year ago

Hey, hey, hey! That was it!

My sys.path didn't list any dist-packages folders. I added /usr/lib/python3/dist-packages and now I see the menu items. Time to add mine and make the magic happen.

Thanks for diagnosing my Python problems Martin!

bassmanitram commented 1 year ago

Hey, hey, hey! That was it!

My sys.path didn't list any dist-packages folders. I added /usr/lib/python3/dist-packages and now I see the menu items. Time to add mine and make the magic happen.

Thanks for diagnosing my Python problems Martin!

No problem. Glad to help