Simplify autostarting apps (#283)

This commit is contained in:
Lin Xianyi 2023-08-03 00:28:58 +08:00 committed by GitHub
parent a588bcea30
commit accd8fa14f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -145,42 +145,19 @@ Waybar has a set of caveats or settings that you need to be aware of. See
# How do I autostart my favorite apps? # How do I autostart my favorite apps?
Using the window rules to assign apps to workspace you can setup a session start Using the window rules to assign apps to workspace you can open a bunch of
script to open a bunch of applications on various workspaces. The following applications on various workspaces. The following method will start these apps
method will start these apps silently (i.e. without the flickering from silently (i.e. without the flickering from workspace to workspace).
workspace to workspace) and deassign the rule so that subsequent start of this
app will not start it on the initially assigned workspace (which could be a drag
if e.g. you want kitty to be started on ws 1 while you need kitty to open on any
workspace subsequently).
Put the following in your `hyprland.conf`: (example) Put the following in your `hyprland.conf`: (example)
```ini ```ini
windowrule=workspace 1 silent,kitty exec-once=[workspace 1 silent] kitty
windowrule=workspace 1 silent,Subl exec-once=[workspace 1 silent] subl
windowrule=workspace 3 silent,Mailspring exec-once=[workspace 3 silent] mailspring
windowrule=workspace 4 silent,firefox exec-once=[workspace 4 silent] firefox
[...]
exec-once=kitty
exec-once=subl
exec-once=mailspring
exec-once=firefox
[...]
exec-once=cleanup_after_start.sh
``` ```
where `cleanup_after_start.sh` script contains:
```bash
sleep 10
hyprctl keyword windowrule "workspace unset,kitty"
hyprctl keyword windowrule "workspace unset,Subl"
hyprctl keyword windowrule "workspace unset,Mailspring"
hyprctl keyword windowrule "workspace unset,firefox"
```
in `sleep 10`, the 10 seconds is of course only a suggestion.
# How do I move my favorite workspaces to a new monitor when I plug it in? # How do I move my favorite workspaces to a new monitor when I plug it in?
if you want workspaces to automatically go to a monitor upon connection, use the if you want workspaces to automatically go to a monitor upon connection, use the