切换 client 所在 monitor

This commit is contained in:
2026-01-07 12:12:56 +08:00
parent 2902c994ba
commit 6b49045ee9
4 changed files with 43 additions and 0 deletions

View File

@@ -33,6 +33,25 @@ void send_client_to_tag(const user_action_arg_t *arg) {
if (wm.client_focused) client_send_to_tag(wm.client_focused, arg->ui);
}
void send_client_to_next_monitor(const user_action_arg_t *arg) {
if (!wm.client_focused) return;
monitor_t *current_monitor = wm.client_focused->monitor;
monitor_t *next_monitor = current_monitor->next;
if (next_monitor == nullptr) {
next_monitor = wm.monitor_list;
} else {
for (monitor_t *m = wm.monitor_list; m && m->next != current_monitor;
m = m->next) {
next_monitor = m;
}
}
if (current_monitor != next_monitor) {
client_send_to_monitor(wm.client_focused, next_monitor);
}
}
void spawn(const user_action_arg_t *arg) {
const char *cmd = (const char *)arg->ptr;
if (cmd == nullptr || strlen(cmd) == 0) return;