Implement a command to travel the focusstack. This can be used like a jumpback.
However, it is a bit more flexible obviously. You can specify the offset of the window you want to go to, to implement workflows like the following: * Jump to mutt * Jump to irssi * Jump back ("focus 2" would be the command)
This commit is contained in:
35
CMDMODE
35
CMDMODE
@ -1,3 +1,9 @@
|
|||||||
|
---------------------
|
||||||
|
- Command mode
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
This is the grammar for the command mode (your configuration file uses these commands, too).
|
||||||
|
|
||||||
left := <h> | <cursor-left>
|
left := <h> | <cursor-left>
|
||||||
right := <l> | <cursor-right>
|
right := <l> | <cursor-right>
|
||||||
up := <j> | <cursor-up>
|
up := <j> | <cursor-up>
|
||||||
@ -7,34 +13,29 @@ where := <left|right|up|down> | <tag>
|
|||||||
move := <m>
|
move := <m>
|
||||||
snap := <s>
|
snap := <s>
|
||||||
|
|
||||||
Eingabe ist entweder
|
|
||||||
|
|
||||||
cmd := [ <times> ] [ <move> | <snap> ] <where>
|
cmd := [ <times> ] [ <move> | <snap> ] <where>
|
||||||
|
|
||||||
oder
|
|
||||||
|
|
||||||
with := <w> { [ <times> ] <where> }+ <space> <cmd>
|
with := <w> { [ <times> ] <where> }+ <space> <cmd>
|
||||||
|
|
||||||
oder
|
|
||||||
|
|
||||||
jump := [ "<window class>[/<window title>]" | <workspace> [ <column> <row> ] ]
|
jump := [ "<window class>[/<window title>]" | <workspace> [ <column> <row> ] ]
|
||||||
|
focus := focus [ <times> ]
|
||||||
oder
|
(travels the focus stack backwards the given amount of times (by default 1), so
|
||||||
|
it selects the window which had the focus before you focused the current one when
|
||||||
|
specifying "focus 1")
|
||||||
special := [ exec <path> | kill | exit | restart ]
|
special := [ exec <path> | kill | exit | restart ]
|
||||||
|
|
||||||
an jeder Stelle kann mit escape abgebrochen werden
|
input := [ <cmd> | <with> | <jump> | <focus> | <special> ]
|
||||||
|
|
||||||
Beispiele:
|
you can cancel command mode by pressing escape anytime.
|
||||||
|
|
||||||
Fenster links neben dem aktuellen auswählen:
|
Some examples:
|
||||||
|
|
||||||
|
Select the window on the left:
|
||||||
h
|
h
|
||||||
|
|
||||||
Fenster zwei links neben dem aktuellen auswählen:
|
Select the window two places on the left:
|
||||||
2h
|
2h
|
||||||
|
|
||||||
Fenster nach rechts verschieben:
|
Move window to the right:
|
||||||
ml
|
ml
|
||||||
|
|
||||||
Fenster und Fenster untendrunter nach rechts verschieben:
|
Move window and window on the bottom to the right:
|
||||||
wk ml
|
wk ml
|
||||||
|
@ -648,13 +648,14 @@ static void jump_to_window(xcb_connection_t *conn, const char *arguments) {
|
|||||||
|
|
||||||
CIRCLEQ_FOREACH(client, &(con->clients), clients) {
|
CIRCLEQ_FOREACH(client, &(con->clients), clients) {
|
||||||
LOG("Checking client with class=%s, name=%s\n", client->window_class, client->name);
|
LOG("Checking client with class=%s, name=%s\n", client->window_class, client->name);
|
||||||
if (client_matches_class_name(client, to_class, to_title, to_title_ucs, to_title_ucs_len)) {
|
if (!client_matches_class_name(client, to_class, to_title, to_title_ucs, to_title_ucs_len))
|
||||||
set_focus(conn, client);
|
continue;
|
||||||
|
|
||||||
|
set_focus(conn, client, true);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
free(to_class);
|
free(to_class);
|
||||||
@ -695,7 +696,37 @@ static void jump_to_container(xcb_connection_t *conn, const char *arguments) {
|
|||||||
|
|
||||||
LOG("Jumping to col %d, row %d\n", col, row);
|
LOG("Jumping to col %d, row %d\n", col, row);
|
||||||
if (c_ws->table[col][row]->currently_focused != NULL)
|
if (c_ws->table[col][row]->currently_focused != NULL)
|
||||||
set_focus(conn, c_ws->table[col][row]->currently_focused);
|
set_focus(conn, c_ws->table[col][row]->currently_focused, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Travels the focus stack by the given number of times (or once, if no argument
|
||||||
|
* was specified). That is, selects the window you were in before you focused
|
||||||
|
* the current window.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void travel_focus_stack(xcb_connection_t *conn, const char *arguments) {
|
||||||
|
/* Start count at -1 to always skip the first element */
|
||||||
|
int times, count = -1;
|
||||||
|
Client *current;
|
||||||
|
|
||||||
|
if (sscanf(arguments, "%u", ×) != 1) {
|
||||||
|
LOG("No or invalid argument given (\"%s\"), using default of 1 times\n", arguments);
|
||||||
|
times = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Workspace *ws = CUR_CELL->workspace;
|
||||||
|
|
||||||
|
SLIST_FOREACH(current, &(ws->focus_stack), focus_clients) {
|
||||||
|
if (++count < times) {
|
||||||
|
LOG("Skipping\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG("Focussing\n");
|
||||||
|
set_focus(conn, current, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -748,6 +779,13 @@ void parse_command(xcb_connection_t *conn, const char *command) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Should we travel the focus stack? */
|
||||||
|
if (STARTS_WITH(command, "focus")) {
|
||||||
|
const char *arguments = command + strlen("focus");
|
||||||
|
travel_focus_stack(conn, arguments);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Is it 'f' for fullscreen? */
|
/* Is it 'f' for fullscreen? */
|
||||||
if (command[0] == 'f') {
|
if (command[0] == 'f') {
|
||||||
if (CUR_CELL->currently_focused == NULL)
|
if (CUR_CELL->currently_focused == NULL)
|
||||||
|
@ -837,7 +837,7 @@ int handle_windowclass_change(void *data, xcb_connection_t *conn, uint8_t state,
|
|||||||
LOG("prop == NULL\n");
|
LOG("prop == NULL\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Client *client = table_get(byChild, window);
|
Client *client = table_get(&by_child, window);
|
||||||
if (client == NULL)
|
if (client == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
char *new_class;
|
char *new_class;
|
||||||
|
Reference in New Issue
Block a user