Added in scratchpad adding

This commit is contained in:
Luminarys 2015-08-28 23:39:12 -05:00
parent 70c238ef66
commit 7eefecf479
3 changed files with 28 additions and 1 deletions

View file

@ -8,6 +8,8 @@
extern swayc_t root_container; extern swayc_t root_container;
extern list_t *scratchpad;
extern int min_sane_w; extern int min_sane_w;
extern int min_sane_h; extern int min_sane_h;

View file

@ -344,7 +344,7 @@ static bool cmd_focus_follows_mouse(struct sway_config *config, int argc, char *
} }
static bool cmd_move(struct sway_config *config, int argc, char **argv) { static bool cmd_move(struct sway_config *config, int argc, char **argv) {
if (!checkarg(argc, "workspace", EXPECTED_AT_LEAST, 1)) { if (!checkarg(argc, "move", EXPECTED_AT_LEAST, 1)) {
return false; return false;
} }
@ -381,6 +381,28 @@ static bool cmd_move(struct sway_config *config, int argc, char **argv) {
ws = workspace_create(ws_name); ws = workspace_create(ws_name);
} }
move_container_to(view, get_focused_container(ws)); move_container_to(view, get_focused_container(ws));
} else if (strcasecmp(argv[0], "scratchpad") == 0) {
int i;
swayc_t *view = get_focused_container(&root_container);
list_add(scratchpad, view);
if (view->is_floating) {
for (i = 0; i < view->parent->floating; i++) {
if (view->parent->floating->items[i] == view) {
list_del(view->parent->floating, i);
break;
}
}
wlc_view_set_mask(view->handle, 0);
} else {
for (i = 0; i < view->parent->children) {
if (view->parent->children->items[i] == view) {
list_del(view->parent->children, i);
break;
}
}
wlc_view_set_mask(view->handle, 0);
}
arrange_windows(&root_container, -1, -1);
} else { } else {
return false; return false;
} }
@ -742,6 +764,7 @@ static struct cmd_handler handlers[] = {
{ "output", cmd_output}, { "output", cmd_output},
{ "reload", cmd_reload }, { "reload", cmd_reload },
{ "resize", cmd_resize }, { "resize", cmd_resize },
{ "scratchpad", cmd_scratchpad },
{ "set", cmd_set }, { "set", cmd_set },
{ "split", cmd_split }, { "split", cmd_split },
{ "splith", cmd_splith }, { "splith", cmd_splith },

View file

@ -10,6 +10,7 @@
#include "focus.h" #include "focus.h"
swayc_t root_container; swayc_t root_container;
list_t *scratchpad;
int min_sane_h = 60; int min_sane_h = 60;
int min_sane_w = 100; int min_sane_w = 100;
@ -20,6 +21,7 @@ void init_layout(void) {
root_container.children = create_list(); root_container.children = create_list();
root_container.handle = -1; root_container.handle = -1;
root_container.visible = true; root_container.visible = true;
scratchpad = create_list();
} }
int index_child(const swayc_t *child) { int index_child(const swayc_t *child) {