如何将终端标题传递到通过桌面快捷方式(.desktop)打开的终端?

有没有办法将标题设置为通过桌面快捷方式打开的终端?

如果[Desktop Entry] Name = myTitle可以显示在标题中,那么完美的解决方案就是如此。 有谁知道这是否可能?

另请参阅(这里的方法不起作用): 另一个用户的终端应用程序的桌面快捷方式可能吗?

基于此: 不能再在Ubuntu 16(gnome-terminal)中设置终端标题

根据我之前的答案 ,我能想到的最简单的解决方案是使用命令生成终端,设置title + spawns交互式shell。 具体来说,我会将.desktop文件的Exec=部分设为:

 Exec=gnome-terminal -e "bash -c 'printf \"\033]0;TEST1\007\";bash'" 

使用

 Exec=gnome-terminal -t myTitle -e myCommand ... 

在您的桌面文件中。 另请参阅gnome-terminal帮助输出:

 $ gnome-terminal --help-terminal-options Usage: gnome-terminal [OPTION…] [-- COMMAND …] Terminal options; if used before the first --window or --tab argument, sets the default for all terminals: -e, --command Execute the argument to this option inside the terminal --profile=PROFILE-NAME Use the given profile instead of the default profile -t, --title=TITLE Set the initial terminal title --working-directory=DIRNAME Set the working directory --wait Wait until the child exits --fd=FD Forward file descriptor --zoom=ZOOM Set the terminal's zoom factor (1.0 = normal size)