aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/commands/bar.c2
-rw-r--r--sway/commands/bar/status_edge_padding.c21
-rw-r--r--sway/commands/bar/status_padding.c21
-rw-r--r--sway/commands/bind.c126
-rw-r--r--sway/commands/input/events.c76
-rw-r--r--sway/config.c21
-rw-r--r--sway/config/bar.c4
-rw-r--r--sway/input/cursor.c73
-rw-r--r--sway/ipc-json.c25
-rw-r--r--sway/ipc-server.c8
-rw-r--r--sway/meson.build2
-rw-r--r--sway/sway-bar.5.scd12
-rw-r--r--sway/sway-input.5.scd9
-rw-r--r--sway/sway.5.scd2
-rw-r--r--sway/tree/output.c2
15 files changed, 335 insertions, 69 deletions
diff --git a/sway/commands/bar.c b/sway/commands/bar.c
index 507ee10a..3e7c1b0f 100644
--- a/sway/commands/bar.c
+++ b/sway/commands/bar.c
@@ -23,6 +23,8 @@ static struct cmd_handler bar_handlers[] = {
{ "position", bar_cmd_position },
{ "separator_symbol", bar_cmd_separator_symbol },
{ "status_command", bar_cmd_status_command },
+ { "status_edge_padding", bar_cmd_status_edge_padding },
+ { "status_padding", bar_cmd_status_padding },
{ "strip_workspace_name", bar_cmd_strip_workspace_name },
{ "strip_workspace_numbers", bar_cmd_strip_workspace_numbers },
{ "tray_bindsym", bar_cmd_tray_bindsym },
diff --git a/sway/commands/bar/status_edge_padding.c b/sway/commands/bar/status_edge_padding.c
new file mode 100644
index 00000000..f3b10631
--- /dev/null
+++ b/sway/commands/bar/status_edge_padding.c
@@ -0,0 +1,21 @@
+#include <stdlib.h>
+#include <string.h>
+#include "sway/commands.h"
+#include "log.h"
+
+struct cmd_results *bar_cmd_status_edge_padding(int argc, char **argv) {
+ struct cmd_results *error = NULL;
+ if ((error = checkarg(argc, "status_edge_padding", EXPECTED_EQUAL_TO, 1))) {
+ return error;
+ }
+ char *end;
+ int padding = strtol(argv[0], &end, 10);
+ if (strlen(end) || padding < 0) {
+ return cmd_results_new(CMD_INVALID, "status_edge_padding",
+ "Padding must be a positive integer");
+ }
+ config->current_bar->status_edge_padding = padding;
+ wlr_log(WLR_DEBUG, "Status edge padding on bar %s: %d",
+ config->current_bar->id, config->current_bar->status_edge_padding);
+ return cmd_results_new(CMD_SUCCESS, NULL, NULL);
+}
diff --git a/sway/commands/bar/status_padding.c b/sway/commands/bar/status_padding.c
new file mode 100644
index 00000000..13b8eb6b
--- /dev/null
+++ b/sway/commands/bar/status_padding.c
@@ -0,0 +1,21 @@
+#include <stdlib.h>
+#include <string.h>
+#include "sway/commands.h"
+#include "log.h"
+
+struct cmd_results *bar_cmd_status_padding(int argc, char **argv) {
+ struct cmd_results *error = NULL;
+ if ((error = checkarg(argc, "status_padding", EXPECTED_EQUAL_TO, 1))) {
+ return error;
+ }
+ char *end;
+ int padding = strtol(argv[0], &end, 10);
+ if (strlen(end) || padding < 0) {
+ return cmd_results_new(CMD_INVALID, "status_padding",
+ "Padding must be a positive integer");
+ }
+ config->current_bar->status_padding = padding;
+ wlr_log(WLR_DEBUG, "Status padding on bar %s: %d",
+ config->current_bar->id, config->current_bar->status_padding);
+ return cmd_results_new(CMD_SUCCESS, NULL, NULL);
+}
diff --git a/sway/commands/bind.c b/sway/commands/bind.c
index 4fceaf8c..be47d412 100644
--- a/sway/commands/bind.c
+++ b/sway/commands/bind.c
@@ -85,69 +85,91 @@ static int key_qsort_cmp(const void *keyp_a, const void *keyp_b) {
*/
static struct cmd_results *identify_key(const char* name, bool first_key,
uint32_t* key_val, enum binding_input_type* type) {
- if (*type == BINDING_KEYCODE) {
- // check for keycode
- xkb_keycode_t keycode = strtol(name, NULL, 10);
- if (!xkb_keycode_is_legal_ext(keycode)) {
- return cmd_results_new(CMD_INVALID, "bindcode",
- "Invalid keycode '%s'", name);
+ if (*type == BINDING_MOUSECODE) {
+ // check for mouse bindcodes
+ char *message = NULL;
+ uint32_t button = get_mouse_bindcode(name, &message);
+ if (!button) {
+ if (message) {
+ struct cmd_results *error =
+ cmd_results_new(CMD_INVALID, "bindcode", message);
+ free(message);
+ return error;
+ } else {
+ return cmd_results_new(CMD_INVALID, "bindcode",
+ "Unknown button code %s", name);
+ }
}
- *key_val = keycode;
- } else {
- // check for keysym
- xkb_keysym_t keysym = xkb_keysym_from_name(name,
- XKB_KEYSYM_CASE_INSENSITIVE);
-
- // Check for mouse binding
- uint32_t button = 0;
- if (strncasecmp(name, "button", strlen("button")) == 0) {
- // Map to x11 mouse buttons
- button = name[strlen("button")] - '0';
- if (button < 1 || button > 9 || strlen(name) > strlen("button0")) {
+ *key_val = button;
+ } else if (*type == BINDING_MOUSESYM) {
+ // check for mouse bindsyms (x11 buttons or event names)
+ char *message = NULL;
+ uint32_t button = get_mouse_bindsym(name, &message);
+ if (!button) {
+ if (message) {
+ struct cmd_results *error =
+ cmd_results_new(CMD_INVALID, "bindsym", message);
+ free(message);
+ return error;
+ } else if (!button) {
return cmd_results_new(CMD_INVALID, "bindsym",
- "Only buttons 1-9 are supported. For other mouse "
- "buttons, use the name of the event code.");
+ "Unknown button %s", name);
}
- uint32_t buttons[] = {BTN_LEFT, BTN_MIDDLE, BTN_RIGHT,
- SWAY_SCROLL_UP, SWAY_SCROLL_DOWN, SWAY_SCROLL_LEFT,
- SWAY_SCROLL_RIGHT, BTN_SIDE, BTN_EXTRA};
- button = buttons[button - 1];
- } else if (strncmp(name, "BTN_", strlen("BTN_")) == 0) {
- // Get event code
- int code = libevdev_event_code_from_name(EV_KEY, name);
- if (code == -1) {
- return cmd_results_new(CMD_INVALID, "bindsym",
- "Invalid event code name %s", name);
+ }
+ *key_val = button;
+ } else if (*type == BINDING_KEYCODE) {
+ // check for keycode. If it is the first key, allow mouse bindcodes
+ if (first_key) {
+ char *message = NULL;
+ uint32_t button = get_mouse_bindcode(name, &message);
+ free(message);
+ if (button) {
+ *type = BINDING_MOUSECODE;
+ *key_val = button;
+ return NULL;
}
- button = code;
}
- if (*type == BINDING_KEYSYM) {
- if (button) {
- if (first_key) {
- *type = BINDING_MOUSE;
- *key_val = button;
- } else {
- return cmd_results_new(CMD_INVALID, "bindsym",
- "Mixed button '%s' into key sequence", name);
- }
- } else if (keysym) {
- *key_val = keysym;
+ xkb_keycode_t keycode = strtol(name, NULL, 10);
+ if (!xkb_keycode_is_legal_ext(keycode)) {
+ if (first_key) {
+ return cmd_results_new(CMD_INVALID, "bindcode",
+ "Invalid keycode or button code '%s'", name);
} else {
- return cmd_results_new(CMD_INVALID, "bindsym",
- "Unknown key '%s'", name);
+ return cmd_results_new(CMD_INVALID, "bindcode",
+ "Invalid keycode '%s'", name);
}
- } else {
- if (button) {
+ }
+ *key_val = keycode;
+ } else {
+ // check for keysym. If it is the first key, allow mouse bindsyms
+ if (first_key) {
+ char *message = NULL;
+ uint32_t button = get_mouse_bindsym(name, &message);
+ if (message) {
+ struct cmd_results *error =
+ cmd_results_new(CMD_INVALID, "bindsym", message);
+ free(message);
+ return error;
+ } else if (button) {
+ *type = BINDING_MOUSESYM;
*key_val = button;
- } else if (keysym) {
+ return NULL;
+ }
+ }
+
+ xkb_keysym_t keysym = xkb_keysym_from_name(name,
+ XKB_KEYSYM_CASE_INSENSITIVE);
+ if (!keysym) {
+ if (first_key) {
return cmd_results_new(CMD_INVALID, "bindsym",
- "Mixed keysym '%s' into button sequence", name);
+ "Unknown key or button '%s'", name);
} else {
return cmd_results_new(CMD_INVALID, "bindsym",
- "Unknown button '%s'", name);
+ "Unknown key '%s'", name);
}
}
+ *key_val = keysym;
}
return NULL;
}
@@ -201,7 +223,8 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
}
if (binding->flags & (BINDING_BORDER | BINDING_CONTENTS | BINDING_TITLEBAR)
|| exclude_titlebar) {
- binding->type = BINDING_MOUSE;
+ binding->type = binding->type == BINDING_KEYCODE ?
+ BINDING_MOUSECODE : BINDING_MOUSESYM;
}
if (argc < 2) {
@@ -249,7 +272,8 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
// that this is one
if (exclude_titlebar) {
binding->flags &= ~BINDING_TITLEBAR;
- } else if (binding->type == BINDING_MOUSE) {
+ } else if (binding->type == BINDING_MOUSECODE
+ || binding->type == BINDING_MOUSESYM) {
binding->flags |= BINDING_TITLEBAR;
}
diff --git a/sway/commands/input/events.c b/sway/commands/input/events.c
index e7ed69c6..69f46269 100644
--- a/sway/commands/input/events.c
+++ b/sway/commands/input/events.c
@@ -1,10 +1,69 @@
+#include <limits.h>
#include <string.h>
#include <strings.h>
+#include <wlr/backend/libinput.h>
#include "sway/config.h"
#include "sway/commands.h"
#include "sway/input/input-manager.h"
#include "log.h"
+static void toggle_send_events_for_device(struct input_config *ic,
+ struct sway_input_device *input_device) {
+ struct wlr_input_device *wlr_device = input_device->wlr_device;
+ if (!wlr_input_device_is_libinput(wlr_device)) {
+ return;
+ }
+ struct libinput_device *libinput_dev
+ = wlr_libinput_get_device_handle(wlr_device);
+
+ enum libinput_config_send_events_mode mode =
+ libinput_device_config_send_events_get_mode(libinput_dev);
+ uint32_t possible =
+ libinput_device_config_send_events_get_modes(libinput_dev);
+
+ switch (mode) {
+ case LIBINPUT_CONFIG_SEND_EVENTS_ENABLED:
+ mode = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE;
+ if (possible & mode) {
+ break;
+ }
+ // fall through
+ case LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE:
+ mode = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED;
+ if (possible & mode) {
+ break;
+ }
+ // fall through
+ case LIBINPUT_CONFIG_SEND_EVENTS_DISABLED:
+ default:
+ mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
+ break;
+ }
+
+ ic->send_events = mode;
+}
+
+static void toggle_send_events(struct input_config *ic) {
+ struct sway_input_device *input_device = NULL;
+ wl_list_for_each(input_device, &server.input->devices, link) {
+ if (strcmp(input_device->identifier, ic->identifier) == 0) {
+ toggle_send_events_for_device(ic, input_device);
+ }
+ }
+}
+
+static void toggle_wildcard_send_events() {
+ struct sway_input_device *input_device = NULL;
+ wl_list_for_each(input_device, &server.input->devices, link) {
+ struct input_config *ic = new_input_config(input_device->identifier);
+ if (!ic) {
+ break;
+ }
+ toggle_send_events_for_device(ic, input_device);
+ store_input_config(ic);
+ }
+}
+
struct cmd_results *input_cmd_events(int argc, char **argv) {
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "events", EXPECTED_AT_LEAST, 1))) {
@@ -23,9 +82,24 @@ struct cmd_results *input_cmd_events(int argc, char **argv) {
} else if (strcasecmp(argv[0], "disabled_on_external_mouse") == 0) {
ic->send_events =
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE;
- } else {
+ } else if (config->reading) {
return cmd_results_new(CMD_INVALID, "events",
"Expected 'events <enabled|disabled|disabled_on_external_mouse>'");
+ } else if (strcasecmp(argv[0], "toggle") == 0) {
+ if (strcmp(ic->identifier, "*") == 0) {
+ // Update the device input configs and then reset the wildcard
+ // config send events mode so that is does not override the device
+ // ones. The device ones will be applied when attempting to apply
+ // the wildcard config
+ toggle_wildcard_send_events();
+ ic->send_events = INT_MIN;
+ } else {
+ toggle_send_events(ic);
+ }
+ } else {
+ return cmd_results_new(CMD_INVALID, "events",
+ "Expected 'events <enabled|disabled|disabled_on_external_mouse|"
+ "toggle>'");
}
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
diff --git a/sway/config.c b/sway/config.c
index cd0857f4..5ca4806c 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -573,15 +573,18 @@ bool load_include_configs(const char *path, struct sway_config *config,
}
// get line, with backslash continuation
-static ssize_t getline_with_cont(char **lineptr, size_t *line_size, FILE *file) {
+static ssize_t getline_with_cont(char **lineptr, size_t *line_size, FILE *file,
+ int *nlines) {
char *next_line = NULL;
size_t next_line_size = 0;
ssize_t nread = getline(lineptr, line_size, file);
+ *nlines = nread == -1 ? 0 : 1;
while (nread >= 2 && strcmp(&(*lineptr)[nread - 2], "\\\n") == 0) {
ssize_t next_nread = getline(&next_line, &next_line_size, file);
if (next_nread == -1) {
break;
}
+ (*nlines)++;
nread += next_nread - 2;
if ((ssize_t) *line_size < nread + 1) {
@@ -599,6 +602,7 @@ static ssize_t getline_with_cont(char **lineptr, size_t *line_size, FILE *file)
}
static int detect_brace(FILE *file) {
+ int ret = 0;
int lines = 0;
long pos = ftell(file);
char *line = NULL;
@@ -607,15 +611,17 @@ static int detect_brace(FILE *file) {
lines++;
strip_whitespace(line);
if (*line) {
- if (strcmp(line, "{") != 0) {
- fseek(file, pos, SEEK_SET);
- lines = 0;
+ if (strcmp(line, "{") == 0) {
+ ret = lines;
}
break;
}
}
free(line);
- return lines;
+ if (ret == 0) {
+ fseek(file, pos, SEEK_SET);
+ }
+ return ret;
}
static char *expand_line(const char *block, const char *line, bool add_brace) {
@@ -662,7 +668,8 @@ bool read_config(FILE *file, struct sway_config *config,
ssize_t nread;
list_t *stack = create_list();
size_t read = 0;
- while ((nread = getline_with_cont(&line, &line_size, file)) != -1) {
+ int nlines = 0;
+ while ((nread = getline_with_cont(&line, &line_size, file, &nlines)) != -1) {
if (reading_main_config) {
if (read + nread > config_size) {
wlr_log(WLR_ERROR, "Config file changed during reading");
@@ -678,7 +685,7 @@ bool read_config(FILE *file, struct sway_config *config,
line[nread - 1] = '\0';
}
- line_number++;
+ line_number += nlines;
wlr_log(WLR_DEBUG, "Read line %d: %s", line_number, line);
strip_whitespace(line);
diff --git a/sway/config/bar.c b/sway/config/bar.c
index 670219f1..701bf051 100644
--- a/sway/config/bar.c
+++ b/sway/config/bar.c
@@ -96,7 +96,7 @@ struct bar_config *default_bar_config(void) {
bar->pango_markup = false;
bar->swaybar_command = NULL;
bar->font = NULL;
- bar->height = -1;
+ bar->height = 0;
bar->workspace_buttons = true;
bar->wrap_scroll = false;
bar->separator_symbol = NULL;
@@ -106,6 +106,8 @@ struct bar_config *default_bar_config(void) {
bar->verbose = false;
bar->pid = 0;
bar->modifier = get_modifier_mask_by_name("Mod4");
+ bar->status_padding = 1;
+ bar->status_edge_padding = 3;
if (!(bar->mode = strdup("dock"))) {
goto cleanup;
}
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 96feb47d..9af7ef57 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -2,8 +2,10 @@
#include <math.h>
#include <libevdev/libevdev.h>
#include <linux/input-event-codes.h>
+#include <errno.h>
#include <float.h>
#include <limits.h>
+#include <strings.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_xcursor_manager.h>
#include <wlr/types/wlr_idle.h>
@@ -85,6 +87,10 @@ static struct sway_node *node_at_coords(
return NULL;
}
struct sway_output *output = wlr_output->data;
+ if (!output) {
+ // output is being destroyed
+ return NULL;
+ }
double ox = lx, oy = ly;
wlr_output_layout_output_coords(root->output_layout, wlr_output, &ox, &oy);
@@ -1092,6 +1098,8 @@ static void dispatch_cursor_axis(struct sway_cursor *cursor,
enum wlr_edges edge = cont ? find_edge(cont, cursor) : WLR_EDGE_NONE;
bool on_border = edge != WLR_EDGE_NONE;
bool on_titlebar = cont && !on_border && !surface;
+ bool on_titlebar_border = cont && on_border &&
+ cursor->cursor->y < cont->content_y;
bool on_contents = cont && !on_border && surface;
float scroll_factor =
(ic == NULL || ic->scroll_factor == FLT_MIN) ? 1.0f : ic->scroll_factor;
@@ -1117,7 +1125,7 @@ static void dispatch_cursor_axis(struct sway_cursor *cursor,
}
// Scrolling on a tabbed or stacked title bar (handled as press event)
- if (!handled && on_titlebar) {
+ if (!handled && (on_titlebar || on_titlebar_border)) {
enum sway_container_layout layout = container_parent_layout(cont);
if (layout == L_TABBED || layout == L_STACKED) {
struct sway_node *tabcontainer = node_get_parent(node);
@@ -1527,3 +1535,66 @@ void cursor_warp_to_workspace(struct sway_cursor *cursor,
wlr_cursor_warp(cursor->cursor, NULL, x, y);
}
+
+uint32_t get_mouse_bindsym(const char *name, char **error) {
+ if (strncasecmp(name, "button", strlen("button")) == 0) {
+ // Map to x11 mouse buttons
+ int number = name[strlen("button")] - '0';
+ if (number < 1 || number > 9 || strlen(name) > strlen("button0")) {
+ *error = strdup("Only buttons 1-9 are supported. For other mouse "
+ "buttons, use the name of the event code.");
+ return 0;
+ }
+ static const uint32_t buttons[] = {BTN_LEFT, BTN_MIDDLE, BTN_RIGHT,
+ SWAY_SCROLL_UP, SWAY_SCROLL_DOWN, SWAY_SCROLL_LEFT,
+ SWAY_SCROLL_RIGHT, BTN_SIDE, BTN_EXTRA};
+ return buttons[number - 1];
+ } else if (strncmp(name, "BTN_", strlen("BTN_")) == 0) {
+ // Get event code from name
+ int code = libevdev_event_code_from_name(EV_KEY, name);
+ if (code == -1) {
+ size_t len = snprintf(NULL, 0, "Unknown event %s", name) + 1;
+ *error = malloc(len);
+ if (*error) {
+ snprintf(*error, len, "Unknown event %s", name);
+ }
+ return 0;
+ }
+ return code;
+ }
+ return 0;
+}
+
+uint32_t get_mouse_bindcode(const char *name, char **error) {
+ // Validate event code
+ errno = 0;
+ char *endptr;
+ int code = strtol(name, &endptr, 10);
+ if (endptr == name && code <= 0) {
+ *error = strdup("Button event code must be a positive integer.");
+ return 0;
+ } else if (errno == ERANGE) {
+ *error = strdup("Button event code out of range.");
+ return 0;
+ }
+ const char *event = libevdev_event_code_get_name(EV_KEY, code);
+ if (!event || strncmp(event, "BTN_", strlen("BTN_")) != 0) {
+ size_t len = snprintf(NULL, 0, "Event code %d (%s) is not a button",
+ code, event) + 1;
+ *error = malloc(len);
+ if (*error) {
+ snprintf(*error, len, "Event code %d (%s) is not a button",
+ code, event);
+ }
+ return 0;
+ }
+ return code;
+}
+
+uint32_t get_mouse_button(const char *name, char **error) {
+ uint32_t button = get_mouse_bindsym(name, error);
+ if (!button && !error) {
+ button = get_mouse_bindcode(name, error);
+ }
+ return button;
+}
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index 53e0e335..15f89f65 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -11,6 +11,7 @@
#include "sway/output.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
+#include <wlr/backend/libinput.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_output.h>
#include <xkbcommon/xkbcommon.h>
@@ -598,6 +599,26 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) {
}
}
+ if (wlr_input_device_is_libinput(device->wlr_device)) {
+ struct libinput_device *libinput_dev;
+ libinput_dev = wlr_libinput_get_device_handle(device->wlr_device);
+
+ const char *events = "unknown";
+ switch (libinput_device_config_send_events_get_mode(libinput_dev)) {
+ case LIBINPUT_CONFIG_SEND_EVENTS_ENABLED:
+ events = "enabled";
+ break;
+ case LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE:
+ events = "disabled_on_external_mouse";
+ break;
+ case LIBINPUT_CONFIG_SEND_EVENTS_DISABLED:
+ events = "disabled";
+ break;
+ }
+ json_object_object_add(object, "libinput_send_events",
+ json_object_new_string(events));
+ }
+
return object;
}
@@ -660,6 +681,10 @@ json_object *ipc_json_describe_bar_config(struct bar_config *bar) {
}
json_object_object_add(json, "bar_height",
json_object_new_int(bar->height));
+ json_object_object_add(json, "status_padding",
+ json_object_new_int(bar->status_padding));
+ json_object_object_add(json, "status_edge_padding",
+ json_object_new_int(bar->status_edge_padding));
json_object_object_add(json, "wrap_scroll",
json_object_new_boolean(bar->wrap_scroll));
json_object_object_add(json, "workspace_buttons",
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 456db866..ff1bc89f 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -445,8 +445,12 @@ void ipc_event_binding(struct sway_binding *binding) {
json_object_object_add(json_binding, "input_code", json_object_new_int(input_code));
json_object_object_add(json_binding, "symbols", symbols);
json_object_object_add(json_binding, "symbol", symbol);
- json_object_object_add(json_binding, "input_type", binding->type == BINDING_MOUSE ?
- json_object_new_string("mouse") : json_object_new_string("keyboard"));
+
+ bool mouse = binding->type == BINDING_MOUSECODE ||
+ binding->type == BINDING_MOUSESYM;
+ json_object_object_add(json_binding, "input_type", mouse
+ ? json_object_new_string("mouse")
+ : json_object_new_string("keyboard"));
json_object *json = json_object_new_object();
json_object_object_add(json, "change", json_object_new_string("run"));
diff --git a/sway/meson.build b/sway/meson.build
index 98676ce0..ab5862c5 100644
--- a/sway/meson.build
+++ b/sway/meson.build
@@ -116,6 +116,8 @@ sway_sources = files(
'commands/bar/position.c',
'commands/bar/separator_symbol.c',
'commands/bar/status_command.c',
+ 'commands/bar/status_edge_padding.c',
+ 'commands/bar/status_padding.c',
'commands/bar/strip_workspace_numbers.c',
'commands/bar/strip_workspace_name.c',
'commands/bar/swaybar_command.c',
diff --git a/sway/sway-bar.5.scd b/sway/sway-bar.5.scd
index 2357591d..e1a4a937 100644
--- a/sway/sway-bar.5.scd
+++ b/sway/sway-bar.5.scd
@@ -69,7 +69,7 @@ Sway allows configuring swaybar in the sway configuration file.
use.
*height* <height>
- Sets the height of the bar. Default height will match the font size.
+ Sets the height of the bar. Default height (0) will match the font size.
*bindsym* [--release] button<n> <command>
Executes _command_ when mouse button _n_ has been pressed (or if _released_
@@ -92,6 +92,16 @@ Sway allows configuring swaybar in the sway configuration file.
*modifier* <Modifier>|none
Specifies the modifier key that shows a hidden bar. Default is _Mod4_.
+*status\_padding* <padding>
+ Sets the vertical padding that is used for the status line. The default is
+ _1_. If _padding_ is _0_, blocks will be able to take up the full height of
+ the bar. This value will be multiplied by the output scale.
+
+*status\_edge\_padding* <padding>
+ Sets the padding that is used when the status line is at the right edge of
+ the bar. This value will be multiplied by the output scale. The default is
+ _3_.
+
## TRAY
Swaybar provides a system tray where third-party applications may place icons.
diff --git a/sway/sway-input.5.scd b/sway/sway-input.5.scd
index 820194a9..c54babaa 100644
--- a/sway/sway-input.5.scd
+++ b/sway/sway-input.5.scd
@@ -82,9 +82,12 @@ The following commands may only be used in the configuration file.
*input* <identifier> dwt enabled|disabled
Enables or disables disable-while-typing for the specified input device.
-*input* <identifier> events enabled|disabled|disabled\_on\_external\_mouse
- Enables or disables send\_events for specified input device. (Disabling
- send\_events disables the input device)
+*input* <identifier> events enabled|disabled|disabled\_on\_external\_mouse|toggle
+ Enables or disables send\_events for specified input device. Disabling
+ send\_events disables the input device. The _toggle_ option cannot be used
+ in the config. The order is enabled, disabled\_on\_external\_mouse,
+ disabled, (loop back to enabled). Any mode which is not supported by the
+ device will be skipped during the toggle.
*input* <identifier> left\_handed enabled|disabled
Enables or disables left handed mode for specified input device.
diff --git a/sway/sway.5.scd b/sway/sway.5.scd
index 3757a097..3398ad58 100644
--- a/sway/sway.5.scd
+++ b/sway/sway.5.scd
@@ -302,7 +302,7 @@ runtime.
```
*bindcode* [--release|--locked] [--input-device=<device>] [--no-warn] <code> <command>
- is also available for binding with key codes instead of key names.
+ is also available for binding with key/button codes instead of key/button names.
*client.<class>* <border> <background> <text> <indicator> <child\_border>
Configures the color of window borders and title bars. All 5 colors are
diff --git a/sway/tree/output.c b/sway/tree/output.c
index 95ab9378..f24be010 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -58,6 +58,7 @@ struct sway_output *output_create(struct wlr_output *wlr_output) {
wlr_output->data = output;
wl_signal_add(&wlr_output->events.destroy, &output->destroy);
+ wl_signal_init(&output->events.destroy);
wl_list_insert(&root->all_outputs, &output->link);
@@ -76,7 +77,6 @@ void output_enable(struct sway_output *output, struct output_config *oc) {
for (size_t i = 0; i < len; ++i) {
wl_list_init(&output->layers[i]);
}
- wl_signal_init(&output->events.destroy);
output->enabled = true;
list_add(root->outputs, output);