mirror of
https://github.com/swaywm/sway.git
synced 2026-02-08 10:06:44 -05:00
sway/cmd/create_output: Make it possible to set name of new output
`swaymsg create_output new-name-for-output`
This commit is contained in:
parent
4c75571175
commit
2d335bac57
1 changed files with 13 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
#include <strings.h>
|
||||
#include <wlr/config.h>
|
||||
#include <wlr/backend/headless.h>
|
||||
#include <wlr/backend/multi.h>
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue