diff options
Diffstat (limited to 'sway/commands/titlebar_padding.c')
-rw-r--r-- | sway/commands/titlebar_padding.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/sway/commands/titlebar_padding.c b/sway/commands/titlebar_padding.c index 29ce59ff..affb6b50 100644 --- a/sway/commands/titlebar_padding.c +++ b/sway/commands/titlebar_padding.c @@ -2,6 +2,7 @@ #include "sway/commands.h" #include "sway/config.h" #include "sway/output.h" +#include "sway/swaynag.h" #include "sway/tree/arrange.h" #include "log.h" @@ -27,8 +28,28 @@ struct cmd_results *cmd_titlebar_padding(int argc, char **argv) { } } - config->titlebar_v_padding = v_value; - config->titlebar_h_padding = h_value; + /* + titlebar padding depends on corner_radius to + ensure that titlebars are rendered nicely + */ + if (v_value > (config->corner_radius - config->font_height) / 2) { + config->titlebar_v_padding = v_value; + } else { + config_add_swaynag_warning( + "titlebar_v_padding (%d) is too small for the current corner radius (%d)", + v_value, config->corner_radius + ); + return cmd_results_new(CMD_FAILURE, NULL); + } + if (h_value > config->corner_radius) { + config->titlebar_h_padding = h_value; + } else { + config_add_swaynag_warning( + "titlebar_h_padding (%d) is too small for the current corner radius (%d)", + h_value, config->corner_radius + ); + return cmd_results_new(CMD_FAILURE, NULL); + } for (int i = 0; i < root->outputs->length; ++i) { struct sway_output *output = root->outputs->items[i]; |