添加调整焦点快捷键
This commit is contained in:
30
src/main.c
30
src/main.c
@@ -117,6 +117,36 @@ void kill_client(const user_action_arg_t *arg) {
|
||||
}
|
||||
}
|
||||
|
||||
void focus_stack(const user_action_arg_t *arg) {
|
||||
if (!current_monitor->selected_client) return;
|
||||
|
||||
bool forward = arg->b;
|
||||
client_t *client = NULL;
|
||||
if (forward) {
|
||||
for (client = current_monitor->selected_client->next;
|
||||
client && !CLIENT_VISIBLE(client); client = client->next);
|
||||
if (!client) {
|
||||
for (client = current_monitor->clients; client && !CLIENT_VISIBLE(client);
|
||||
client = client->next);
|
||||
}
|
||||
} else {
|
||||
client_t *c = NULL;
|
||||
for (c = current_monitor->clients; c != current_monitor->selected_client;
|
||||
c = c->next) {
|
||||
if (CLIENT_VISIBLE(c)) client = c;
|
||||
}
|
||||
if (!client) {
|
||||
for (; c; c = c->next) {
|
||||
if (CLIENT_VISIBLE(c)) client = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (client) {
|
||||
focus(client);
|
||||
restack(current_monitor);
|
||||
}
|
||||
}
|
||||
|
||||
/* 调试函数,开发完成后删除 */
|
||||
static void print_monitor_list_info(monitor_t *monitor_list) {
|
||||
logger("========================= monitor info =========================\n");
|
||||
|
||||
Reference in New Issue
Block a user