![如何从 i3 保存的布局自动启动多个 gnome 终端应用程序?](https://linux22.com/image/113473/%E5%A6%82%E4%BD%95%E4%BB%8E%20i3%20%E4%BF%9D%E5%AD%98%E7%9A%84%E5%B8%83%E5%B1%80%E8%87%AA%E5%8A%A8%E5%90%AF%E5%8A%A8%E5%A4%9A%E4%B8%AA%20gnome%20%E7%BB%88%E7%AB%AF%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%EF%BC%9F.png)
我已读过这个链接这与我遇到的问题几乎完全相同。
该解决方案提供了简单的链接文档i3 的布局保存功能。我发现有关恢复布局的部分有点模糊并且没有太大帮助。
我的配置文件末尾有以下内容:
# restoring layouts
exec --no-startup-id i3-msg "workspace 3; append_layout /home/spanishgum/.config/i3/ws3.json"
# setting applications for layouts
exec --no-startup-id i3-msg "workspace 3; exec gnome-terminal -e 'tty-clock -s -b -c 6 -C -f %F'"
exec --no-startup-id i3-msg "workspace 3; exec gnome-terminal -e 'newsbeuter -u /home/spanishgum/.rssfeeds'"
exec --no-startup-id i3-msg "workspace 3; exec gnome-terminal -e 'htop'"
这是我保存的布局/home/spanishgum/.config/i3/ws3.json
:
// vim:ts=4:sw=4:et
{
"border": "pixel",
"current_border_width": 0,
"floating": "auto_off",
"geometry": {
"height": 1043,
"width": 1272,
"x": 0,
"y": 0
},
"name": "Terminal",
"percent": 0.5,
"swallows": [
{
"class": "^Gnome\\-terminal$",
"instance": "^gnome\\-terminal\\-server$",
"title": "^Terminal$",
"transient_for": "^$",
"window_role": "^gnome\\-terminal\\-window\\-ebb34c69\\-83f4\\-4caf\\-8410\\-8625e29d63ec$"
}
],
"type": "con"
}
{
// splitv split container with 2 children
"border": "normal",
"floating": "auto_off",
"layout": "splitv",
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 0,
"floating": "auto_off",
"geometry": {
"height": 1043,
"width": 1272,
"x": 0,
"y": 0
},
"name": "Terminal",
"percent": 0.5,
"swallows": [
{
"class": "^Gnome\\-terminal$",
"instance": "^gnome\\-terminal\\-server$",
"title": "^Terminal$",
"transient_for": "^$",
"window_role": "^gnome\\-terminal\\-window\\-da79755c\\-fdbf\\-47fc\\-b776\\-3afece7da1a6$"
}
],
"type": "con"
},
{
"border": "pixel",
"current_border_width": 0,
"floating": "auto_off",
"geometry": {
"height": 1043,
"width": 1272,
"x": 0,
"y": 0
},
"name": "Terminal",
"percent": 0.5,
"swallows": [
{
"class": "^Gnome\\-terminal$",
"instance": "^gnome\\-terminal\\-server$",
"title": "^Terminal$",
"transient_for": "^$",
"window_role": "^gnome\\-terminal\\-window\\-4b04543e\\-b298\\-45af\\-8042\\-b5f8b123dcc3$"
}
],
"type": "con"
}
]
}
当我登录时,我会看到 6 个窗口。布局中的 3 个以正确的配置加载,但启动应用程序在同一工作区中生成自己的窗口。 (我现在有 6 个窗口,其中 3 个是空的,等待应用程序来填充它们)。
我不知道如何编写执行命令以使其链接到这些窗口。
文档示例说,如果希望在布局窗口中启动 emacs,则必须使用exec emacs --name some_name
窗口实例的名称。我不知道如何使用--name
gnome-terminal,因此当我创建布局时,所有实例都具有相同的名称。
我还需要使用另一种钩子吗?