mirror of
https://github.com/swaywm/sway.git
synced 2026-04-28 06:46:26 -04:00
added hiding and showing scratchpad views
credits go to taiyu. also prevent moving anything but views to scratchpad
This commit is contained in:
parent
f4b4c5851a
commit
6736a05977
2 changed files with 10 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue