添加点击切换 tag 功能

This commit is contained in:
2025-11-21 00:39:05 +08:00
parent 6814e5e1f1
commit 2aed03566c
5 changed files with 91 additions and 0 deletions

View File

@@ -41,6 +41,19 @@ uint32_t monitor_initialize_tag(monitor_t *monitor, const char **tags,
return tag_count;
}
void monitor_select_tag(monitor_t *monitor, uint32_t tag_mask) {
if (monitor->selected_tag->mask == tag_mask) return;
for (tag_t *tag = monitor->tag_list; tag; tag = tag->next) {
if (tag->mask == tag_mask) {
monitor->selected_tag = tag;
monitor_draw_bar(monitor);
xcb_flush(wm.xcb_conn);
break;
}
}
}
static void tag_clean(tag_t *tag) {
tag_t *next_tag = nullptr;
for (tag_t *t = tag; t; t = next_tag) {