aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2018-07-22 14:10:40 +1000
committerFurkan Sahin <furkan-dev@proton.me>2018-07-22 14:10:40 +1000
commit1eb56a175c9fb3caff8545fd2952687ea41defd1 (patch)
treeea124a94869d06edb3f98e85ecd649275e86ef91 /include
parentde9e88bb400dc04110eb7a931ab2779c1448f764 (diff)
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 @@
+#ifndef _SWAY_SCRATCHPAD_H
+#define _SWAY_SCRATCHPAD_H
+
+#include "tree/container.h"
+
+/**
+ * Move a container to the scratchpad.
+ */
+void scratchpad_add_container(struct sway_container *con);
+
+/**
+ * Remove a container from the scratchpad.
+ */
+void scratchpad_remove_container(struct sway_container *con);
+
+/**
+ * Show or hide the next container on the scratchpad.
+ */
+void scratchpad_toggle_auto(void);
+
+/**
+ * Show or hide a specific container on the scratchpad.
+ */
+void scratchpad_toggle_container(struct sway_container *con);
+
+#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 {
list_t *transactions;
list_t *dirty_containers;
+
+ list_t *scratchpad; // struct sway_container
};
struct 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 {
struct sway_container *parent;
+ // Indicates that the container is a scratchpad container.
+ // Both hidden and visible scratchpad containers have scratchpad=true.
+ // Hidden scratchpad containers have a NULL parent.
+ bool scratchpad;
+
float alpha;
struct wlr_texture *title_focused;