mirror of
https://github.com/vale981/bspwm
synced 2025-03-04 17:31:39 -05:00
New options for swap: --{keep,swap}-focus
This commit is contained in:
parent
eafc112ca2
commit
896e220e48
5 changed files with 26 additions and 3 deletions
|
@ -101,7 +101,7 @@ The following messages are handled:
|
|||
|
||||
- `shift left|right|up|down` — Exchange the current window with the given neighbor.
|
||||
|
||||
- `swap` — Swap the focused window the last focused window.
|
||||
- `swap [--swap-focus|--keep-focus]` — Swap the focused window the last focused window.
|
||||
|
||||
- `push left|right|up|down` — Push the fence located in the given direction.
|
||||
|
||||
|
|
2
bspwm.1
2
bspwm.1
|
@ -133,7 +133,7 @@ Focus the neighbor window situated in the given direction.
|
|||
.BI shift " left|right|up|down"
|
||||
Exchange the current window with the given neighbor.
|
||||
.TP
|
||||
.BI swap
|
||||
.BI swap " [--swap-focus|--keep-focus]"
|
||||
Swap the focused window with the last focused window.
|
||||
.TP
|
||||
.BI push " left|right|up|down"
|
||||
|
|
19
messages.c
19
messages.c
|
@ -395,7 +395,12 @@ void process_message(char *msg, char *rsp)
|
|||
remove_rule_by_uid(uid);
|
||||
return;
|
||||
} else if (strcmp(cmd, "swap") == 0) {
|
||||
swap_nodes(mon->desk->focus, history_get(mon->desk->history, 1));
|
||||
node_t *last_focus = history_get(mon->desk->history, 1);
|
||||
swap_nodes(mon->desk->focus, last_focus);
|
||||
char *opt = strtok(NULL, TOK_SEP);
|
||||
swap_option_t o;
|
||||
if (parse_swap_option(opt, &o) && o == SWAP_OPTION_SWAP_FOCUS)
|
||||
focus_node(mon, mon->desk, last_focus);
|
||||
} else if (strcmp(cmd, "alternate") == 0) {
|
||||
focus_node(mon, mon->desk, history_get(mon->desk->history, 1));
|
||||
return;
|
||||
|
@ -753,6 +758,18 @@ bool parse_send_option(char *s, send_option_t *o)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool parse_swap_option(char *s, swap_option_t *o)
|
||||
{
|
||||
if (s == NULL || strcmp(s, "--swap-focus") == 0) {
|
||||
*o = SWAP_OPTION_SWAP_FOCUS;
|
||||
return true;
|
||||
} else if (strcmp(s, "--keep-focus") == 0) {
|
||||
*o = SWAP_OPTION_KEEP_FOCUS;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool parse_rotate(char *s, rotate_t *r)
|
||||
{
|
||||
if (strcmp(s, "clockwise") == 0) {
|
||||
|
|
|
@ -16,6 +16,7 @@ bool parse_cycle_direction(char *, cycle_dir_t *);
|
|||
bool parse_circulate_direction(char *, circulate_dir_t *);
|
||||
bool parse_list_option(char *, list_option_t *);
|
||||
bool parse_send_option(char *, send_option_t *);
|
||||
bool parse_swap_option(char *, swap_option_t *);
|
||||
bool parse_skip_client(char *, skip_client_t *);
|
||||
bool parse_skip_desktop(char *, skip_desktop_t *);
|
||||
bool parse_rotate(char *, rotate_t *);
|
||||
|
|
5
types.h
5
types.h
|
@ -46,6 +46,11 @@ typedef enum {
|
|||
SEND_OPTION_DONT_FOLLOW
|
||||
} send_option_t;
|
||||
|
||||
typedef enum {
|
||||
SWAP_OPTION_KEEP_FOCUS,
|
||||
SWAP_OPTION_SWAP_FOCUS
|
||||
} swap_option_t;
|
||||
|
||||
typedef enum {
|
||||
CLIENT_SKIP_NONE,
|
||||
CLIENT_SKIP_FLOATING,
|
||||
|
|
Loading…
Add table
Reference in a new issue