saleguas/context_menu

[QUESTION] Running on VM - Ubuntu

Closed this issue · 9 comments

Hello, I am trying create fast command but it seems not working. Did someone tried create context menus on VM?

My configuration:
HOST: Windows 7 64bit
GUEST: Ubuntu 20.04 64bit
Running on Virtual Box 6.1

Thank's for any help.

I did all my testing in an Ubuntu 20.04 VM, so it should work. Did you restart nautilus after running the command? And please post your code. Thanks.

from context_menu import menus
fc = menus.FastCommand('Example Fast Command 1', type='FILES', command='echo Hello')
fc.compile()

then nautilus -q then open file manager. Maybe i am missing something?

Does the entry appear on the context menu? The way it interacts on Linux is quite weird and the shell being ran isn't the same shell that you probably have open (you won't have any output).

I tried the same. I'm also unable to see the context menu. What else should be done? @saleguas

As you mentioned it doesn't execute in the same shell.
I wrote bash scripts
one.sh is the filename
#!/bin/sh

echo one.sh: pid is "$$"
python3 simple_fast_command.py
. ./two.sh
echo done with "$0"

two.sh is the filename#!/bin/bash
echo two.sh: pid is "$$"
nautilus -q

the output after I run one.sh
one.sh: pid is 37341
/home/nikki/.local/share/
two.sh: pid is 37341
done with one.sh

So, typically they ran on same processes or terminal.

But still I don't see context menu.
Let me know if I missed anything else.

/usr/lib/python2.7/dist-packages/gi/types.py:220: Warning: type name 'Example Fast Command 1+ExampleMenuProvider' contains invalid characters
gi.type_register(cls, namespace.get('gtype_name'))
Traceback (most recent call last):
File "/home/nikki/.local/share/nautilus-python/extensions/Example Fast Command 1.py", line 21, in
class ExampleMenuProvider(GObject.GObject, Nautilus.MenuProvider):
File "/usr/lib/python2.7/dist-packages/gi/types.py", line 229, in init
super(GObjectMeta, cls).init(name, bases, dict
)
File "/usr/lib/python2.7/dist-packages/gi/types.py", line 208, in init
cls._type_register(cls.dict)
File "/usr/lib/python2.7/dist-packages/gi/types.py", line 220, in _type_register
_gi.type_register(cls, namespace.get('gtype_name'))
RuntimeError: could not create new GType: Example Fast Command 1+ExampleMenuProvider (subclass of GObject)
Nautilus-Share-Message: 20:44:54.088: Called "net usershare info" but it failed: Failed to execute child process “net” (No such file or directory)

Instead of running nautilus -q, I ran nautilus -w.
Then I got the above error

Try replacing the spaces in "Example Fast Command 1" or replacing them with underscores.

Thank you. It worked. I am able to see the context menu @thescribe11

This afternoon I'll work on a PR to add automatic name validation.