-
Notifications
You must be signed in to change notification settings - Fork 1.1k
sway/commands: Handle incorrect resize unit #8640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
d302b54
to
d646a4e
Compare
d646a4e
to
86c68c8
Compare
@@ -295,6 +295,7 @@ list_t *execute_command(char *_exec, struct sway_seat *seat, | |||
struct cmd_results *res = handler->handle(argc-1, argv+1); | |||
list_add(res_list, res); | |||
if (res->status == CMD_INVALID) { | |||
sway_log(SWAY_ERROR, "%s", res->error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't log command error results, these are displayed to the user by swaymsg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But these errors are from for_window directives within the config, not from the user running swaymsg. They currently don't get displayed to the user at all. Should they not get printed if from for_window directives?
for_window [app_id="Alacritty"] {
floating enable
move position 600 pt 200 pt
resize set width 300 pt
resize set height 300 pt
}
exec alacritty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right. Yeah, would make sense to me to print from the function that executes for_window
criteria.
b291208
to
2dad368
Compare
problem: an invalid usage of the command resize set will cause sway to crash because it doesn't check for an invalid height. solution: validate height along with width. fixes swaywm#8619 collect errors of all cmd_resize variations and bubble them up Log invalid command usage without this, the invalid command usages from the config criteria do not get logged or printed to the user anywhere.
2dad368
to
02b3c6f
Compare
"<width|height|up|down|left|right> [<amount>] [px|ppt]'"; | ||
|
||
return cmd_results_new(CMD_INVALID, "%s", usage); | ||
return error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like with this change we no longer report an error when executing resize foo
.
problem: an invalid usage of the command
resize set
will cause sway to crash because it doesn't check for an invalid height.solution:
fixes #8619