refactor: provide a proper TUI interface with textual

This commit is contained in:
2026-06-29 16:48:46 +03:00
parent 3ab6b837f2
commit 5667833907
7 changed files with 391 additions and 160 deletions
+5 -6
View File
@@ -3,13 +3,14 @@ import pathlib
import subprocess
def open_path_with_default_app(file_path: pathlib.Path):
def open_file_with_default_app(file_path: pathlib.Path) -> bool:
"""
Open the specified file path with the default application associated with its file type.
:param file_path: The path of the file to be opened.
"""
subprocess.run(["/usr/bin/xdg-open", str(file_path)])
process = subprocess.Popen(["/usr/bin/xdg-open", str(file_path)]) # noqa: S603
return process.wait() == 0 # xdg-open should instantly return, so we can check if it was successful
def open_file_with_geeqie(file_path: pathlib.Path):
"""
@@ -17,21 +18,19 @@ def open_file_with_geeqie(file_path: pathlib.Path):
:param file_path: The path of the file to be opened.
"""
print("Running subprocess to open file with Geeqie:", file_path)
my_env = os.environ.copy()
my_env["GQ_DISABLE_CLUTTER"] = "y"
subprocess.Popen(
_ = subprocess.Popen(
[
"/usr/bin/geeqie",
# "-t",
# "--without-tools",
"--file",
str(file_path),
],
env=my_env,
)
def open_path_in_dolphin(file_path: pathlib.Path):
def open_file_in_dolphin(file_path: pathlib.Path):
"""
Open the specified file path in the Dolphin file manager and select the file.