diff --git a/man/picom.1.asciidoc b/man/picom.1.asciidoc index 2612ece..9e0bb20 100644 --- a/man/picom.1.asciidoc +++ b/man/picom.1.asciidoc @@ -103,6 +103,9 @@ OPTIONS *--inactive-dim* 'VALUE':: Dim inactive windows. (0.0 - 1.0, defaults to 0.0) +*--corner-radius* 'VALUE':: + Sets the radius of rounded window corners. When > 0, the compositor will round the corners of windows. (defaults to 0). + *--mark-wmwin-focused*:: Try to detect WM windows (a non-override-redirect window with no child that has 'WM_STATE') and mark them as active. diff --git a/src/config.c b/src/config.c index e10ec34..5444532 100644 --- a/src/config.c +++ b/src/config.c @@ -537,6 +537,8 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable, .shadow_ignore_shaped = false, .xinerama_shadow_crop = false, + .corner_radius = 0, + .fade_in_step = 0.028, .fade_out_step = 0.03, .fade_delta = 10, diff --git a/src/config.h b/src/config.h index d8741a5..7c56aab 100644 --- a/src/config.h +++ b/src/config.h @@ -217,6 +217,8 @@ typedef struct options { c2_lptr_t *opacity_rules; /// Limit window brightness double max_brightness; + // Radius of rounded window corners + int corner_radius; // === Focus related === /// Whether to try to detect WM windows and mark them as focused. diff --git a/src/config_libconfig.c b/src/config_libconfig.c index b488b61..3bcb8b3 100644 --- a/src/config_libconfig.c +++ b/src/config_libconfig.c @@ -374,6 +374,8 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad // --active_opacity if (config_lookup_float(&cfg, "active-opacity", &dval)) opt->active_opacity = normalize_d(dval); + // --corner-radius + config_lookup_int(&cfg, "corner-radius", &opt->corner_radius); // -e (frame_opacity) config_lookup_float(&cfg, "frame-opacity", &opt->frame_opacity); // -c (shadow_enable) diff --git a/src/options.c b/src/options.c index 976b0a0..c3dcfd3 100644 --- a/src/options.c +++ b/src/options.c @@ -117,6 +117,10 @@ static void usage(const char *argv0, int ret) { "--active-opacity opacity\n" " Default opacity for active windows. (0.0 - 1.0)\n" "\n" + "--corner-radius value\n" + " Sets the radius of rounded window corners. When > 0, the compositor\n" + " will round the corners of windows. (defaults to 0).\n" + "\n" "--mark-wmwin-focused\n" " Try to detect WM windows and mark them as active.\n" "\n" @@ -440,6 +444,7 @@ static const struct option longopts[] = { {"blur-deviation", required_argument, NULL, 330}, {"blur-strength", required_argument, NULL, 331}, {"shadow-color", required_argument, NULL, 332}, + {"corner-radius", required_argument, NULL, 333}, {"experimental-backends", no_argument, NULL, 733}, {"monitor-repaint", no_argument, NULL, 800}, {"diagnostics", no_argument, NULL, 801}, @@ -859,7 +864,10 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, // --blur-strength opt->blur_strength = atoi(optarg); break; - + case 333: + // --cornor-radius + opt->corner_radius = atoi(optarg); + break; P_CASEBOOL(733, experimental_backends); P_CASEBOOL(800, monitor_repaint); case 801: opt->print_diagnostics = true; break; @@ -986,6 +994,10 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, "properly under X Render backend."); } + if (opt->corner_radius > 0) { + log_warn("Rounded corner is not implemented yet."); + } + return true; } diff --git a/src/picom.c b/src/picom.c index 17005c3..67f8cd1 100644 --- a/src/picom.c +++ b/src/picom.c @@ -669,6 +669,8 @@ static struct managed_win *paint_preprocess(session_t *ps, bool *fade_running) { w->frame_opacity = 1.0; } + w->corner_radius = ps->o.corner_radius; + // Update window mode w->mode = win_calc_mode(w); diff --git a/src/win.c b/src/win.c index 5bdaacc..50647cb 100644 --- a/src/win.c +++ b/src/win.c @@ -1413,6 +1413,8 @@ struct win *fill_win(session_t *ps, struct win *w) { // Initialized during paint .paint = PAINT_INIT, .shadow_paint = PAINT_INIT, + + .corner_radius = 0, }; assert(!w->destroyed); diff --git a/src/win.h b/src/win.h index 83cebec..eb07558 100644 --- a/src/win.h +++ b/src/win.h @@ -208,6 +208,9 @@ struct managed_win { /// Last window opacity value set by the rules. double opacity_set; + /// Radius of rounded window corners + int corner_radius; + // Fading-related members /// Override value of window fade state. Set by D-Bus method calls. switch_t fade_force;