aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--niri-config/src/lib.rs12
-rw-r--r--src/layout/workspace.rs34
-rw-r--r--wiki/Configuration:-Miscellaneous.md8
3 files changed, 41 insertions, 13 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs
index 8bb069c6..d8c8f863 100644
--- a/niri-config/src/lib.rs
+++ b/niri-config/src/lib.rs
@@ -774,10 +774,10 @@ impl Default for WorkspaceShadow {
off: false,
offset: ShadowOffset {
x: FloatOrInt(0.),
- y: FloatOrInt(20.),
+ y: FloatOrInt(10.),
},
- softness: FloatOrInt(120.),
- spread: FloatOrInt(20.),
+ softness: FloatOrInt(80.),
+ spread: FloatOrInt(10.),
color: Color::from_rgba8_unpremul(0, 0, 0, 0x70),
}
}
@@ -4664,14 +4664,14 @@ mod tests {
0.0,
),
y: FloatOrInt(
- 20.0,
+ 10.0,
),
},
softness: FloatOrInt(
- 120.0,
+ 80.0,
),
spread: FloatOrInt(
- 20.0,
+ 10.0,
),
color: Color {
r: 0.0,
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs
index fe9ce585..6ae045f7 100644
--- a/src/layout/workspace.rs
+++ b/src/layout/workspace.rs
@@ -235,6 +235,9 @@ impl<W: LayoutElement> Workspace<W> {
options.clone(),
);
+ let shadow_config =
+ compute_workspace_shadow_config(options.overview.workspace_shadow, view_size);
+
Self {
scrolling,
floating,
@@ -244,7 +247,7 @@ impl<W: LayoutElement> Workspace<W> {
transform: output.current_transform(),
view_size,
working_area,
- shadow: Shadow::new(niri_config::Shadow::from(options.overview.workspace_shadow)),
+ shadow: Shadow::new(shadow_config),
output: Some(output),
clock,
base_options,
@@ -289,6 +292,9 @@ impl<W: LayoutElement> Workspace<W> {
options.clone(),
);
+ let shadow_config =
+ compute_workspace_shadow_config(options.overview.workspace_shadow, view_size);
+
Self {
scrolling,
floating,
@@ -299,7 +305,7 @@ impl<W: LayoutElement> Workspace<W> {
original_output,
view_size,
working_area,
- shadow: Shadow::new(niri_config::Shadow::from(options.overview.workspace_shadow)),
+ shadow: Shadow::new(shadow_config),
clock,
base_options,
options,
@@ -380,7 +386,8 @@ impl<W: LayoutElement> Workspace<W> {
options.clone(),
);
- let shadow_config = niri_config::Shadow::from(options.overview.workspace_shadow);
+ let shadow_config =
+ compute_workspace_shadow_config(options.overview.workspace_shadow, self.view_size);
self.shadow.update_config(shadow_config);
self.base_options = base_options;
@@ -522,6 +529,10 @@ impl<W: LayoutElement> Workspace<W> {
scale.fractional_scale(),
self.options.clone(),
);
+
+ let shadow_config =
+ compute_workspace_shadow_config(self.options.overview.workspace_shadow, size);
+ self.shadow.update_config(shadow_config);
}
if scale_transform_changed {
@@ -1813,3 +1824,20 @@ impl<W: LayoutElement> Workspace<W> {
pub(super) fn compute_working_area(output: &Output) -> Rectangle<f64, Logical> {
layer_map_for_output(output).non_exclusive_zone().to_f64()
}
+
+fn compute_workspace_shadow_config(
+ config: niri_config::WorkspaceShadow,
+ view_size: Size<f64, Logical>,
+) -> niri_config::Shadow {
+ // Gaps between workspaces are a multiple of the view height, so shadow settings should also be
+ // normalized to the view height to prevent them from overlapping on lower resolutions.
+ let norm = view_size.h / 1080.;
+
+ let mut config = niri_config::Shadow::from(config);
+ config.softness.0 *= norm;
+ config.spread.0 *= norm;
+ config.offset.x.0 *= norm;
+ config.offset.y.0 *= norm;
+
+ config
+}
diff --git a/wiki/Configuration:-Miscellaneous.md b/wiki/Configuration:-Miscellaneous.md
index ee78cebd..ae44914e 100644
--- a/wiki/Configuration:-Miscellaneous.md
+++ b/wiki/Configuration:-Miscellaneous.md
@@ -29,9 +29,9 @@ overview {
workspace-shadow {
// off
- softness 120
- spread 20
- offset x=0 y=20
+ softness 80
+ spread 10
+ offset x=0 y=10
color "#00000070"
}
}
@@ -192,7 +192,7 @@ Control the shadow behind workspaces visible in the overview.
Settings here mirror the normal [`shadow` config in the layout section](./Configuration:-Layout.md#shadow), so check the documentation there.
-Keep in mind that workspace shadows are configured for the full-screen workspace size, then zoomed out together with the workspace.
+Workspace shadows are configured for a workspace size normalized to 1080 pixels tall, then zoomed out together with the workspace.
Practically, this means that you'll want bigger spread, offset, and softness compared to window shadows.
```kdl