initial commit
This commit is contained in:
7
LISENCE
Normal file
7
LISENCE
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Copyright © 2022 Jonas Kattendick
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
10
README.md
Normal file
10
README.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# kitty-nautilus
|
||||||
|
|
||||||
|
Simple nautilus-python extension for kitty integration (like
|
||||||
|
gnome-terminal-nautilus or gnome-console-nautilus).
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- [kitty](https://github.com/kovidgoyal/kitty/)
|
||||||
|
- [nautilus](https://gitlab.gnome.org/GNOME/nautilus/)
|
||||||
|
- [nautilus-phython](https://gitlab.gnome.org/GNOME/nautilus-python/)
|
||||||
29
kitty-nautilus.py
Normal file
29
kitty-nautilus.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import subprocess
|
||||||
|
from gi.repository import Nautilus, GObject
|
||||||
|
|
||||||
|
|
||||||
|
class KittyNautilusExtension(GObject.GObject, Nautilus.MenuProvider):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def launch_kitty(self, menu: Nautilus.MenuItem, file):
|
||||||
|
path = file.get_location().get_path()
|
||||||
|
subprocess.Popen(["kitty", "--working-directory", path], shell=False)
|
||||||
|
|
||||||
|
def make_item(self, name, file) -> Nautilus.MenuItem:
|
||||||
|
item = Nautilus.MenuItem(
|
||||||
|
name=name,
|
||||||
|
label="Open in Kitty",
|
||||||
|
tip="Open current folder in Kitty",
|
||||||
|
icon="terminal",
|
||||||
|
)
|
||||||
|
item.connect("activate", self.launch_kitty, file)
|
||||||
|
return item
|
||||||
|
|
||||||
|
def get_file_items(self, _window, files) -> [Nautilus.MenuItem]:
|
||||||
|
if len(files) == 1:
|
||||||
|
return [self.make_item("NautilusFileOpenKitty", files[0])]
|
||||||
|
|
||||||
|
def get_background_items(self, _window, file) -> [Nautilus.MenuItem]:
|
||||||
|
return [self.make_item("NautilusBackgroundOpenKitty", file)]
|
||||||
Reference in New Issue
Block a user