nautilus-open-in-blackbox: init at 0.1.1

This commit is contained in:
BlankParticle 2023-11-20 21:32:15 +05:30
parent 2bac4cf11d
commit 54ad786ee2
No known key found for this signature in database
GPG Key ID: 0ACE126D7B359261
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,35 @@
{ python3, fetchFromGitHub, gnome, stdenv, lib }:
stdenv.mkDerivation rec {
pname = "nautilus-open-in-blackbox";
version = "0.1.1";
src = fetchFromGitHub {
owner = "ppvan";
repo = "nautilus-open-in-blackbox";
rev = "refs/tags/${version}";
hash = "sha256-5rvh3qNalpjamcBVQrnAW6GxhwPPlRxP5h045YDqvrM=";
};
# The Orignal Source code tries to execute `/usr/bin/blackbox` which is not valid in NixOS
# This patch replaces the call with `blackbox`
patches = [ ./paths.patch ];
buildInputs = [
gnome.nautilus-python
python3.pkgs.pygobject3
];
installPhase = ''
runHook preInstall
install -Dm555 ./nautilus-open-in-blackbox.py -t $out/share/nautilus-python/extensions
runHook postInstall
'';
meta = with lib; {
description = "Extension for nautilus, which adds an context-entry for opening in blackbox";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ blankparticle ];
homepage = "https://github.com/ppvan/nautilus-open-in-blackbox";
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,23 @@
diff --git a/nautilus-open-in-blackbox.py b/nautilus-open-in-blackbox.py
index 9a43f90..0a5b632 100755
--- a/nautilus-open-in-blackbox.py
+++ b/nautilus-open-in-blackbox.py
@@ -78,17 +78,10 @@ class BlackBoxNautilus(GObject.GObject, Nautilus.MenuProvider):
return item
- def is_native(self):
- return shutil.which("blackbox") == "/usr/bin/blackbox"
-
def _nautilus_run(self, menu, path):
"""'Open with BlackBox 's menu item callback."""
print("Openning:", path)
- args = None
- if self.is_native():
- args = args = ["blackbox", "-w", path]
- else:
- args = ["/usr/bin/flatpak", "run", TERMINAL_NAME, "-w", path]
+ args = ["blackbox", "-w", path]
subprocess.Popen(args, cwd=path)