From 4983a972b00fc327ceb9f2619e7b080122f6f3da Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Mon, 19 Jul 2021 22:00:34 +0100 Subject: [PATCH] LibDesktop: Add a RunInTerminal boolean field to app files This is common enough to warrant its own setting by now - but it's also partially a workaround. Since app files currently only support a single executable path with no arguments, we resort to generating wrapper scripts for port launchers with arguments - and then the executable is that shell script. We also moved from manually specifying icon files to embedding them in executables. As shell scripts can't have icons embedded in them, a different solution is needed - this one solves the common case of running a CLI program in a terminal, and still allows embedding of icons in the executable itself as no shell script is needed, meaning it will be shown in the taskbar and system menu. The second use case of actually passing arguments to the executable itself (and not just "Terminal -e ...") is not covered by this and still requires an external script (meaning no icon for now), but I think that can easily be solved by adding something like an "Arguments" field to app files. :^) --- Userland/Libraries/LibDesktop/AppFile.cpp | 5 +++++ Userland/Libraries/LibDesktop/AppFile.h | 1 + 2 files changed, 6 insertions(+) diff --git a/Userland/Libraries/LibDesktop/AppFile.cpp b/Userland/Libraries/LibDesktop/AppFile.cpp index d55d60002a..f97030b78d 100644 --- a/Userland/Libraries/LibDesktop/AppFile.cpp +++ b/Userland/Libraries/LibDesktop/AppFile.cpp @@ -82,6 +82,11 @@ String AppFile::category() const return m_config->read_entry("App", "Category").trim_whitespace(); } +bool AppFile::run_in_terminal() const +{ + return m_config->read_bool_entry("App", "RunInTerminal", false); +} + Vector AppFile::launcher_file_types() const { Vector file_types; diff --git a/Userland/Libraries/LibDesktop/AppFile.h b/Userland/Libraries/LibDesktop/AppFile.h index d6ff5d7509..1952c0e690 100644 --- a/Userland/Libraries/LibDesktop/AppFile.h +++ b/Userland/Libraries/LibDesktop/AppFile.h @@ -26,6 +26,7 @@ public: String name() const; String executable() const; String category() const; + bool run_in_terminal() const; Vector launcher_file_types() const; Vector launcher_protocols() const; bool spawn() const;