From 7a0514786b41e1e96d4d379e126df97b891e9faf Mon Sep 17 00:00:00 2001 From: Cyano Hao Date: Sun, 2 Jun 2024 19:01:11 +0800 Subject: [PATCH] launch Linux terminal in its own process (#445) --- RedPandaIDE/resources/terminal-unix.json | 26 ++++++++++-------------- RedPandaIDE/settings.cpp | 1 + RedPandaIDE/utils.cpp | 5 +++++ packages/debian-static/control.in | 2 +- packages/debian/control | 2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/RedPandaIDE/resources/terminal-unix.json b/RedPandaIDE/resources/terminal-unix.json index 83cea967..a7828b20 100644 --- a/RedPandaIDE/resources/terminal-unix.json +++ b/RedPandaIDE/resources/terminal-unix.json @@ -36,7 +36,7 @@ { "name": "ROXTerm", "path": "roxterm", - "argsPattern": "$term -e \"$unix_command\"" + "argsPattern": "$term --separate -e \"$unix_command\"" }, { "name": "sakura", @@ -56,7 +56,7 @@ { "name": "Tilix", "path": "tilix", - "argsPattern": "$term -e $argv" + "argsPattern": "$term --new-process -e $argv" }, { "name": "Wayst", @@ -68,15 +68,11 @@ { "group": "Desktop Default", "terminals": [ - { - "name": "Deepin Terminal", - "path": "deepin-terminal", - "argsPattern": "$term -e $argv" - }, { "name": "Konsole (KDE)", "path": "konsole", - "argsPattern": "$term -e $argv" + "argsPattern": "$term --separate -e $argv", + "comment": "`--separate` is not required by default, just in case someone enabled single process mode" }, { "name": "GNOME Terminal", @@ -86,17 +82,17 @@ { "name": "GNOME Terminator", "path": "terminator", - "argsPattern": "$term -x $argv" + "argsPattern": "$term --no-dbus -x $argv" }, { "name": "LXTerminal (LXDE)", "path": "lxterminal", - "argsPattern": "$term -e $argv" + "argsPattern": "$term --no-remote -e $argv" }, { "name": "MATE Terminal", "path": "mate-terminal", - "argsPattern": "$term -x $argv" + "argsPattern": "$term --disable-factory -x $argv" }, { "name": "QTerminal (LXQt)", @@ -116,12 +112,12 @@ { "name": "Terminology (Enlightenment)", "path": "terminology", - "argsPattern": "$term -e \"$unix_command\"" + "argsPattern": "$term --no-dbus -e \"$unix_command\"" }, { "name": "Xfce Terminal", "path": "xfce4-terminal", - "argsPattern": "$term -x $argv" + "argsPattern": "$term --disable-server -x $argv" } ] }, @@ -142,7 +138,7 @@ { "name": "Elementary Terminal", "path": "io.elementary.terminal", - "argsPattern": "$term -e \"$unix_command\"", + "argsPattern": "$term --gapplication-app-id $random_app_id -e \"$unix_command\"", "comment": "confirm to quit" }, { @@ -154,7 +150,7 @@ { "name": "GNOME Console", "path": "kgx", - "argsPattern": "$term -- $argv", + "argsPattern": "$term --gapplication-app-id $random_app_id -- $argv", "comment": "confirm to quit" }, { diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index e091c77b..d7b9e6a0 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -4134,6 +4134,7 @@ const QMap Settings::Environment::mTerminalArgsPatternMagicVar {"dos_command", "$dos_command"}, {"lpCommandLine", "$lpCommandLine"}, {"tmpfile", "$tmpfile"}, + {"random_app_id", "$random_app_id"}, }; Settings::Executor::Executor(Settings *settings):_Base(settings, SETTING_EXECUTOR) diff --git a/RedPandaIDE/utils.cpp b/RedPandaIDE/utils.cpp index d723ec26..002955b3 100644 --- a/RedPandaIDE/utils.cpp +++ b/RedPandaIDE/utils.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "editor.h" #include "editorlist.h" #include "settings.h" @@ -753,6 +754,10 @@ std::tuple wrapCommandFor QFile(temproryFile->fileName()).setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ExeOwner); } wrappedArgs.push_back(temproryFile->fileName()); + } else if (patternItem == "$random_app_id") { + QString randomSuffix = QString::number(QRandomGenerator::global()->generate()); + QString appId = "io.redpanda.term" + randomSuffix; + wrappedArgs.push_back(appId); } else wrappedArgs.push_back(patternItem); } diff --git a/packages/debian-static/control.in b/packages/debian-static/control.in index 8415c3f2..a6734acf 100644 --- a/packages/debian-static/control.in +++ b/packages/debian-static/control.in @@ -9,6 +9,6 @@ Architecture: amd64 Depends: gcc, g++, make, gdb, gdbserver, astyle, libc6 (>= 2.17), libstdc++6 (>= 4.8), libdbus-1-3, libfontconfig1, libfreetype6, libwayland-client0, libwayland-cursor0, libwayland-server0, libx11-6, libx11-xcb1, libxcb1, libxcb-icccm4, libxcb-image0, libxcb-keysyms1, libxcb-randr0, libxcb-render-util0, libxcb-render0, libxcb-shape0, libxcb-shm0, libxcb-sync1, libxcb-xfixes0, libxcb-xinerama0, libxcb-xkb1, libxcb1, libxext6, libxkbcommon-x11-0, libxkbcommon0, libzstd1 -Recommends: qterminal | deepin-terminal | konsole | gnome-terminal | terminator | lxterminal | mate-terminal | terminology | xfce4-terminal | alacritty | cool-retro-term | kitty | sakura | termit | tilix +Recommends: qterminal | konsole | gnome-terminal | terminator | lxterminal | mate-terminal | terminology | xfce4-terminal | alacritty | cool-retro-term | kitty | sakura | termit | tilix Suggests: clang Description: A lightweight but powerful C/C++ IDE, built upon static Qt 5.15 diff --git a/packages/debian/control b/packages/debian/control index 4897c010..e24c5142 100644 --- a/packages/debian/control +++ b/packages/debian/control @@ -20,7 +20,7 @@ Depends: ${shlibs:Depends}, gdb, gdbserver, astyle -Recommends: qterminal | deepin-terminal | konsole | gnome-terminal | terminator | lxterminal | mate-terminal | terminology | xfce4-terminal | alacritty | cool-retro-term | kitty | sakura | termit | tilix +Recommends: qterminal | konsole | gnome-terminal | terminator | lxterminal | mate-terminal | terminology | xfce4-terminal | alacritty | cool-retro-term | kitty | sakura | termit | tilix Description: A lightweight but powerful C/C++ IDE Red Panda C++ (Old name Red Panda Dev-C++ 7) is a full featured C/C++ IDE. It's the succesor of Red Panda Dev-C++ 6, which is developed by Delphi 7 and