aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/seat.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-02-02 22:02:28 -0500
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-02-02 22:02:28 -0500
commitf425e81fbe1340a1193ae98ff2081bd32facb9da (patch)
tree31c09cd8494181855545ae00ddaad3328708af1f /sway/commands/seat.c
parentseat_cmd_attach: defer while reading (diff)
downloadsway-f425e81fbe1340a1193ae98ff2081bd32facb9da.tar.gz
sway-f425e81fbe1340a1193ae98ff2081bd32facb9da.tar.zst
sway-f425e81fbe1340a1193ae98ff2081bd32facb9da.zip
cmd_seat: allow - to be used as alias for current
This allows for `-` (hyphen) to be used as an alias for the current seat while sway is running. This alias was chosen since it is unlikely to interfere with any desirable seat identifier
Diffstat (limited to 'sway/commands/seat.c')
-rw-r--r--sway/commands/seat.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sway/commands/seat.c b/sway/commands/seat.c
index 81bb5f5d..5b23dcc6 100644
--- a/sway/commands/seat.c
+++ b/sway/commands/seat.c
@@ -2,6 +2,7 @@
2#include <strings.h> 2#include <strings.h>
3#include "sway/commands.h" 3#include "sway/commands.h"
4#include "sway/input/input-manager.h" 4#include "sway/input/input-manager.h"
5#include "sway/input/seat.h"
5#include "log.h" 6#include "log.h"
6#include "stringop.h" 7#include "stringop.h"
7 8
@@ -20,7 +21,16 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
20 return error; 21 return error;
21 } 22 }
22 23
23 config->handler_context.seat_config = new_seat_config(argv[0]); 24 if (!strcmp(argv[0], "-")) {
25 if (config->reading) {
26 return cmd_results_new(CMD_FAILURE,
27 "Current seat alias (-) cannot be used in the config");
28 }
29 config->handler_context.seat_config =
30 new_seat_config(config->handler_context.seat->wlr_seat->name);
31 } else {
32 config->handler_context.seat_config = new_seat_config(argv[0]);
33 }
24 if (!config->handler_context.seat_config) { 34 if (!config->handler_context.seat_config) {
25 return cmd_results_new(CMD_FAILURE, "Couldn't allocate config"); 35 return cmd_results_new(CMD_FAILURE, "Couldn't allocate config");
26 } 36 }