如何在最小化的 Gnome 终端中启动脚本?

lof*_*ops 5 command-line gnome-terminal launcher nohup minimize

我可以在新的 Gnome 终端中启动一个命令,如下所示:

nohup gnome-terminal --window-with-profile=Background --command ls >/dev/null 2>&1&
Run Code Online (Sandbox Code Playgroud)

(基于https://askubuntu.com/a/46630/7146/sf/answers/749582851/

但是,我希望新的终端窗口在启动器中最小化。我怎样才能做到这一点?

lof*_*ops 1

我的解决方案基于针对最小化最大化窗口给出的一些答案。不过,在这种情况下,我只想定位这个 Gnome 终端(而不是其他 Gnome 终端),所以我使用以下命令给它命名--title

nohup gnome-terminal --title="Tiny Terminal" --window-with-profile=Background --command "$argv" >/dev/null 2>&1&
Run Code Online (Sandbox Code Playgroud)

并为名为“Tiny Terminal”的窗口创建了一个 Devil's Pie 规则:

(if
(is (window_name) "Tiny Terminal")
(begin (minimize) )
)
Run Code Online (Sandbox Code Playgroud)

(如果您愿意,可以使用 gdevilspie 在 GUI 中创建此规则。)

这样就达到了最初想要的效果。然而,当我尝试时,我意识到我还希望终端恢复到最大化状态,这在单独的答案中得到解决