41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
import os
|
|
import pathlib
|
|
import subprocess
|
|
|
|
|
|
def open_path_with_default_app(file_path: pathlib.Path):
|
|
"""
|
|
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)])
|
|
|
|
def open_file_with_geeqie(file_path: pathlib.Path):
|
|
"""
|
|
Open the specified file path with the Geeqie image viewer.
|
|
|
|
: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(
|
|
[
|
|
"/usr/bin/geeqie",
|
|
# "-t",
|
|
# "--without-tools",
|
|
"--file",
|
|
str(file_path),
|
|
],
|
|
env=my_env,
|
|
)
|
|
|
|
def open_path_in_dolphin(file_path: pathlib.Path):
|
|
"""
|
|
Open the specified file path in the Dolphin file manager and select the file.
|
|
|
|
:param file_path: The path of the file to be opened in Dolphin.
|
|
"""
|
|
subprocess.Popen(["/usr/bin/dolphin", "--select", str(file_path)])
|