sway
sway copied to clipboard
map_to_output '*' leaves input disabled
Relevant log lines:
00:31:39.487 [INFO] [sway/commands.c:257] Handling command 'input MY_USB_MOUSE map_to_output *'
00:31:39.487 [DEBUG] [sway/commands/input.c:54] entering input block: MY_USB_MOUSE
00:31:39.487 [DEBUG] [sway/config/input.c:15] new_input_config(MY_USB_MOUSE)
00:31:39.487 [DEBUG] [sway/commands.c:428] Subcommand: map_to_output *
00:31:39.487 [DEBUG] [sway/config/input.c:15] new_input_config(temp)
00:31:39.491 [DEBUG] [sway/config/input.c:350] Config stored for input MY_USB_MOUSE
00:31:39.491 [DEBUG] [sway/input/libinput.c:198] sway_input_configure_libinput_device('MY_USB_MOUSE' on 'MY_USB_MOUSE')
00:31:39.491 [DEBUG] [sway/input/libinput.c:204] pointer 'MY_USB_MOUSE' is mapped to offline output '*'; disabling input
00:31:39.491 [DEBUG] [sway/input/libinput.c:23] send_events_set_mode(1)
00:31:39.492 [DEBUG] [sway/input/seat.c:709] Applying input config to MY_USB_MOUSE
00:31:39.492 [DEBUG] [sway/input/seat.c:739] Mapping input device MY_USB_MOUSE to output *
00:31:39.492 [DEBUG] [sway/input/seat.c:746] Reset output mapping
I had a similar issue: I mapped to two different outputs, because I was lazy and use the same config for two different laptops with two different output names.
Now, it seems to disable the input if I do that. My fix was simple in my case which was to have a different config file for screen mapping for my laptops, but I don't know if that would work for your issue.
I also ran into this issue, but found a workaround: Judging from the debug output, sway first parses the full config, then sets up input devices, then detects and configures outputs. Thus, outputs are not available to be mapped to when inputs are configured (hence the "is mapped to offline output" log line).
I converted all my input ... map_to_output ...
lines to exec_always "swaymsg 'input ... map_to_output ...'"
(exec lines are run after inputs and outputs are initailized).
Hi, I have the same issue, unfortunately the workaround doesn't work for me.
I think the root cause is that the code in libinput.c / sway_input_configure_libinput_device
doesn't handle '*'
case, and disables input event when it should just ignore the change.
// ...
bool changed = false;
if (ic->mapped_to_output &&
!output_by_name_or_id(ic->mapped_to_output)) {
sway_log(SWAY_DEBUG,
"%s '%s' is mapped to offline output '%s'; disabling input",
ic->input_type, ic->identifier, ic->mapped_to_output);
changed |= set_send_events(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
} else if (ic->send_events != INT_MIN) {
changed |= set_send_events(device, ic->send_events);
In my tests, adding check for mapped_to_output
equals "*"
fixes the problem.
From what I understand it is intended for the input device to be disabled, when it is mapped to a non-existent/offline output: sway/input/libinput.c:212
bool sway_input_configure_libinput_device(struct sway_input_device *input_device) {
...
if (ic->mapped_to_output &&
!output_by_name_or_id(ic->mapped_to_output)) {
sway_log(SWAY_DEBUG,
"%s '%s' is mapped to offline output '%s'; disabling input",
ic->input_type, ic->identifier, ic->mapped_to_output);
changed |= set_send_events(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
} ...
While this makes sense, it is not reflected in the manpage: $ man sway-input
input <identifier> map_to_output <identifier>
Maps inputs from this device to the specified output.
Only meaningful if the device is a
pointer, touch, or drawing tablet device.
The wildcard * can be used to map the input device to the whole desktop layout.
Furthermore, the manpage states that there's a wildcard * which can be used to map to the "whole desktop layout". This case doesn't seem to be handled anywhere in the code though. (Maybe i missed it?)
I still have this issue. There doesn't seem to be a way to undo input <identifier> map_to_output <identifier>
without reloading the config. It detects the wildcard as a specific output, then disables the input device:
00:02:09.621 [DEBUG] [sway/commands.c:432] Subcommand: map_to_output *
00:02:09.621 [DEBUG] [sway/config/input.c:15] new_input_config(temp)
00:02:09.624 [DEBUG] [sway/config/input.c:354] Config stored for input 1133:16394:Logitech_M325
00:02:09.624 [DEBUG] [sway/input/libinput.c:208] sway_input_configure_libinput_device('1133:16394:Logitech_M325' on '1133:16394:Logitech_M325')
00:02:09.624 [DEBUG] [sway/input/libinput.c:214] pointer '1133:16394:Logitech_M325' is mapped to offline output '*'; disabling input
EDIT: This is actually fixed here:
https://github.com/swaywm/sway/blob/master/sway/input/libinput.c#L223
I was using the sway package in the Arch Linux extra repos, version 1.8.1, which is indeed still broken. Using the sway-git package from the AUR fixes this issue for Arch.