added hiding and showing scratchpad views

credits go to taiyu.
also prevent moving anything but views to scratchpad
This commit is contained in:
minus 2015-08-21 23:36:01 +02:00
parent f4b4c5851a
commit 6736a05977
2 changed files with 10 additions and 6 deletions

View file

@ -319,18 +319,19 @@ static bool cmd_move(struct sway_config *config, int argc, char **argv) {
swayc_t *view = get_focused_container(&root_container);
if (strcasecmp(argv[0], "left") == 0) {
move_container(view,&root_container,MOVE_LEFT);
move_container(view, &root_container, MOVE_LEFT);
} else if (strcasecmp(argv[0], "right") == 0) {
move_container(view,&root_container,MOVE_RIGHT);
move_container(view, &root_container, MOVE_RIGHT);
} else if (strcasecmp(argv[0], "up") == 0) {
move_container(view,&root_container,MOVE_UP);
move_container(view, &root_container, MOVE_UP);
} else if (strcasecmp(argv[0], "down") == 0) {
move_container(view,&root_container,MOVE_DOWN);
} else if (strcasecmp(argv[0], "scratchpad") == 0) {
move_container(view, &root_container, MOVE_DOWN);
} else if (strcasecmp(argv[0], "scratchpad") == 0 && view->type == C_VIEW) {
swayc_t *parent = view->parent;
destroy_container(remove_child(view));
scratchpad_push(view);
set_focused_container(parent);
set_focused_container(get_focused_view(parent));
arrange_windows(parent, -1, -1);
} else {
return false;
}

View file

@ -471,6 +471,8 @@ void view_set_floating(swayc_t *view, bool floating) {
void scratchpad_push(swayc_t *view) {
add_floating(scratchpad, view);
wlc_view_set_mask(view->handle, 2); // invisible mask
wlc_view_send_to_back(view->handle);
}
swayc_t *scratchpad_pop(void) {
@ -478,6 +480,7 @@ swayc_t *scratchpad_pop(void) {
return NULL;
}
swayc_t *view = scratchpad->floating->items[0];
wlc_view_set_mask(view->handle, 1); // visible mask
remove_child(view);
return view;
}