diff options
-rw-r--r-- | include/sway/config.h | 8 | ||||
-rw-r--r-- | sway/commands/xwayland.c | 10 | ||||
-rw-r--r-- | sway/config.c | 2 | ||||
-rw-r--r-- | sway/server.c | 8 | ||||
-rw-r--r-- | sway/sway.5.scd | 7 |
5 files changed, 27 insertions, 8 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index c65d9353..ae6e6750 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -424,6 +424,12 @@ enum alignment { | |||
424 | ALIGN_RIGHT | 424 | ALIGN_RIGHT |
425 | }; | 425 | }; |
426 | 426 | ||
427 | enum xwayland_mode { | ||
428 | XWAYLAND_MODE_DISABLED, | ||
429 | XWAYLAND_MODE_LAZY, | ||
430 | XWAYLAND_MODE_IMMEADIATE | ||
431 | }; | ||
432 | |||
427 | /** | 433 | /** |
428 | * The configuration struct. The result of loading a config file. | 434 | * The configuration struct. The result of loading a config file. |
429 | */ | 435 | */ |
@@ -464,7 +470,7 @@ struct sway_config { | |||
464 | size_t urgent_timeout; | 470 | size_t urgent_timeout; |
465 | enum sway_fowa focus_on_window_activation; | 471 | enum sway_fowa focus_on_window_activation; |
466 | enum sway_popup_during_fullscreen popup_during_fullscreen; | 472 | enum sway_popup_during_fullscreen popup_during_fullscreen; |
467 | bool xwayland; | 473 | enum xwayland_mode xwayland; |
468 | 474 | ||
469 | // swaybg | 475 | // swaybg |
470 | char *swaybg_command; | 476 | char *swaybg_command; |
diff --git a/sway/commands/xwayland.c b/sway/commands/xwayland.c index 62293276..38559f55 100644 --- a/sway/commands/xwayland.c +++ b/sway/commands/xwayland.c | |||
@@ -11,7 +11,15 @@ struct cmd_results *cmd_xwayland(int argc, char **argv) { | |||
11 | } | 11 | } |
12 | 12 | ||
13 | #ifdef HAVE_XWAYLAND | 13 | #ifdef HAVE_XWAYLAND |
14 | bool xwayland = parse_boolean(argv[0], true); | 14 | enum xwayland_mode xwayland; |
15 | if (strcmp(argv[0], "force") == 0) { | ||
16 | xwayland = XWAYLAND_MODE_IMMEADIATE; | ||
17 | } else if (parse_boolean(argv[0], true)) { | ||
18 | xwayland = XWAYLAND_MODE_LAZY; | ||
19 | } else { | ||
20 | xwayland = XWAYLAND_MODE_DISABLED; | ||
21 | } | ||
22 | |||
15 | if (config->reloading && config->xwayland != xwayland) { | 23 | if (config->reloading && config->xwayland != xwayland) { |
16 | return cmd_results_new(CMD_FAILURE, | 24 | return cmd_results_new(CMD_FAILURE, |
17 | "xwayland can only be enabled/disabled at launch"); | 25 | "xwayland can only be enabled/disabled at launch"); |
diff --git a/sway/config.c b/sway/config.c index 74080898..c1b0efa0 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -248,7 +248,7 @@ static void config_defaults(struct sway_config *config) { | |||
248 | config->font_height = 17; // height of monospace 10 | 248 | config->font_height = 17; // height of monospace 10 |
249 | config->urgent_timeout = 500; | 249 | config->urgent_timeout = 500; |
250 | config->popup_during_fullscreen = POPUP_SMART; | 250 | config->popup_during_fullscreen = POPUP_SMART; |
251 | config->xwayland = true; | 251 | config->xwayland = XWAYLAND_MODE_LAZY; |
252 | 252 | ||
253 | config->titlebar_border_thickness = 1; | 253 | config->titlebar_border_thickness = 1; |
254 | config->titlebar_h_padding = 5; | 254 | config->titlebar_h_padding = 5; |
diff --git a/sway/server.c b/sway/server.c index 6fe2a919..aee2cc87 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -167,10 +167,12 @@ void server_fini(struct sway_server *server) { | |||
167 | 167 | ||
168 | bool server_start(struct sway_server *server) { | 168 | bool server_start(struct sway_server *server) { |
169 | #if HAVE_XWAYLAND | 169 | #if HAVE_XWAYLAND |
170 | if (config->xwayland) { | 170 | if (config->xwayland != XWAYLAND_MODE_DISABLED) { |
171 | sway_log(SWAY_DEBUG, "Initializing Xwayland"); | 171 | sway_log(SWAY_DEBUG, "Initializing Xwayland (lazy=%d)", |
172 | config->xwayland == XWAYLAND_MODE_LAZY); | ||
172 | server->xwayland.wlr_xwayland = | 173 | server->xwayland.wlr_xwayland = |
173 | wlr_xwayland_create(server->wl_display, server->compositor, true); | 174 | wlr_xwayland_create(server->wl_display, server->compositor, |
175 | config->xwayland == XWAYLAND_MODE_LAZY); | ||
174 | wl_signal_add(&server->xwayland.wlr_xwayland->events.new_surface, | 176 | wl_signal_add(&server->xwayland.wlr_xwayland->events.new_surface, |
175 | &server->xwayland_surface); | 177 | &server->xwayland_surface); |
176 | server->xwayland_surface.notify = handle_xwayland_surface; | 178 | server->xwayland_surface.notify = handle_xwayland_surface; |
diff --git a/sway/sway.5.scd b/sway/sway.5.scd index 8049836b..128663cd 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd | |||
@@ -85,9 +85,12 @@ The following commands may only be used in the configuration file. | |||
85 | It can be disabled by setting the command to a single dash: | 85 | It can be disabled by setting the command to a single dash: |
86 | _swaynag\_command -_ | 86 | _swaynag\_command -_ |
87 | 87 | ||
88 | *xwayland* enable|disable | 88 | *xwayland* enable|disable|force |
89 | Enables or disables Xwayland support, which allows X11 applications to be | 89 | Enables or disables Xwayland support, which allows X11 applications to be |
90 | used. | 90 | used. _enable_ will lazily load Xwayland so Xwayland will not be launched |
91 | until the first client attempts to connect. In some cases, such as slower | ||
92 | machines, it may be desirable to have Xwayland started immediately by | ||
93 | using _force_ instead of _enable_. | ||
91 | 94 | ||
92 | The following commands cannot be used directly in the configuration file. | 95 | The following commands cannot be used directly in the configuration file. |
93 | They are expected to be used with *bindsym* or at runtime through *swaymsg*(1). | 96 | They are expected to be used with *bindsym* or at runtime through *swaymsg*(1). |