Compare commits

...

2 Commits

Author SHA1 Message Date
0d748e6706 fix: migrate to nautilus api 4.0
The new Version introduced a breaking change to the MenuProvider
interface. This change keeps compatibility with the lower version.

See: <https://gnome.pages.gitlab.gnome.org/nautilus-python/nautilus-python-migrating-to-4.html>
2022-12-29 14:14:31 +01:00
f8ed7b1c1f docs(README): add general dev info about natilus plugins 2022-12-29 14:14:31 +01:00
2 changed files with 14 additions and 3 deletions

View File

@@ -25,3 +25,12 @@ additional information.
After installing or uninstalling, you must quit and restart nautilus for the
change to take effect (`nautilus -q`).
## Development
Exit nautilus with `nautilus --quit` and run nautilus with additional debugging
output with `nautilus --no-desktop`.
- [API Reference]
[API Reference]: https://gnome.pages.gitlab.gnome.org/nautilus-python/class-nautilus-python-menu-provider.html

View File

@@ -34,12 +34,14 @@ class KittyNautilusExtension(GObject.GObject, Nautilus.MenuProvider):
item.connect("activate", self.launch_kitty, path)
return item
def get_file_items(self, _window, files) -> [Nautilus.MenuItem]:
def get_file_items(self, *args) -> [Nautilus.MenuItem]:
files = args[-1]
if len(files) == 1:
path = files[0].get_location().get_path()
if os.path.isdir(path):
return [self.make_item("NautilusFileOpenKitty", path)]
def get_background_items(self, _window, file) -> [Nautilus.MenuItem]:
path = file.get_location().get_path()
def get_background_items(self, *args) -> [Nautilus.MenuItem]:
folder = args[-1]
path = folder.get_location().get_path()
return [self.make_item("NautilusBackgroundOpenKitty", path)]