Merge pull request #3554 from RedSoxFan/seat-current-alias

cmd_seat: allow - to be used as alias for current
This commit is contained in:
Drew DeVault 2019-02-03 09:53:37 +01:00 committed by GitHub
commit b41f9f9158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View File

@ -2,6 +2,7 @@
#include <strings.h> #include <strings.h>
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "sway/input/seat.h"
#include "log.h" #include "log.h"
#include "stringop.h" #include "stringop.h"
@ -20,7 +21,16 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
return error; return error;
} }
config->handler_context.seat_config = new_seat_config(argv[0]); if (!strcmp(argv[0], "-")) {
if (config->reading) {
return cmd_results_new(CMD_FAILURE,
"Current seat alias (-) cannot be used in the config");
}
config->handler_context.seat_config =
new_seat_config(config->handler_context.seat->wlr_seat->name);
} else {
config->handler_context.seat_config = new_seat_config(argv[0]);
}
if (!config->handler_context.seat_config) { if (!config->handler_context.seat_config) {
return cmd_results_new(CMD_FAILURE, "Couldn't allocate config"); return cmd_results_new(CMD_FAILURE, "Couldn't allocate config");
} }

View File

@ -140,10 +140,11 @@ Configure options for multiseat mode.
A *seat* is a collection of input devices that act independently of each other. A *seat* is a collection of input devices that act independently of each other.
Seats are identified by name and the default seat is _seat0_ if no seats are Seats are identified by name and the default seat is _seat0_ if no seats are
configured. Each seat has an independent keyboard focus and a separate cursor that configured. While sway is running, _-_ (hyphen) can be used as an alias for the
is controlled by the pointer devices of the seat. This is useful for multiple current seat. Each seat has an independent keyboard focus and a separate cursor
people using the desktop at the same time with their own devices (each sitting that is controlled by the pointer devices of the seat. This is useful for
in their own "seat"). multiple people using the desktop at the same time with their own devices (each
sitting in their own "seat").
*seat* <name> attach <input_identifier> *seat* <name> attach <input_identifier>
Attach an input device to this seat by its input identifier. A special Attach an input device to this seat by its input identifier. A special