feat: 添加 focus_next_monitor 操作用于切换当前 monitor

This commit is contained in:
2026-03-08 04:07:49 +08:00
parent 9fbd7f45e9
commit ac4cfc1ed3
3 changed files with 12 additions and 0 deletions

View File

@@ -43,6 +43,16 @@ void send_client_to_next_monitor(const user_action_arg_t *arg) {
client_send_to_monitor(wm.client_focused, next_monitor); client_send_to_monitor(wm.client_focused, next_monitor);
} }
void focus_next_monitor(const user_action_arg_t *arg) {
monitor_t *next_monitor = wm_get_next_monitor(wm.current_monitor);
if (next_monitor == wm.current_monitor) return;
wm_set_current_monitor(next_monitor, true);
if (wm.current_monitor->selected_tag->task_list) {
monitor_deal_focus(wm.current_monitor);
}
}
void spawn(const user_action_arg_t *arg) { void spawn(const user_action_arg_t *arg) {
const char *cmd = (const char *)arg->ptr; const char *cmd = (const char *)arg->ptr;
if (cmd == nullptr || strlen(cmd) == 0) return; if (cmd == nullptr || strlen(cmd) == 0) return;

View File

@@ -53,6 +53,7 @@ void focus_client_in_same_tag(const user_action_arg_t *arg);
void select_tag_of_current_monitor(const user_action_arg_t *arg); void select_tag_of_current_monitor(const user_action_arg_t *arg);
void send_client_to_tag(const user_action_arg_t *arg); void send_client_to_tag(const user_action_arg_t *arg);
void send_client_to_next_monitor(const user_action_arg_t *arg); void send_client_to_next_monitor(const user_action_arg_t *arg);
void focus_next_monitor(const user_action_arg_t *arg);
void spawn(const user_action_arg_t *arg); void spawn(const user_action_arg_t *arg);
void quit(const user_action_arg_t *arg); void quit(const user_action_arg_t *arg);
void raise_or_run(const user_action_arg_t *arg); void raise_or_run(const user_action_arg_t *arg);

View File

@@ -103,6 +103,7 @@ static const keyboard_t key_list[] = {
{modifier_super, XK_o, send_client_to_next_monitor, {0}}, {modifier_super, XK_o, send_client_to_next_monitor, {0}},
{modifier_super | modifier_control, XK_j, focus_next_monitor, {0}},
{modifier_super | modifier_control, XK_space, toggle_client_floating, {0}}, {modifier_super | modifier_control, XK_space, toggle_client_floating, {0}},
{modifier_super, XK_f, toggle_client_fullscreen, {0}}, {modifier_super, XK_f, toggle_client_fullscreen, {0}},
{modifier_super, XK_m, toggle_client_maximize, {0}}, {modifier_super, XK_m, toggle_client_maximize, {0}},