From 2d335bac57192f7ffcd30d0cc9e0bd139bfd0424 Mon Sep 17 00:00:00 2001 From: Hendrik Wolff Date: Tue, 4 Nov 2025 14:57:06 +0100 Subject: [PATCH] sway/cmd/create_output: Make it possible to set name of new output `swaymsg create_output new-name-for-output` --- sway/commands/create_output.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sway/commands/create_output.c b/sway/commands/create_output.c index 18c1c377b..edb482f8b 100644 --- a/sway/commands/create_output.c +++ b/sway/commands/create_output.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -50,5 +51,17 @@ struct cmd_results *cmd_create_output(int argc, char **argv) { "Can only create outputs for Wayland, X11 or headless backends"); } + bool should_set_name = argc >= 2 && strcasecmp(argv[0], "name") == 0; + + if (should_set_name) { + if (NULL == result.new_output) { + return cmd_results_new(CMD_FAILURE, + "Cannot assign name to new output"); + } + + sway_log(SWAY_DEBUG, "Set new output name to %s", argv[1]); + wlr_output_set_name(result.new_output, argv[1]); + } + return cmd_results_new(CMD_SUCCESS, NULL); }