summaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/commands.c1
-rw-r--r--sway/commands/smart_corner_radius.c17
-rw-r--r--sway/config.c1
-rw-r--r--sway/desktop/render.c6
-rw-r--r--sway/meson.build1
-rw-r--r--sway/sway.5.scd3
6 files changed, 27 insertions, 2 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 9bd5275d..57f1a8b6 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -93,6 +93,7 @@ static const struct cmd_handler handlers[] = {
{ "shadows", cmd_shadows },
{ "show_marks", cmd_show_marks },
{ "smart_borders", cmd_smart_borders },
+ { "smart_corner_radius", cmd_smart_corner_radius },
{ "smart_gaps", cmd_smart_gaps },
{ "tiling_drag", cmd_tiling_drag },
{ "tiling_drag_threshold", cmd_tiling_drag_threshold },
diff --git a/sway/commands/smart_corner_radius.c b/sway/commands/smart_corner_radius.c
new file mode 100644
index 00000000..4104cb4b
--- /dev/null
+++ b/sway/commands/smart_corner_radius.c
@@ -0,0 +1,17 @@
+#include "sway/commands.h"
+#include "sway/config.h"
+#include "sway/tree/arrange.h"
+#include "util.h"
+
+struct cmd_results *cmd_smart_corner_radius(int argc, char **argv) {
+ struct cmd_results *error = NULL;
+ if ((error = checkarg(argc, "smart_corner_radius", EXPECTED_EQUAL_TO, 1))) {
+ return error;
+ }
+
+ config->smart_corner_radius = parse_boolean(argv[0], true);
+
+ arrange_root();
+
+ return cmd_results_new(CMD_SUCCESS, NULL);
+}
diff --git a/sway/config.c b/sway/config.c
index e965601b..ef739161 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -335,6 +335,7 @@ static void config_defaults(struct sway_config *config) {
// SwayFX defaults
config->corner_radius = 0;
+ config->smart_corner_radius = true;
config->dim_inactive = 0.0f;
color_to_rgba(config->dim_inactive_colors.unfocused, 0x000000FF);
color_to_rgba(config->dim_inactive_colors.urgent, 0x900000FF);
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index 81a965b9..1ecada45 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -1003,6 +1003,9 @@ static void render_containers_linear(struct sway_output *output,
}
bool has_titlebar = state->border == B_NORMAL;
+ int corner_radius = config->smart_corner_radius &&
+ output->current.active_workspace->current_gaps.top == 0
+ ? 0 : child->corner_radius;
struct decoration_data deco_data = {
.alpha = child->alpha,
.dim_color = view_is_urgent(view)
@@ -1010,8 +1013,7 @@ static void render_containers_linear(struct sway_output *output,
: config->dim_inactive_colors.unfocused,
.dim = child->current.focused || parent->focused ? 0.0f: config->dim_inactive,
// no corner radius if no gaps (allows smart_gaps to work as expected)
- .corner_radius = output->current.active_workspace->current_gaps.top == 0
- ? 0 : child->corner_radius,
+ .corner_radius = corner_radius,
.saturation = child->saturation,
.has_titlebar = has_titlebar,
};
diff --git a/sway/meson.build b/sway/meson.build
index 757d0c99..a361beac 100644
--- a/sway/meson.build
+++ b/sway/meson.build
@@ -49,6 +49,7 @@ sway_sources = files(
'commands/border.c',
'commands/client.c',
'commands/corner_radius.c',
+ 'commands/smart_corner_radius.c',
'commands/create_output.c',
'commands/default_border.c',
'commands/default_floating_border.c',
diff --git a/sway/sway.5.scd b/sway/sway.5.scd
index a5fb4173..40618647 100644
--- a/sway/sway.5.scd
+++ b/sway/sway.5.scd
@@ -649,6 +649,9 @@ The default colors are:
*corner_radius* <radius>
Set corner radius for new windows.
+*smart_corner_radius* on|off
+ Set corner radius only if there are gaps around the window.
+
*dim_inactive* <value>
Adjusts the dimming of inactive windows between 0.0 (no dimming) and 1.0
(fully dimmed) while 0.0 is the default value.