Skip to content

Commit

Permalink
feat(applicatons): allow running terminal applications using a separa…
Browse files Browse the repository at this point in the history
…te format (closes #141)
  • Loading branch information
linkfrg committed Feb 7, 2025
1 parent 50d23bc commit 90abac3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions ignis/services/applications/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ def unpin(self) -> None:
"""
self.is_pinned = False

def launch(self, command_format: str | None = None) -> None:
def launch(
self, command_format: str | None = None, terminal_format: str | None = None
) -> None:
"""
Launch the application.
Expand All @@ -190,10 +192,17 @@ def launch(self, command_format: str | None = None) -> None:
custom_env.pop("PYTHONPATH", None)
custom_env["PATH"] = os.defpath

cmd: str

if self.is_terminal is True and terminal_format is not None:
cmd = terminal_format.replace("%command%", exec_string)
elif command_format is not None:
cmd = command_format.replace("%command%", exec_string)
else:
cmd = exec_string

subprocess.Popen(
exec_string
if command_format is None
else command_format.replace("%command%", exec_string),
cmd,
shell=True,
start_new_session=True,
stdout=subprocess.DEVNULL,
Expand Down

0 comments on commit 90abac3

Please sign in to comment.