如何按特定顺序自动启动程序?
How to automatically start programs in a specific order?
我的 i3 配置文件中有这些行:
# Startup applications.
exec firefox
exec gnome-terminal
exec nautilus
这些行按预期启动 firefox、gnome-terminal 和 nautilus,但它们启动的顺序不可预测。有没有一种方法可以让 windows 以我想要的顺序出现? (即 firefox,然后是 gnome-terminal,然后是 nautilus)。
您可以 save layouts 以便每个应用程序都被预定义的 window 容器捕获。让它真正自动化需要一些额外的脚本。我的配置示例:
i3 配置
assign [class="^Vivaldi-stable$"] 1
assign [class="^Keepassx2$"] 2
assign [class="^Thunderbird$"] 2
....
# last line
exec ~/.config/i3/restore.sh &
restore.sh
#!/bin/sh
for layout in ~/.config/i3/layouts/*; do
i3-msg "workspace $(basename "$layout" .json); append_layout $layout"
done
(vivaldi-stable &)
(keepassxc &)
(thunderbird &)
如果你想看完整版,我的点文件是on GitHub。
将此添加到 i3 配置文件中:
# Create specific layout for applications.
exec --no-startup-id "i3-msg 'workspace 1; append_layout ~/.config/i3/workspace-1.json'"
# Start applications.
exec firefox
exec gnome-terminal
创建 ~/.config/i3/workspace-1.json
:
// Layout of a workspace.
{
"layout": "tabbed",
// To get a window's class name, run xprop and click on the window.
// You will see the following output:
// WM_CLASS(STRING) = "InstanceName", "ClassName"
// Alternatively, "swallow" by the window's title.
"nodes": [
{"swallows": [{"class": "^Firefox$"}]},
{"swallows": [{"class": "^Gnome-terminal$"}]}
]
}
我的 i3 配置文件中有这些行:
# Startup applications.
exec firefox
exec gnome-terminal
exec nautilus
这些行按预期启动 firefox、gnome-terminal 和 nautilus,但它们启动的顺序不可预测。有没有一种方法可以让 windows 以我想要的顺序出现? (即 firefox,然后是 gnome-terminal,然后是 nautilus)。
您可以 save layouts 以便每个应用程序都被预定义的 window 容器捕获。让它真正自动化需要一些额外的脚本。我的配置示例:
i3 配置
assign [class="^Vivaldi-stable$"] 1
assign [class="^Keepassx2$"] 2
assign [class="^Thunderbird$"] 2
....
# last line
exec ~/.config/i3/restore.sh &
restore.sh
#!/bin/sh
for layout in ~/.config/i3/layouts/*; do
i3-msg "workspace $(basename "$layout" .json); append_layout $layout"
done
(vivaldi-stable &)
(keepassxc &)
(thunderbird &)
如果你想看完整版,我的点文件是on GitHub。
将此添加到 i3 配置文件中:
# Create specific layout for applications.
exec --no-startup-id "i3-msg 'workspace 1; append_layout ~/.config/i3/workspace-1.json'"
# Start applications.
exec firefox
exec gnome-terminal
创建 ~/.config/i3/workspace-1.json
:
// Layout of a workspace.
{
"layout": "tabbed",
// To get a window's class name, run xprop and click on the window.
// You will see the following output:
// WM_CLASS(STRING) = "InstanceName", "ClassName"
// Alternatively, "swallow" by the window's title.
"nodes": [
{"swallows": [{"class": "^Firefox$"}]},
{"swallows": [{"class": "^Gnome-terminal$"}]}
]
}