处理 EWMH 扩展的 _NET_ACTIVE_WINDOW 协议

This commit is contained in:
2025-09-01 17:55:20 +08:00
parent 645083d3a7
commit 0c361a6593
3 changed files with 20 additions and 0 deletions

View File

@@ -909,6 +909,24 @@ void client_message(client_message_event_t *event) {
bool toggle_to_fullscreen = event->data.data32[0] == 2 && !c->fullscreen;
set_client_fullscreen(c, set_fullscreen || toggle_to_fullscreen);
}
} else if (event->message_type == get_xcb_atom(atom_net_active_window)) {
client_t *client = get_client_of_window(event->window);
if (client) {
logger("==== _NET_ACTIVE_WINDOW\n");
print_client(client);
uint32_t tag_mask = 0;
for (uint32_t i = 0; i < g_strv_length(client->monitor->tags); i++) {
tag_mask |= 1 << i;
}
uint32_t target_tag = tag_mask & client->tags;
const user_action_arg_t arg = {.ui = target_tag};
current_monitor = client->monitor;
select_tag(&arg);
focus(client);
restack(current_monitor);
}
}
}