diff options
-rw-r--r-- | include/sway/commands.h | 1 | ||||
-rw-r--r-- | include/sway/config.h | 3 | ||||
-rw-r--r-- | sway/commands.c | 1 | ||||
-rw-r--r-- | sway/commands/primary_selection.c | 23 | ||||
-rw-r--r-- | sway/config.c | 1 | ||||
-rw-r--r-- | sway/meson.build | 1 | ||||
-rw-r--r-- | sway/server.c | 5 | ||||
-rw-r--r-- | sway/sway.5.scd | 4 |
8 files changed, 37 insertions, 2 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index 7fad26a1..ddd2f219 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -165,6 +165,7 @@ sway_cmd cmd_no_focus; | |||
165 | sway_cmd cmd_output; | 165 | sway_cmd cmd_output; |
166 | sway_cmd cmd_permit; | 166 | sway_cmd cmd_permit; |
167 | sway_cmd cmd_popup_during_fullscreen; | 167 | sway_cmd cmd_popup_during_fullscreen; |
168 | sway_cmd cmd_primary_selection; | ||
168 | sway_cmd cmd_reject; | 169 | sway_cmd cmd_reject; |
169 | sway_cmd cmd_reload; | 170 | sway_cmd cmd_reload; |
170 | sway_cmd cmd_rename; | 171 | sway_cmd cmd_rename; |
diff --git a/include/sway/config.h b/include/sway/config.h index 190ab13b..ce2b8502 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -530,6 +530,7 @@ struct sway_config { | |||
530 | bool auto_back_and_forth; | 530 | bool auto_back_and_forth; |
531 | bool show_marks; | 531 | bool show_marks; |
532 | enum alignment title_align; | 532 | enum alignment title_align; |
533 | bool primary_selection; | ||
533 | 534 | ||
534 | bool tiling_drag; | 535 | bool tiling_drag; |
535 | int tiling_drag_threshold; | 536 | int tiling_drag_threshold; |
@@ -719,7 +720,7 @@ void free_workspace_config(struct workspace_config *wsc); | |||
719 | /** | 720 | /** |
720 | * Updates the value of config->font_height based on the metrics for title's | 721 | * Updates the value of config->font_height based on the metrics for title's |
721 | * font as reported by pango. | 722 | * font as reported by pango. |
722 | * | 723 | * |
723 | * If the height has changed, all containers will be rearranged to take on the | 724 | * If the height has changed, all containers will be rearranged to take on the |
724 | * new size. | 725 | * new size. |
725 | */ | 726 | */ |
diff --git a/sway/commands.c b/sway/commands.c index 2160a970..041da7ea 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -82,6 +82,7 @@ static const struct cmd_handler handlers[] = { | |||
82 | { "no_focus", cmd_no_focus }, | 82 | { "no_focus", cmd_no_focus }, |
83 | { "output", cmd_output }, | 83 | { "output", cmd_output }, |
84 | { "popup_during_fullscreen", cmd_popup_during_fullscreen }, | 84 | { "popup_during_fullscreen", cmd_popup_during_fullscreen }, |
85 | { "primary_selection", cmd_primary_selection }, | ||
85 | { "seat", cmd_seat }, | 86 | { "seat", cmd_seat }, |
86 | { "set", cmd_set }, | 87 | { "set", cmd_set }, |
87 | { "show_marks", cmd_show_marks }, | 88 | { "show_marks", cmd_show_marks }, |
diff --git a/sway/commands/primary_selection.c b/sway/commands/primary_selection.c new file mode 100644 index 00000000..585b079d --- /dev/null +++ b/sway/commands/primary_selection.c | |||
@@ -0,0 +1,23 @@ | |||
1 | #include <string.h> | ||
2 | #include <strings.h> | ||
3 | #include "sway/config.h" | ||
4 | #include "sway/commands.h" | ||
5 | #include "util.h" | ||
6 | |||
7 | struct cmd_results *cmd_primary_selection(int argc, char **argv) { | ||
8 | struct cmd_results *error = NULL; | ||
9 | if ((error = checkarg(argc, "primary_selection", EXPECTED_EQUAL_TO, 1))) { | ||
10 | return error; | ||
11 | } | ||
12 | |||
13 | bool primary_selection = parse_boolean(argv[0], true); | ||
14 | |||
15 | if (config->reloading && config->primary_selection != primary_selection) { | ||
16 | return cmd_results_new(CMD_FAILURE, | ||
17 | "primary_selection can only be enabled/disabled at launch"); | ||
18 | } | ||
19 | |||
20 | config->primary_selection = parse_boolean(argv[0], true); | ||
21 | |||
22 | return cmd_results_new(CMD_SUCCESS, NULL); | ||
23 | } | ||
diff --git a/sway/config.c b/sway/config.c index b41dd871..1f2bb686 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -273,6 +273,7 @@ static void config_defaults(struct sway_config *config) { | |||
273 | config->title_align = ALIGN_LEFT; | 273 | config->title_align = ALIGN_LEFT; |
274 | config->tiling_drag = true; | 274 | config->tiling_drag = true; |
275 | config->tiling_drag_threshold = 9; | 275 | config->tiling_drag_threshold = 9; |
276 | config->primary_selection = true; | ||
276 | 277 | ||
277 | config->smart_gaps = SMART_GAPS_OFF; | 278 | config->smart_gaps = SMART_GAPS_OFF; |
278 | config->gaps_inner = 0; | 279 | config->gaps_inner = 0; |
diff --git a/sway/meson.build b/sway/meson.build index de10e14f..b2412d5e 100644 --- a/sway/meson.build +++ b/sway/meson.build | |||
@@ -86,6 +86,7 @@ sway_sources = files( | |||
86 | 'commands/nop.c', | 86 | 'commands/nop.c', |
87 | 'commands/output.c', | 87 | 'commands/output.c', |
88 | 'commands/popup_during_fullscreen.c', | 88 | 'commands/popup_during_fullscreen.c', |
89 | 'commands/primary_selection.c', | ||
89 | 'commands/reload.c', | 90 | 'commands/reload.c', |
90 | 'commands/rename.c', | 91 | 'commands/rename.c', |
91 | 'commands/resize.c', | 92 | 'commands/resize.c', |
diff --git a/sway/server.c b/sway/server.c index 2db069a2..43ff8cfb 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -210,7 +210,6 @@ bool server_init(struct sway_server *server) { | |||
210 | wlr_export_dmabuf_manager_v1_create(server->wl_display); | 210 | wlr_export_dmabuf_manager_v1_create(server->wl_display); |
211 | wlr_screencopy_manager_v1_create(server->wl_display); | 211 | wlr_screencopy_manager_v1_create(server->wl_display); |
212 | wlr_data_control_manager_v1_create(server->wl_display); | 212 | wlr_data_control_manager_v1_create(server->wl_display); |
213 | wlr_primary_selection_v1_device_manager_create(server->wl_display); | ||
214 | wlr_viewporter_create(server->wl_display); | 213 | wlr_viewporter_create(server->wl_display); |
215 | wlr_single_pixel_buffer_manager_v1_create(server->wl_display); | 214 | wlr_single_pixel_buffer_manager_v1_create(server->wl_display); |
216 | server->content_type_manager_v1 = | 215 | server->content_type_manager_v1 = |
@@ -308,6 +307,10 @@ bool server_start(struct sway_server *server) { | |||
308 | } | 307 | } |
309 | #endif | 308 | #endif |
310 | 309 | ||
310 | if (config->primary_selection) { | ||
311 | wlr_primary_selection_v1_device_manager_create(server->wl_display); | ||
312 | } | ||
313 | |||
311 | sway_log(SWAY_INFO, "Starting backend on wayland display '%s'", | 314 | sway_log(SWAY_INFO, "Starting backend on wayland display '%s'", |
312 | server->socket); | 315 | server->socket); |
313 | if (!wlr_backend_start(server->backend)) { | 316 | if (!wlr_backend_start(server->backend)) { |
diff --git a/sway/sway.5.scd b/sway/sway.5.scd index f6aab2d4..25082c41 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd | |||
@@ -807,6 +807,10 @@ The default colors are: | |||
807 | dialog will not be rendered. If _leave_fullscreen_, the view will exit | 807 | dialog will not be rendered. If _leave_fullscreen_, the view will exit |
808 | fullscreen mode and the dialog will be rendered. | 808 | fullscreen mode and the dialog will be rendered. |
809 | 809 | ||
810 | *primary_selection* enabled|disabled | ||
811 | Enable or disable the primary selection clipboard. May only be configured | ||
812 | at launch. Default is _enabled_. | ||
813 | |||
810 | *set* $<name> <value> | 814 | *set* $<name> <value> |
811 | Sets variable $_name_ to _value_. You can use the new variable in the | 815 | Sets variable $_name_ to _value_. You can use the new variable in the |
812 | arguments of future commands. When the variable is used, it can be escaped | 816 | arguments of future commands. When the variable is used, it can be escaped |