添加调整焦点快捷键
This commit is contained in:
@@ -6,3 +6,4 @@ 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 select_tag(const user_action_arg_t *arg);
|
void select_tag(const user_action_arg_t *arg);
|
||||||
void kill_client(const user_action_arg_t *arg);
|
void kill_client(const user_action_arg_t *arg);
|
||||||
|
void focus_stack(const user_action_arg_t *arg);
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ const keybinding_t keys[] = {
|
|||||||
{SUPER | SHIFT, XK_q, quit, {.b = false}},
|
{SUPER | SHIFT, XK_q, quit, {.b = false}},
|
||||||
{SUPER | CTRL, XK_r, quit, {.b = true}},
|
{SUPER | CTRL, XK_r, quit, {.b = true}},
|
||||||
{SUPER | SHIFT, XK_c, kill_client, {0}},
|
{SUPER | SHIFT, XK_c, kill_client, {0}},
|
||||||
|
{ALT, XK_j, focus_stack, {.b = true}},
|
||||||
|
{ALT, XK_k, focus_stack, {.b = false}},
|
||||||
{SUPER, XK_1, select_tag, {.ui = 0}},
|
{SUPER, XK_1, select_tag, {.ui = 0}},
|
||||||
{SUPER, XK_2, select_tag, {.ui = 1}},
|
{SUPER, XK_2, select_tag, {.ui = 1}},
|
||||||
{SUPER, XK_3, select_tag, {.ui = 2}},
|
{SUPER, XK_3, select_tag, {.ui = 2}},
|
||||||
|
|||||||
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) {
|
static void print_monitor_list_info(monitor_t *monitor_list) {
|
||||||
logger("========================= monitor info =========================\n");
|
logger("========================= monitor info =========================\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user