summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.bg.md1
-rw-r--r--README.de.md1
-rw-r--r--README.el.md1
-rw-r--r--README.fr.md1
-rw-r--r--README.it.md1
-rw-r--r--README.ja.md1
-rw-r--r--README.md1
-rw-r--r--README.pt.md1
-rw-r--r--README.ru.md1
-rw-r--r--README.uk.md1
-rw-r--r--include/sway/commands.h3
-rw-r--r--include/sway/tree/view.h1
-rw-r--r--sway/commands.c43
-rw-r--r--sway/commands/bar/bindsym.c2
-rw-r--r--sway/commands/bar/hidden_state.c2
-rw-r--r--sway/commands/bar/mode.c2
-rw-r--r--sway/commands/bind.c2
-rw-r--r--sway/commands/exec_always.c8
-rw-r--r--sway/commands/fullscreen.c2
-rw-r--r--sway/commands/layout.c2
-rw-r--r--sway/commands/move.c2
-rw-r--r--sway/commands/opacity.c2
-rw-r--r--sway/commands/reload.c11
-rw-r--r--sway/commands/resize.c4
-rw-r--r--sway/commands/swaynag_command.c2
-rw-r--r--sway/config.c3
-rw-r--r--sway/desktop/xwayland.c2
-rw-r--r--sway/input/cursor.c3
-rw-r--r--sway/input/seat.c7
-rw-r--r--sway/sway.5.scd10
-rw-r--r--sway/tree/container.c10
-rw-r--r--sway/tree/view.c11
-rw-r--r--swaybar/bar.c78
33 files changed, 113 insertions, 109 deletions
diff --git a/README.bg.md b/README.bg.md
index 9d91dfa4..efc99f15 100644
--- a/README.bg.md
+++ b/README.bg.md
@@ -47,6 +47,7 @@ Sway съществува в репотата (хранилищата) на мн
47* pam ** 47* pam **
48* dbus >= 1.10 *** 48* dbus >= 1.10 ***
49* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (Нужен за man страници) 49* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (Нужен за man страници)
50* git
50 51
51_\*Нужен само за swaybar, swaybg и swaylock_ 52_\*Нужен само за swaybar, swaybg и swaylock_
52 53
diff --git a/README.de.md b/README.de.md
index 9e591022..2c2e14e8 100644
--- a/README.de.md
+++ b/README.de.md
@@ -57,6 +57,7 @@ Abhängigkeiten:
57* gdk-pixbuf2 * 57* gdk-pixbuf2 *
58* pam ** 58* pam **
59* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (erforderlich für man pages) 59* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (erforderlich für man pages)
60* git
60 61
61_\*Nur erforderlich für swaybar, swaybg, und swaylock_ 62_\*Nur erforderlich für swaybar, swaybg, und swaylock_
62 63
diff --git a/README.el.md b/README.el.md
index d56728a0..3c9d65c9 100644
--- a/README.el.md
+++ b/README.el.md
@@ -50,6 +50,7 @@ To username μου στο Freenode είναι kon14 και θα με βρείτ
50* gdk-pixbuf2 * 50* gdk-pixbuf2 *
51* pam ** 51* pam **
52* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages) 52* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages)
53* git
53 54
54_\*Απαιτείται μόνο για swaybar, swaybg, and swaylock_ 55_\*Απαιτείται μόνο για swaybar, swaybg, and swaylock_
55 56
diff --git a/README.fr.md b/README.fr.md
index 629aef95..935d288f 100644
--- a/README.fr.md
+++ b/README.fr.md
@@ -52,6 +52,7 @@ Installez les dépendances :
52* gdk-pixbuf2 * 52* gdk-pixbuf2 *
53* pam ** 53* pam **
54* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (requis pour les pages man) 54* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (requis pour les pages man)
55* git
55 56
56_\*Uniquement requis pour swaybar, swaybg, and swaylock_ 57_\*Uniquement requis pour swaybar, swaybg, and swaylock_
57 58
diff --git a/README.it.md b/README.it.md
index a7e175c1..af986844 100644
--- a/README.it.md
+++ b/README.it.md
@@ -53,6 +53,7 @@ Installa queste dipendenze:
53* gdk-pixbuf2 * 53* gdk-pixbuf2 *
54* pam ** 54* pam **
55* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (rrichiesto per man pages) 55* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (rrichiesto per man pages)
56* git
56 57
57_\*Richiesto solo per swaybar, swaybg, e swaylock_ 58_\*Richiesto solo per swaybar, swaybg, e swaylock_
58 59
diff --git a/README.ja.md b/README.ja.md
index 396e0a72..ae2301fb 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -42,6 +42,7 @@ Swayは沢山のディストリビューションで提供されています。"
42* gdk-pixbuf2 * 42* gdk-pixbuf2 *
43* pam ** 43* pam **
44* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (manで必要です) 44* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (manで必要です)
45* git
45 46
46_\*swaybar,swaybg,swaylockでのみ必要です_ 47_\*swaybar,swaybg,swaylockでのみ必要です_
47 48
diff --git a/README.md b/README.md
index 7809a440..ca47b876 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,7 @@ Install dependencies:
46* pam ** 46* pam **
47* dbus >= 1.10 *** 47* dbus >= 1.10 ***
48* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages) 48* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages)
49* git
49 50
50_\*Only required for swaybar, swaybg, and swaylock_ 51_\*Only required for swaybar, swaybg, and swaylock_
51 52
diff --git a/README.pt.md b/README.pt.md
index 57220fae..91e709c1 100644
--- a/README.pt.md
+++ b/README.pt.md
@@ -59,6 +59,7 @@ Antes de iniciar a compilação, instale as dependências:
59* gdk-pixbuf2 * 59* gdk-pixbuf2 *
60* pam ** 60* pam **
61* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (man pages) 61* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (man pages)
62* git
62 63
63_\*Dependência apenas de swaybar, swaybg, e swaylock_ 64_\*Dependência apenas de swaybar, swaybg, e swaylock_
64 65
diff --git a/README.ru.md b/README.ru.md
index 25b80a23..4b34dc2d 100644
--- a/README.ru.md
+++ b/README.ru.md
@@ -53,6 +53,7 @@ Sway доступен во многих дистрибутивах и наход
53* pam ** 53* pam **
54* dbus >= 1.10 *** 54* dbus >= 1.10 ***
55* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages) 55* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages)
56* git
56 57
57_\*Требуется только для swaybar, swaybg и swaylock_ 58_\*Требуется только для swaybar, swaybg и swaylock_
58 59
diff --git a/README.uk.md b/README.uk.md
index 8c8b2eed..9ae7425a 100644
--- a/README.uk.md
+++ b/README.uk.md
@@ -59,6 +59,7 @@ Sway доступний у багатьох дистрибутивах Linux (а
59* gdk-pixbuf2 * 59* gdk-pixbuf2 *
60* pam ** 60* pam **
61* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages) 61* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (required for man pages)
62* git
62 63
63_\*Лише для swaybar, swaybg та swaylock_ 64_\*Лише для swaybar, swaybg та swaylock_
64 65
diff --git a/include/sway/commands.h b/include/sway/commands.h
index 2f6d31b1..6606775a 100644
--- a/include/sway/commands.h
+++ b/include/sway/commands.h
@@ -39,9 +39,8 @@ struct cmd_results {
39}; 39};
40 40
41enum expected_args { 41enum expected_args {
42 EXPECTED_MORE_THAN,
43 EXPECTED_AT_LEAST, 42 EXPECTED_AT_LEAST,
44 EXPECTED_LESS_THAN, 43 EXPECTED_AT_MOST,
45 EXPECTED_EQUAL_TO 44 EXPECTED_EQUAL_TO
46}; 45};
47 46
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index a8fa1660..0240f294 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -227,7 +227,6 @@ struct sway_view_child {
227 struct wl_listener surface_map; 227 struct wl_listener surface_map;
228 struct wl_listener surface_unmap; 228 struct wl_listener surface_unmap;
229 struct wl_listener surface_destroy; 229 struct wl_listener surface_destroy;
230 struct wl_listener view_unmap;
231}; 230};
232 231
233struct sway_xdg_popup_v6 { 232struct sway_xdg_popup_v6 {
diff --git a/sway/commands.c b/sway/commands.c
index 3f416afc..37c7169a 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -18,41 +18,28 @@
18 18
19// Returns error object, or NULL if check succeeds. 19// Returns error object, or NULL if check succeeds.
20struct cmd_results *checkarg(int argc, const char *name, enum expected_args type, int val) { 20struct cmd_results *checkarg(int argc, const char *name, enum expected_args type, int val) {
21 struct cmd_results *error = NULL; 21 const char *error_name = NULL;
22 switch (type) { 22 switch (type) {
23 case EXPECTED_MORE_THAN:
24 if (argc > val) {
25 return NULL;
26 }
27 error = cmd_results_new(CMD_INVALID, name, "Invalid %s command "
28 "(expected more than %d argument%s, got %d)",
29 name, val, (char*[2]){"s", ""}[argc==1], argc);
30 break;
31 case EXPECTED_AT_LEAST: 23 case EXPECTED_AT_LEAST:
32 if (argc >= val) { 24 if (argc < val) {
33 return NULL; 25 error_name = "at least ";
34 } 26 }
35 error = cmd_results_new(CMD_INVALID, name, "Invalid %s command "
36 "(expected at least %d argument%s, got %d)",
37 name, val, (char*[2]){"s", ""}[argc==1], argc);
38 break; 27 break;
39 case EXPECTED_LESS_THAN: 28 case EXPECTED_AT_MOST:
40 if (argc < val) { 29 if (argc > val) {
41 return NULL; 30 error_name = "at most ";
42 }; 31 }
43 error = cmd_results_new(CMD_INVALID, name, "Invalid %s command "
44 "(expected less than %d argument%s, got %d)",
45 name, val, (char*[2]){"s", ""}[argc==1], argc);
46 break; 32 break;
47 case EXPECTED_EQUAL_TO: 33 case EXPECTED_EQUAL_TO:
48 if (argc == val) { 34 if (argc != val) {
49 return NULL; 35 error_name = "";
50 }; 36 }
51 error = cmd_results_new(CMD_INVALID, name, "Invalid %s command "
52 "(expected %d arguments, got %d)", name, val, argc);
53 break;
54 } 37 }
55 return error; 38 return error_name ?
39 cmd_results_new(CMD_INVALID, name, "Invalid %s command "
40 "(expected %s%d argument%s, got %d)",
41 name, error_name, val, val != 1 ? "s" : "", argc)
42 : NULL;
56} 43}
57 44
58void apply_seat_config(struct seat_config *seat_config) { 45void apply_seat_config(struct seat_config *seat_config) {
diff --git a/sway/commands/bar/bindsym.c b/sway/commands/bar/bindsym.c
index 4eea3e6a..965c8903 100644
--- a/sway/commands/bar/bindsym.c
+++ b/sway/commands/bar/bindsym.c
@@ -10,7 +10,7 @@
10 10
11struct cmd_results *bar_cmd_bindsym(int argc, char **argv) { 11struct cmd_results *bar_cmd_bindsym(int argc, char **argv) {
12 struct cmd_results *error = NULL; 12 struct cmd_results *error = NULL;
13 if ((error = checkarg(argc, "bar bindsym", EXPECTED_MORE_THAN, 1))) { 13 if ((error = checkarg(argc, "bar bindsym", EXPECTED_AT_LEAST, 2))) {
14 return error; 14 return error;
15 } 15 }
16 if (!config->current_bar) { 16 if (!config->current_bar) {
diff --git a/sway/commands/bar/hidden_state.c b/sway/commands/bar/hidden_state.c
index 28adf6c7..5be6c2dc 100644
--- a/sway/commands/bar/hidden_state.c
+++ b/sway/commands/bar/hidden_state.c
@@ -40,7 +40,7 @@ struct cmd_results *bar_cmd_hidden_state(int argc, char **argv) {
40 if ((error = checkarg(argc, "hidden_state", EXPECTED_AT_LEAST, 1))) { 40 if ((error = checkarg(argc, "hidden_state", EXPECTED_AT_LEAST, 1))) {
41 return error; 41 return error;
42 } 42 }
43 if ((error = checkarg(argc, "hidden_state", EXPECTED_LESS_THAN, 3))) { 43 if ((error = checkarg(argc, "hidden_state", EXPECTED_AT_MOST, 2))) {
44 return error; 44 return error;
45 } 45 }
46 if (config->reading && argc > 1) { 46 if (config->reading && argc > 1) {
diff --git a/sway/commands/bar/mode.c b/sway/commands/bar/mode.c
index dbdd3897..2cba785e 100644
--- a/sway/commands/bar/mode.c
+++ b/sway/commands/bar/mode.c
@@ -41,7 +41,7 @@ struct cmd_results *bar_cmd_mode(int argc, char **argv) {
41 if ((error = checkarg(argc, "mode", EXPECTED_AT_LEAST, 1))) { 41 if ((error = checkarg(argc, "mode", EXPECTED_AT_LEAST, 1))) {
42 return error; 42 return error;
43 } 43 }
44 if ((error = checkarg(argc, "mode", EXPECTED_LESS_THAN, 3))) { 44 if ((error = checkarg(argc, "mode", EXPECTED_AT_MOST, 2))) {
45 return error; 45 return error;
46 } 46 }
47 if (config->reading && argc > 1) { 47 if (config->reading && argc > 1) {
diff --git a/sway/commands/bind.c b/sway/commands/bind.c
index 5832d01e..a9de227f 100644
--- a/sway/commands/bind.c
+++ b/sway/commands/bind.c
@@ -145,7 +145,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
145 const char *bindtype = bindcode ? "bindcode" : "bindsym"; 145 const char *bindtype = bindcode ? "bindcode" : "bindsym";
146 146
147 struct cmd_results *error = NULL; 147 struct cmd_results *error = NULL;
148 if ((error = checkarg(argc, bindtype, EXPECTED_MORE_THAN, 1))) { 148 if ((error = checkarg(argc, bindtype, EXPECTED_AT_LEAST, 2))) {
149 return error; 149 return error;
150 } 150 }
151 151
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c
index de78dd83..8bdeceeb 100644
--- a/sway/commands/exec_always.c
+++ b/sway/commands/exec_always.c
@@ -16,7 +16,7 @@
16struct cmd_results *cmd_exec_always(int argc, char **argv) { 16struct cmd_results *cmd_exec_always(int argc, char **argv) {
17 struct cmd_results *error = NULL; 17 struct cmd_results *error = NULL;
18 if (!config->active) return cmd_results_new(CMD_DEFER, NULL, NULL); 18 if (!config->active) return cmd_results_new(CMD_DEFER, NULL, NULL);
19 if ((error = checkarg(argc, "exec_always", EXPECTED_MORE_THAN, 0))) { 19 if ((error = checkarg(argc, argv[-1], EXPECTED_AT_LEAST, 1))) {
20 return error; 20 return error;
21 } 21 }
22 22
@@ -24,7 +24,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
24 if (strcmp(argv[0], "--no-startup-id") == 0) { 24 if (strcmp(argv[0], "--no-startup-id") == 0) {
25 wlr_log(WLR_INFO, "exec switch '--no-startup-id' not supported, ignored."); 25 wlr_log(WLR_INFO, "exec switch '--no-startup-id' not supported, ignored.");
26 --argc; ++argv; 26 --argc; ++argv;
27 if ((error = checkarg(argc, "exec_always", EXPECTED_MORE_THAN, 0))) { 27 if ((error = checkarg(argc, argv[-1], EXPECTED_AT_LEAST, 1))) {
28 return error; 28 return error;
29 } 29 }
30 } 30 }
@@ -71,7 +71,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
71 } else if (pid < 0) { 71 } else if (pid < 0) {
72 close(fd[0]); 72 close(fd[0]);
73 close(fd[1]); 73 close(fd[1]);
74 return cmd_results_new(CMD_FAILURE, "exec_always", "fork() failed"); 74 return cmd_results_new(CMD_FAILURE, argv[-1], "fork() failed");
75 } 75 }
76 close(fd[1]); // close write 76 close(fd[1]); // close write
77 ssize_t s = 0; 77 ssize_t s = 0;
@@ -85,7 +85,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
85 wlr_log(WLR_DEBUG, "Child process created with pid %d", child); 85 wlr_log(WLR_DEBUG, "Child process created with pid %d", child);
86 root_record_workspace_pid(child); 86 root_record_workspace_pid(child);
87 } else { 87 } else {
88 return cmd_results_new(CMD_FAILURE, "exec_always", 88 return cmd_results_new(CMD_FAILURE, argv[-1],
89 "Second fork() failed"); 89 "Second fork() failed");
90 } 90 }
91 91
diff --git a/sway/commands/fullscreen.c b/sway/commands/fullscreen.c
index 22d747b9..0204a73c 100644
--- a/sway/commands/fullscreen.c
+++ b/sway/commands/fullscreen.c
@@ -9,7 +9,7 @@
9 9
10struct cmd_results *cmd_fullscreen(int argc, char **argv) { 10struct cmd_results *cmd_fullscreen(int argc, char **argv) {
11 struct cmd_results *error = NULL; 11 struct cmd_results *error = NULL;
12 if ((error = checkarg(argc, "fullscreen", EXPECTED_LESS_THAN, 2))) { 12 if ((error = checkarg(argc, "fullscreen", EXPECTED_AT_MOST, 1))) {
13 return error; 13 return error;
14 } 14 }
15 struct sway_node *node = config->handler_context.node; 15 struct sway_node *node = config->handler_context.node;
diff --git a/sway/commands/layout.c b/sway/commands/layout.c
index c2ce2e78..65f67af8 100644
--- a/sway/commands/layout.c
+++ b/sway/commands/layout.c
@@ -96,7 +96,7 @@ static enum sway_container_layout get_layout(int argc, char **argv,
96 96
97struct cmd_results *cmd_layout(int argc, char **argv) { 97struct cmd_results *cmd_layout(int argc, char **argv) {
98 struct cmd_results *error = NULL; 98 struct cmd_results *error = NULL;
99 if ((error = checkarg(argc, "layout", EXPECTED_MORE_THAN, 0))) { 99 if ((error = checkarg(argc, "layout", EXPECTED_AT_LEAST, 1))) {
100 return error; 100 return error;
101 } 101 }
102 struct sway_container *container = config->handler_context.container; 102 struct sway_container *container = config->handler_context.container;
diff --git a/sway/commands/move.c b/sway/commands/move.c
index a5b7f661..e0a958bf 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -108,7 +108,7 @@ static void workspace_focus_fullscreen(struct sway_workspace *workspace) {
108 if (focus_ws == workspace) { 108 if (focus_ws == workspace) {
109 struct sway_node *new_focus = 109 struct sway_node *new_focus =
110 seat_get_focus_inactive(seat, &workspace->fullscreen->node); 110 seat_get_focus_inactive(seat, &workspace->fullscreen->node);
111 seat_set_focus(seat, new_focus); 111 seat_set_raw_focus(seat, new_focus);
112 } 112 }
113 } 113 }
114} 114}
diff --git a/sway/commands/opacity.c b/sway/commands/opacity.c
index 4e4fc994..8c45b528 100644
--- a/sway/commands/opacity.c
+++ b/sway/commands/opacity.c
@@ -15,7 +15,7 @@ static bool parse_opacity(const char *opacity, float *val) {
15 15
16struct cmd_results *cmd_opacity(int argc, char **argv) { 16struct cmd_results *cmd_opacity(int argc, char **argv) {
17 struct cmd_results *error = NULL; 17 struct cmd_results *error = NULL;
18 if ((error = checkarg(argc, "layout", EXPECTED_EQUAL_TO, 1))) { 18 if ((error = checkarg(argc, "opacity", EXPECTED_EQUAL_TO, 1))) {
19 return error; 19 return error;
20 } 20 }
21 21
diff --git a/sway/commands/reload.c b/sway/commands/reload.c
index 9e136d48..791081a8 100644
--- a/sway/commands/reload.c
+++ b/sway/commands/reload.c
@@ -5,9 +5,17 @@
5#include "sway/ipc-server.h" 5#include "sway/ipc-server.h"
6#include "sway/server.h" 6#include "sway/server.h"
7#include "sway/tree/arrange.h" 7#include "sway/tree/arrange.h"
8#include "sway/tree/view.h"
8#include "list.h" 9#include "list.h"
9#include "log.h" 10#include "log.h"
10 11
12static void rebuild_textures_iterator(struct sway_container *con, void *data) {
13 if (con->view) {
14 view_update_marks_textures(con->view);
15 }
16 container_update_title_textures(con);
17}
18
11static void do_reload(void *data) { 19static void do_reload(void *data) {
12 // store bar ids to check against new bars for barconfig_update events 20 // store bar ids to check against new bars for barconfig_update events
13 list_t *bar_ids = create_list(); 21 list_t *bar_ids = create_list();
@@ -40,6 +48,9 @@ static void do_reload(void *data) {
40 list_foreach(bar_ids, free); 48 list_foreach(bar_ids, free);
41 list_free(bar_ids); 49 list_free(bar_ids);
42 50
51 config_update_font_height(true);
52 root_for_each_container(rebuild_textures_iterator, NULL);
53
43 arrange_root(); 54 arrange_root();
44} 55}
45 56
diff --git a/sway/commands/resize.c b/sway/commands/resize.c
index 6de14ca3..8666f40b 100644
--- a/sway/commands/resize.c
+++ b/sway/commands/resize.c
@@ -94,7 +94,7 @@ static void calculate_constraints(int *min_width, int *max_width,
94 *min_height = config->floating_minimum_height; 94 *min_height = config->floating_minimum_height;
95 } 95 }
96 96
97 if (config->floating_maximum_width == -1) { // no maximum 97 if (config->floating_maximum_width == -1 || !con->workspace) { // no max
98 *max_width = INT_MAX; 98 *max_width = INT_MAX;
99 } else if (config->floating_maximum_width == 0) { // automatic 99 } else if (config->floating_maximum_width == 0) { // automatic
100 *max_width = con->workspace->width; 100 *max_width = con->workspace->width;
@@ -102,7 +102,7 @@ static void calculate_constraints(int *min_width, int *max_width,
102 *max_width = config->floating_maximum_width; 102 *max_width = config->floating_maximum_width;
103 } 103 }
104 104
105 if (config->floating_maximum_height == -1) { // no maximum 105 if (config->floating_maximum_height == -1 || !con->workspace) { // no max
106 *max_height = INT_MAX; 106 *max_height = INT_MAX;
107 } else if (config->floating_maximum_height == 0) { // automatic 107 } else if (config->floating_maximum_height == 0) { // automatic
108 *max_height = con->workspace->height; 108 *max_height = con->workspace->height;
diff --git a/sway/commands/swaynag_command.c b/sway/commands/swaynag_command.c
index 6c86f1a7..5e54504c 100644
--- a/sway/commands/swaynag_command.c
+++ b/sway/commands/swaynag_command.c
@@ -14,7 +14,7 @@ struct cmd_results *cmd_swaynag_command(int argc, char **argv) {
14 14
15 char *new_command = join_args(argv, argc); 15 char *new_command = join_args(argv, argc);
16 if (strcmp(new_command, "-") != 0) { 16 if (strcmp(new_command, "-") != 0) {
17 config->swaybg_command = new_command; 17 config->swaynag_command = new_command;
18 wlr_log(WLR_DEBUG, "Using custom swaynag command: %s", 18 wlr_log(WLR_DEBUG, "Using custom swaynag command: %s",
19 config->swaynag_command); 19 config->swaynag_command);
20 } else { 20 } else {
diff --git a/sway/config.c b/sway/config.c
index b9cb0a1c..9ec40367 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -584,13 +584,11 @@ static int detect_brace_on_following_line(FILE *file, char *line,
584 char *peeked = NULL; 584 char *peeked = NULL;
585 long position = 0; 585 long position = 0;
586 do { 586 do {
587 wlr_log(WLR_DEBUG, "Peeking line %d", line_number + lines + 1);
588 free(peeked); 587 free(peeked);
589 peeked = peek_line(file, lines, &position); 588 peeked = peek_line(file, lines, &position);
590 if (peeked) { 589 if (peeked) {
591 peeked = strip_whitespace(peeked); 590 peeked = strip_whitespace(peeked);
592 } 591 }
593 wlr_log(WLR_DEBUG, "Peeked line: `%s`", peeked);
594 lines++; 592 lines++;
595 } while (peeked && strlen(peeked) == 0); 593 } while (peeked && strlen(peeked) == 0);
596 594
@@ -695,7 +693,6 @@ bool read_config(FILE *file, struct sway_config *config,
695 free(line); 693 free(line);
696 return false; 694 return false;
697 } 695 }
698 wlr_log(WLR_DEBUG, "Expanded line: %s", expanded);
699 struct cmd_results *res; 696 struct cmd_results *res;
700 if (block && strcmp(block, "<commands>") == 0) { 697 if (block && strcmp(block, "<commands>") == 0) {
701 // Special case 698 // Special case
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index a8fbd574..d1aec084 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -244,7 +244,7 @@ static bool wants_floating(struct sway_view *view) {
244 244
245 struct wlr_xwayland_surface_size_hints *size_hints = surface->size_hints; 245 struct wlr_xwayland_surface_size_hints *size_hints = surface->size_hints;
246 if (size_hints != NULL && 246 if (size_hints != NULL &&
247 size_hints->min_width != 0 && size_hints->min_height != 0 && 247 size_hints->min_width > 0 && size_hints->min_height > 0 &&
248 (size_hints->max_width == size_hints->min_width || 248 (size_hints->max_width == size_hints->min_width ||
249 size_hints->max_height == size_hints->min_height)) { 249 size_hints->max_height == size_hints->min_height)) {
250 return true; 250 return true;
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index a07bc53b..60d4bf5d 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -1220,6 +1220,9 @@ static void handle_request_set_cursor(struct wl_listener *listener,
1220 1220
1221void cursor_set_image(struct sway_cursor *cursor, const char *image, 1221void cursor_set_image(struct sway_cursor *cursor, const char *image,
1222 struct wl_client *client) { 1222 struct wl_client *client) {
1223 if (!(cursor->seat->wlr_seat->capabilities & WL_SEAT_CAPABILITY_POINTER)) {
1224 return;
1225 }
1223 if (!image) { 1226 if (!image) {
1224 wlr_cursor_set_image(cursor->cursor, NULL, 0, 0, 0, 0, 0, 0); 1227 wlr_cursor_set_image(cursor->cursor, NULL, 0, 0, 0, 0, 0, 0);
1225 } else if (!cursor->image || strcmp(cursor->image, image) != 0) { 1228 } else if (!cursor->image || strcmp(cursor->image, image) != 0) {
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 16acc8a5..89d841bb 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -389,12 +389,15 @@ static void seat_update_capabilities(struct sway_seat *seat) {
389 break; 389 break;
390 } 390 }
391 } 391 }
392 wlr_seat_set_capabilities(seat->wlr_seat, caps);
393 392
394 // Hide cursor if seat doesn't have pointer capability 393 // Hide cursor if seat doesn't have pointer capability.
394 // We must call cursor_set_image while the wlr_seat has the capabilities
395 // otherwise it's a no op.
395 if ((caps & WL_SEAT_CAPABILITY_POINTER) == 0) { 396 if ((caps & WL_SEAT_CAPABILITY_POINTER) == 0) {
396 cursor_set_image(seat->cursor, NULL, NULL); 397 cursor_set_image(seat->cursor, NULL, NULL);
398 wlr_seat_set_capabilities(seat->wlr_seat, caps);
397 } else { 399 } else {
400 wlr_seat_set_capabilities(seat->wlr_seat, caps);
398 cursor_set_image(seat->cursor, "left_ptr", NULL); 401 cursor_set_image(seat->cursor, "left_ptr", NULL);
399 } 402 }
400} 403}
diff --git a/sway/sway.5.scd b/sway/sway.5.scd
index 51fd260b..1999a6c8 100644
--- a/sway/sway.5.scd
+++ b/sway/sway.5.scd
@@ -69,7 +69,7 @@ The following commands may only be used in the configuration file.
69 69
70*swaybg\_command* <command> 70*swaybg\_command* <command>
71 Executes custom background _command_. Default is _swaybg_. Refer to 71 Executes custom background _command_. Default is _swaybg_. Refer to
72 *output* below for more information. 72 *sway-output*(5) for more information.
73 73
74 It can be disabled by setting the command to a single dash: 74 It can be disabled by setting the command to a single dash:
75 _swaybg\_command -_ 75 _swaybg\_command -_
@@ -495,6 +495,12 @@ The default colors are:
495 Prevents windows matching <criteria> from being focused automatically when 495 Prevents windows matching <criteria> from being focused automatically when
496 they're created. This has no effect on the first window in a workspace. 496 they're created. This has no effect on the first window in a workspace.
497 497
498*output* <output\_name> <output-subcommands...>
499 For details on output subcommands, see *sway-output*(5).
500
501 \* may be used in lieu of a specific output name to configure all outputs.
502 A list of output names may be obtained via *swaymsg -t get\_outputs*.
503
498*popup\_during\_fullscreen* smart|ignore|leave\_fullscreen 504*popup\_during\_fullscreen* smart|ignore|leave\_fullscreen
499 Determines what to do when a fullscreen view opens a dialog. 505 Determines what to do when a fullscreen view opens a dialog.
500 If _smart_ (the default), the dialog will be displayed. If _ignore_, the 506 If _smart_ (the default), the dialog will be displayed. If _ignore_, the
@@ -669,4 +675,4 @@ The following attributes may be matched with:
669 675
670# SEE ALSO 676# SEE ALSO
671 677
672*sway*(1) *sway-input*(5) *sway-bar*(5) 678*sway*(1) *sway-input*(5) *sway-output*(5) *sway-bar*(5)
diff --git a/sway/tree/container.c b/sway/tree/container.c
index b41e8dd4..58d3df34 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -727,8 +727,14 @@ void container_set_geometry_from_floating_view(struct sway_container *con) {
727} 727}
728 728
729bool container_is_floating(struct sway_container *container) { 729bool container_is_floating(struct sway_container *container) {
730 return !container->parent && container->workspace && 730 if (!container->parent && container->workspace &&
731 list_find(container->workspace->floating, container) != -1; 731 list_find(container->workspace->floating, container) != -1) {
732 return true;
733 }
734 if (container->scratchpad) {
735 return true;
736 }
737 return false;
732} 738}
733 739
734void container_get_box(struct sway_container *container, struct wlr_box *box) { 740void container_get_box(struct sway_container *container, struct wlr_box *box) {
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 3698d7d5..20babf7b 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -738,13 +738,6 @@ static void view_child_handle_surface_destroy(struct wl_listener *listener,
738 view_child_destroy(child); 738 view_child_destroy(child);
739} 739}
740 740
741static void view_child_handle_view_unmap(struct wl_listener *listener,
742 void *data) {
743 struct sway_view_child *child =
744 wl_container_of(listener, child, view_unmap);
745 view_child_destroy(child);
746}
747
748static void view_init_subsurfaces(struct sway_view *view, 741static void view_init_subsurfaces(struct sway_view *view,
749 struct wlr_surface *surface) { 742 struct wlr_surface *surface) {
750 struct wlr_subsurface *subsurface; 743 struct wlr_subsurface *subsurface;
@@ -786,9 +779,6 @@ void view_child_init(struct sway_view_child *child,
786 child->surface_map.notify = view_child_handle_surface_map; 779 child->surface_map.notify = view_child_handle_surface_map;
787 child->surface_unmap.notify = view_child_handle_surface_unmap; 780 child->surface_unmap.notify = view_child_handle_surface_unmap;
788 781
789 wl_signal_add(&view->events.unmap, &child->view_unmap);
790 child->view_unmap.notify = view_child_handle_view_unmap;
791
792 struct sway_output *output = child->view->container->workspace->output; 782 struct sway_output *output = child->view->container->workspace->output;
793 wlr_surface_send_enter(child->surface, output->wlr_output); 783 wlr_surface_send_enter(child->surface, output->wlr_output);
794 784
@@ -798,7 +788,6 @@ void view_child_init(struct sway_view_child *child,
798void view_child_destroy(struct sway_view_child *child) { 788void view_child_destroy(struct sway_view_child *child) {
799 wl_list_remove(&child->surface_commit.link); 789 wl_list_remove(&child->surface_commit.link);
800 wl_list_remove(&child->surface_destroy.link); 790 wl_list_remove(&child->surface_destroy.link);
801 wl_list_remove(&child->view_unmap.link);
802 791
803 if (child->impl && child->impl->destroy) { 792 if (child->impl && child->impl->destroy) {
804 child->impl->destroy(child); 793 child->impl->destroy(child);
diff --git a/swaybar/bar.c b/swaybar/bar.c
index 71aff691..88de8c04 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -26,11 +26,6 @@
26#include "wlr-layer-shell-unstable-v1-client-protocol.h" 26#include "wlr-layer-shell-unstable-v1-client-protocol.h"
27#include "xdg-output-unstable-v1-client-protocol.h" 27#include "xdg-output-unstable-v1-client-protocol.h"
28 28
29static void bar_init(struct swaybar *bar) {
30 bar->config = init_config();
31 wl_list_init(&bar->outputs);
32}
33
34void free_workspaces(struct wl_list *list) { 29void free_workspaces(struct wl_list *list) {
35 struct swaybar_workspace *ws, *tmp; 30 struct swaybar_workspace *ws, *tmp;
36 wl_list_for_each_safe(ws, tmp, list, link) { 31 wl_list_for_each_safe(ws, tmp, list, link) {
@@ -124,35 +119,45 @@ static void destroy_layer_surface(struct swaybar_output *output) {
124 output->frame_scheduled = false; 119 output->frame_scheduled = false;
125} 120}
126 121
122static void set_bar_dirty(struct swaybar *bar) {
123 struct swaybar_output *output;
124 wl_list_for_each(output, &bar->outputs, link) {
125 set_output_dirty(output);
126 }
127}
128
127bool determine_bar_visibility(struct swaybar *bar, bool moving_layer) { 129bool determine_bar_visibility(struct swaybar *bar, bool moving_layer) {
128 struct swaybar_config *config = bar->config; 130 struct swaybar_config *config = bar->config;
129 bool visible = !(strcmp(config->mode, "invisible") == 0 || 131 bool visible = !(strcmp(config->mode, "invisible") == 0 ||
130 (strcmp(config->mode, config->hidden_state) == 0 // both "hide" 132 (strcmp(config->mode, config->hidden_state) == 0 // both "hide"
131 && !bar->visible_by_modifier && !bar->visible_by_urgency)); 133 && !bar->visible_by_modifier && !bar->visible_by_urgency));
132 134
135 // Create/destroy layer surfaces as needed
133 struct swaybar_output *output; 136 struct swaybar_output *output;
134 if (visible == bar->visible) { 137 wl_list_for_each(output, &bar->outputs, link) {
135 if (visible && moving_layer) { 138 // When moving to a different layer, we need to destroy and re-create
136 // need to destroy layer surface to move to a different layer 139 // the layer surface
137 wl_list_for_each(output, &bar->outputs, link) { 140 if (!visible || moving_layer) {
138 destroy_layer_surface(output); 141 destroy_layer_surface(output);
139 add_layer_surface(output); 142 }
140 } 143
144 if (visible) {
145 add_layer_surface(output);
141 } 146 }
142 } else { 147 }
148 set_bar_dirty(bar);
149
150 if (visible != bar->visible) {
143 bar->visible = visible; 151 bar->visible = visible;
144 wl_list_for_each(output, &bar->outputs, link) { 152
145 if (visible) { 153 if (bar->status) {
146 add_layer_surface(output); 154 wlr_log(WLR_DEBUG, "Sending %s signal to status command",
147 } else { 155 visible ? "cont" : "stop");
148 destroy_layer_surface(output); 156 kill(bar->status->pid, visible ?
149 } 157 bar->status->cont_signal : bar->status->stop_signal);
150 } 158 }
151 wlr_log(WLR_DEBUG, "Sending %s signal to status command",
152 visible ? "cont" : "stop");
153 kill(bar->status->pid,
154 visible ? bar->status->cont_signal : bar->status->stop_signal);
155 } 159 }
160
156 return visible; 161 return visible;
157} 162}
158 163
@@ -226,6 +231,8 @@ static void xdg_output_handle_done(void *data,
226 231
227 output->surface = wl_compositor_create_surface(bar->compositor); 232 output->surface = wl_compositor_create_surface(bar->compositor);
228 assert(output->surface); 233 assert(output->surface);
234
235 determine_bar_visibility(bar, false);
229 } 236 }
230} 237}
231 238
@@ -314,15 +321,10 @@ static const struct wl_registry_listener registry_listener = {
314 .global_remove = handle_global_remove, 321 .global_remove = handle_global_remove,
315}; 322};
316 323
317static void set_bar_dirty(struct swaybar *bar) {
318 struct swaybar_output *output;
319 wl_list_for_each(output, &bar->outputs, link) {
320 set_output_dirty(output);
321 }
322}
323
324bool bar_setup(struct swaybar *bar, const char *socket_path) { 324bool bar_setup(struct swaybar *bar, const char *socket_path) {
325 bar_init(bar); 325 bar->visible = true;
326 bar->config = init_config();
327 wl_list_init(&bar->outputs);
326 bar->eventloop = loop_create(); 328 bar->eventloop = loop_create();
327 329
328 bar->ipc_socketfd = ipc_open_socket(socket_path); 330 bar->ipc_socketfd = ipc_open_socket(socket_path);
@@ -348,15 +350,13 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) {
348 assert(bar->compositor && bar->layer_shell && bar->shm && 350 assert(bar->compositor && bar->layer_shell && bar->shm &&
349 bar->xdg_output_manager); 351 bar->xdg_output_manager);
350 352
351 struct swaybar_output *output; 353 // Second roundtrip for xdg-output
352 wl_list_for_each(output, &bar->outputs, link) {
353 add_xdg_output(output);
354 }
355 wl_display_roundtrip(bar->display); 354 wl_display_roundtrip(bar->display);
356 355
357 struct swaybar_pointer *pointer = &bar->pointer; 356 struct swaybar_pointer *pointer = &bar->pointer;
358 357
359 int max_scale = 1; 358 int max_scale = 1;
359 struct swaybar_output *output;
360 wl_list_for_each(output, &bar->outputs, link) { 360 wl_list_for_each(output, &bar->outputs, link) {
361 if (output->scale > max_scale) { 361 if (output->scale > max_scale) {
362 max_scale = output->scale; 362 max_scale = output->scale;
@@ -373,16 +373,10 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) {
373 pointer->cursor_surface = wl_compositor_create_surface(bar->compositor); 373 pointer->cursor_surface = wl_compositor_create_surface(bar->compositor);
374 assert(pointer->cursor_surface); 374 assert(pointer->cursor_surface);
375 375
376 bar->visible = true;
377 if (bar->config->workspace_buttons) { 376 if (bar->config->workspace_buttons) {
378 ipc_get_workspaces(bar); 377 ipc_get_workspaces(bar);
379 } 378 }
380 if (determine_bar_visibility(bar, false)) { 379 determine_bar_visibility(bar, false);
381 wl_list_for_each(output, &bar->outputs, link) {
382 add_layer_surface(output);
383 }
384 set_bar_dirty(bar);
385 }
386 return true; 380 return true;
387} 381}
388 382