aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuminarys <kizunanohikari@gmail.com>2015-08-28 23:39:12 -0500
committerLuminarys <kizunanohikari@gmail.com>2015-08-28 23:39:12 -0500
commit7eefecf4790bd0daf5c5727766c904c8c55dc6ee (patch)
tree2b65e4162d599e2bc2c0a706678f19b4b1c2fd14
parent70c238ef663c9e3b11046e6d7b20fa7385e4c708 (diff)
downloadsway-7eefecf4790bd0daf5c5727766c904c8c55dc6ee.tar.xz
Added in scratchpad adding
-rw-r--r--include/layout.h2
-rw-r--r--sway/commands.c25
-rw-r--r--sway/layout.c2
3 files changed, 28 insertions, 1 deletions
diff --git a/include/layout.h b/include/layout.h
index f462bdb3..cb38a7b1 100644
--- a/include/layout.h
+++ b/include/layout.h
@@ -8,6 +8,8 @@
extern swayc_t root_container;
+extern list_t *scratchpad;
+
extern int min_sane_w;
extern int min_sane_h;
diff --git a/sway/commands.c b/sway/commands.c
index 8a790384..55159a43 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -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) {
- if (!checkarg(argc, "workspace", EXPECTED_AT_LEAST, 1)) {
+ if (!checkarg(argc, "move", EXPECTED_AT_LEAST, 1)) {
return false;
}
@@ -381,6 +381,28 @@ static bool cmd_move(struct sway_config *config, int argc, char **argv) {
ws = workspace_create(ws_name);
}
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 {
return false;
}
@@ -742,6 +764,7 @@ static struct cmd_handler handlers[] = {
{ "output", cmd_output},
{ "reload", cmd_reload },
{ "resize", cmd_resize },
+ { "scratchpad", cmd_scratchpad },
{ "set", cmd_set },
{ "split", cmd_split },
{ "splith", cmd_splith },
diff --git a/sway/layout.c b/sway/layout.c
index b558e704..c7c5c477 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -10,6 +10,7 @@
#include "focus.h"
swayc_t root_container;
+list_t *scratchpad;
int min_sane_h = 60;
int min_sane_w = 100;
@@ -20,6 +21,7 @@ void init_layout(void) {
root_container.children = create_list();
root_container.handle = -1;
root_container.visible = true;
+ scratchpad = create_list();
}
int index_child(const swayc_t *child) {