- `shift left|right|up|down` — Exchange the current window with the given neighbor.
-- `swap [biggest|smallest]` — Swap the focused window with the biggest/smallest window or with the last focused window if no arguments are given.
+- `swap` — Swap the focused window the last focused window.
- `push left|right|up|down` — Push the fence located in the given direction.
- `nearest older|newer [--skip-floating|--skip-tiled|--skip-class-equal|--skip-class-differ]` — Focus the nearest window matching the given constraints.
+- `biggest` — Return the ID of the biggest tiled window.
+
- `circulate forward|backward` — Circulate the leaves in the given direction.
- `grab_pointer focus|move|resize_side|resize_corner` — Begin the specified pointer action.
_bspc()
{
- local messages='get set list list_desktops list_monitors list_windows list_rules list_history presel cancel ratio pad focus shift swap push pull cycle nearest circulate grab_pointer track_pointer ungrab_pointer toggle_fullscreen toggle_floating toggle_locked toggle_visibility close kill send_to drop_to send_to_monitor drop_to_monitor use use_monitor alternate alternate_desktop alternate_monitor add add_in rename_monitor rename cycle_monitor cycle_desktop layout cycle_layout rotate flip balance rule remove_rule put_status adopt_orphans restore_layout restore_history quit'
+ local messages='get set list list_desktops list_monitors list_windows list_rules list_history presel cancel ratio pad focus shift swap push pull cycle nearest biggest circulate grab_pointer track_pointer ungrab_pointer toggle_fullscreen toggle_floating toggle_locked toggle_visibility close kill send_to drop_to send_to_monitor drop_to_monitor use use_monitor alternate alternate_desktop alternate_monitor add add_in rename_monitor rename cycle_monitor cycle_desktop layout cycle_layout rotate flip balance rule remove_rule put_status adopt_orphans restore_layout restore_history quit'
local settings='focused_border_color active_border_color normal_border_color presel_border_color focused_locked_border_color active_locked_border_color normal_locked_border_color urgent_border_color border_width window_gap split_ratio top_padding right_padding bottom_padding left_padding wm_name borderless_monocle gapless_monocle focus_follows_pointer adaptative_raise apply_shadow_property auto_alternate focus_by_distance'
.BI shift " left|right|up|down"
Exchange the current window with the given neighbor.
.TP
-.BI swap " [biggest|smallest]"
-Swap the focused window with the biggest/smallest window or with the last focused window if no arguments are given.
+.BI swap
+Swap the focused window with the last focused window.
.TP
.BI push " left|right|up|down"
Push the fence located in the given direction.
.BI nearest " older|newer [--skip-floating|--skip-tiled|--skip-class-equal|--skip-class-differ]"
Focus the nearest window matching the given constraints.
.TP
+.BI biggest
+Return the ID of the biggest tiled window.
+.TP
.BI circulate " forward|backward"
Circulate the leaves in the given direction.
.TP
}
}
return;
+ } else if (strcmp(cmd, "biggest") == 0) {
+ node_t *n = find_biggest(mon->desk);
+ if (n != NULL)
+ snprintf(rsp, BUFSIZ, "0x%X", n->client->window);
} else if (strcmp(cmd, "circulate") == 0) {
if (mon->desk->layout == LAYOUT_MONOCLE
|| (mon->desk->focus != NULL && !is_tiled(mon->desk->focus->client)))
remove_rule_by_uid(uid);
return;
} else if (strcmp(cmd, "swap") == 0) {
- char *arg;
- swap_arg_t a;
- if ((arg = strtok(NULL, TOK_SEP)) != NULL) {
- if (parse_swap_argument(arg, &a)) {
- node_t *n = find_by_area(mon->desk, a);
- swap_nodes(mon->desk->focus, n);
- }
- } else {
- swap_nodes(mon->desk->focus, history_get(mon->desk->history, 1));
- }
+ swap_nodes(mon->desk->focus, history_get(mon->desk->history, 1));
} else if (strcmp(cmd, "alternate") == 0) {
focus_node(mon, mon->desk, history_get(mon->desk->history, 1));
return;
return false;
}
-bool parse_swap_argument(char *s, swap_arg_t *a)
-{
- if (strcmp(s, "biggest") == 0) {
- *a = SWAP_BIGGEST;
- return true;
- } else if (strcmp(s, "smallest") == 0) {
- *a = SWAP_SMALLEST;
- return true;
- }
- return false;
-}
-
bool parse_cycle_direction(char *s, cycle_dir_t *d)
{
if (strcmp(s, "prev") == 0) {
bool parse_layout(char *, layout_t *);
bool parse_direction(char *, direction_t *);
bool parse_nearest_argument(char *, nearest_arg_t *);
-bool parse_swap_argument(char *, swap_arg_t *);
bool parse_cycle_direction(char *, cycle_dir_t *);
bool parse_circulate_direction(char *, circulate_dir_t *);
bool parse_list_option(char *, list_option_t *);
return NULL;
}
-void get_opposite(direction_t dir, direction_t* val)
+void get_opposite(direction_t src, direction_t* dst)
{
- switch (dir) {
+ switch (src) {
case DIR_RIGHT:
- *val = DIR_LEFT;
+ *dst = DIR_LEFT;
break;
case DIR_DOWN:
- *val = DIR_UP;
+ *dst = DIR_UP;
break;
case DIR_LEFT:
- *val = DIR_RIGHT;
+ *dst = DIR_RIGHT;
break;
case DIR_UP:
- *val = DIR_DOWN;
+ *dst = DIR_DOWN;
break;
}
}
return rect.width * rect.height;
}
-node_t *find_by_area(desktop_t *d, swap_arg_t a)
+node_t *find_biggest(desktop_t *d)
{
if (d == NULL)
return NULL;
if (r == NULL) {
r = f;
r_area = f_area;
- } else if ((a == SWAP_BIGGEST && f_area > r_area)
- || (a == SWAP_SMALLEST && f_area < r_area)) {
+ } else if (f_area > r_area) {
r = f;
r_area = f_area;
}
void get_opposite(direction_t, direction_t*);
node_t *nearest_neighbor(desktop_t *, node_t *, direction_t);
int tiled_area(node_t *);
-node_t *find_by_area(desktop_t *, swap_arg_t);
+node_t *find_biggest(desktop_t *);
void move_fence(node_t *, direction_t, fence_move_t);
void rotate_tree(node_t *, rotate_t);
void rotate_brother(node_t *);
NEAREST_NEWER
} nearest_arg_t;
-typedef enum {
- SWAP_BIGGEST,
- SWAP_SMALLEST
-} swap_arg_t;
-
typedef enum {
CIRCULATE_FORWARD,
CIRCULATE_BACKWARD