feat: atstartup rule that only applies within 60s of startup

This commit is contained in:
Lin Xianyi 2026-02-11 10:17:58 +08:00
parent 1fc89d01eb
commit b1cf48fb81
2 changed files with 13 additions and 1 deletions

View file

@ -813,6 +813,7 @@ static void pre_caculate_before_arrange(Monitor *m, bool want_animation,
/* variables */
static const char broken[] = "broken";
static pid_t child_pid = -1;
static uint32_t startup_time;
static int32_t locked;
static uint32_t locked_mods = 0;
static void *exclusive_focus;
@ -1432,10 +1433,14 @@ void applyrules(Client *c) {
if (!is_window_rule_matches(r, appid, title))
continue;
// rule is after 60s of startup, do not apply
if (r->atstartup && get_now_in_ms() - startup_time > 60 * 1000)
continue;
// set general properties
apply_rule_properties(c, r);
// // set tags
// set tags
if (r->tags > 0) {
newtags |= r->tags;
} else if (parent) {
@ -5757,6 +5762,9 @@ void setup(void) {
}
sync_keymap = wl_event_loop_add_timer(wl_display_get_event_loop(dpy),
synckeymap, NULL);
// store the startup time for at-startup rules to check against
startup_time = get_now_in_ms();
#endif
}