summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-22 14:10:40 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-23 08:24:32 +1000
commit81e8f31cc6f284b54ab206e14af7ecbc1a9ed1bb (patch)
treeea124a94869d06edb3f98e85ecd649275e86ef91 /include
parentMerge pull request #2328 from emersion/xdg-shell-set-title (diff)
downloadsway-81e8f31cc6f284b54ab206e14af7ecbc1a9ed1bb.tar.gz
sway-81e8f31cc6f284b54ab206e14af7ecbc1a9ed1bb.tar.zst
sway-81e8f31cc6f284b54ab206e14af7ecbc1a9ed1bb.zip
Implement scratchpad
Implements the following commands: * move scratchpad * scratchpad show * [criteria] scratchpad show Also fixes these: * Fix memory leak when executing command with criteria (use `list_free(views)` instead of `free(views)`) * Fix crash when running `move to` with no further arguments
Diffstat (limited to 'include')
-rw-r--r--include/sway/scratchpad.h26
-rw-r--r--include/sway/server.h2
-rw-r--r--include/sway/tree/container.h5
3 files changed, 33 insertions, 0 deletions
diff --git a/include/sway/scratchpad.h b/include/sway/scratchpad.h
new file mode 100644
index 00000000..5af5256f
--- /dev/null
+++ b/include/sway/scratchpad.h
@@ -0,0 +1,26 @@
1#ifndef _SWAY_SCRATCHPAD_H
2#define _SWAY_SCRATCHPAD_H
3
4#include "tree/container.h"
5
6/**
7 * Move a container to the scratchpad.
8 */
9void scratchpad_add_container(struct sway_container *con);
10
11/**
12 * Remove a container from the scratchpad.
13 */
14void scratchpad_remove_container(struct sway_container *con);
15
16/**
17 * Show or hide the next container on the scratchpad.
18 */
19void scratchpad_toggle_auto(void);
20
21/**
22 * Show or hide a specific container on the scratchpad.
23 */
24void scratchpad_toggle_container(struct sway_container *con);
25
26#endif
diff --git a/include/sway/server.h b/include/sway/server.h
index 70bde6d4..6cef2e58 100644
--- a/include/sway/server.h
+++ b/include/sway/server.h
@@ -48,6 +48,8 @@ struct sway_server {
48 48
49 list_t *transactions; 49 list_t *transactions;
50 list_t *dirty_containers; 50 list_t *dirty_containers;
51
52 list_t *scratchpad; // struct sway_container
51}; 53};
52 54
53struct sway_server server; 55struct sway_server server;
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index 59c5b4c7..2a4be18c 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -135,6 +135,11 @@ struct sway_container {
135 135
136 struct sway_container *parent; 136 struct sway_container *parent;
137 137
138 // Indicates that the container is a scratchpad container.
139 // Both hidden and visible scratchpad containers have scratchpad=true.
140 // Hidden scratchpad containers have a NULL parent.
141 bool scratchpad;
142
138 float alpha; 143 float alpha;
139 144
140 struct wlr_texture *title_focused; 145 struct wlr_texture *title_focused;