mirror of
https://github.com/moons-14/dotfiles.git
synced 2026-10-06 05:18:12 +09:00
open ghostty
This commit is contained in:
@@ -25,6 +25,7 @@ in
|
||||
systemd.user.sessionVariables.NAUTILUS_4_EXTENSION_DIR = nautilusExtensionDir;
|
||||
|
||||
xdg.dataFile."nautilus-python/extensions/open-in-editor.py".text = ''
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from gi.repository import GObject, Nautilus
|
||||
@@ -75,6 +76,12 @@ in
|
||||
|
||||
return paths
|
||||
|
||||
@staticmethod
|
||||
def get_working_directory(paths):
|
||||
path = paths[0]
|
||||
|
||||
return path if os.path.isdir(path) else os.path.dirname(path)
|
||||
|
||||
@staticmethod
|
||||
def launch(_item, command):
|
||||
subprocess.Popen(
|
||||
@@ -101,6 +108,22 @@ in
|
||||
|
||||
items.append(item)
|
||||
|
||||
item = Nautilus.MenuItem(
|
||||
name=f"OpenInEditor::{context}::ghostty",
|
||||
label="Ghostty で開く",
|
||||
)
|
||||
|
||||
item.connect(
|
||||
"activate",
|
||||
self.launch,
|
||||
[
|
||||
"${lib.getExe pkgs.ghostty}",
|
||||
f"--working-directory={self.get_working_directory(paths)}",
|
||||
],
|
||||
)
|
||||
|
||||
items.append(item)
|
||||
|
||||
return items
|
||||
|
||||
def get_file_items(self, files):
|
||||
|
||||
Reference in New Issue
Block a user