diff --git a/Cargo.lock b/Cargo.lock
index 86a93753b..932327d1c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -443,7 +443,7 @@ dependencies = [
"bitflags 2.9.4",
"cexpr",
"clang-sys",
- "itertools",
+ "itertools 0.13.0",
"proc-macro2",
"quote",
"regex",
@@ -1927,6 +1927,15 @@ dependencies = [
"either",
]
+[[package]]
+name = "itertools"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
+dependencies = [
+ "either",
+]
+
[[package]]
name = "itoa"
version = "1.0.15"
@@ -2358,6 +2367,7 @@ dependencies = [
"glam",
"input",
"insta",
+ "itertools 0.14.0",
"keyframe",
"libc",
"libdisplay-info",
diff --git a/Cargo.toml b/Cargo.toml
index 5346708f9..bc950f9c4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -109,6 +109,7 @@ wayland-backend = "0.3.11"
wayland-scanner = "0.31.7"
xcursor = "0.3.10"
zbus = { version = "5.11.0", optional = true }
+itertools = "0.14.0"
[dependencies.smithay]
workspace = true
diff --git a/README.md b/README.md
index 31a0fb30f..3898b3365 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,8 @@
-# niri
+# niri (fork)
+
+
+
+
This repo houses a fork of [niri](https://github/com/YaLTeR/niri), a scrollable tiling Wayland compositor.
@@ -111,6 +115,21 @@ When using `move-window-into-or-out-of-group` on a non-grouped tile, but there i
direction you're attempting to move to, the behavior will instead be similar to `consume-or-expel-window`, `-left` or
`-right` respectively, or `move-window`, `-up` or `-down` respectively.
+By default, tab titles will be rendered above tab bars. Their appearance can be adjusted under the `tab-indicator`
+setting:
+
+```kdl
+layout {
+ tab-indicator {
+ // default is 12
+ title-font-size 18
+
+ // optional, if you don't want titles to show at all
+ hide-titles
+ }
+}
+```
+
#### Caveats
- When maximizing or fullscreening a grouped tile, the tab indicator will disappear. However, you can still cycle tabs
diff --git a/assets/screenshots/groups-blur.png b/assets/screenshots/groups-blur.png
new file mode 100644
index 000000000..c3183978c
--- /dev/null
+++ b/assets/screenshots/groups-blur.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0b0e47c03a827ac9d9af72acc5cc406cf60fc7d1568a2c12a8e49c5c3dbb5a12
+size 800755
diff --git a/niri-config/src/appearance.rs b/niri-config/src/appearance.rs
index 3aee86ce4..9b9a4eac7 100644
--- a/niri-config/src/appearance.rs
+++ b/niri-config/src/appearance.rs
@@ -489,6 +489,8 @@ impl MergeWith for WorkspaceShadow {
pub struct TabIndicator {
pub off: bool,
pub hide_when_single_tab: bool,
+ pub hide_titles: bool,
+ pub title_font_size: u32,
pub gap: f64,
pub width: f64,
pub length: TabIndicatorLength,
@@ -508,6 +510,8 @@ impl Default for TabIndicator {
Self {
off: false,
hide_when_single_tab: false,
+ hide_titles: false,
+ title_font_size: 12,
gap: 5.,
width: 4.,
length: TabIndicatorLength {
@@ -535,6 +539,7 @@ impl MergeWith for TabIndicator {
merge!(
(self, part),
+ hide_titles,
hide_when_single_tab,
gap,
width,
@@ -542,7 +547,7 @@ impl MergeWith for TabIndicator {
corner_radius,
);
- merge_clone!((self, part), length, position);
+ merge_clone!((self, part), title_font_size, length, position);
merge_color_gradient_opt!(
(self, part),
@@ -560,6 +565,10 @@ pub struct TabIndicatorPart {
#[knuffel(child)]
pub on: bool,
#[knuffel(child)]
+ pub hide_titles: Option,
+ #[knuffel(child, unwrap(argument))]
+ pub title_font_size: Option,
+ #[knuffel(child)]
pub hide_when_single_tab: Option,
#[knuffel(child, unwrap(argument))]
pub gap: Option>,
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 7feb32883..aa64bdb70 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -286,6 +286,11 @@ pub trait LayoutElement {
fn interactive_resize_data(&self) -> Option;
fn on_commit(&mut self, serial: Serial);
+
+ /// The name / title of this layout element
+ fn title(&self) -> Option {
+ None
+ }
}
#[derive(Debug)]
diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs
index 3b7caf0ac..fcf9d9f0d 100644
--- a/src/layout/scrolling.rs
+++ b/src/layout/scrolling.rs
@@ -1931,7 +1931,7 @@ impl ScrollingSpace {
let source_tile = &mut self.columns[source_col_idx].tiles[source_tile_idx];
if let Some(window) = source_tile.ungroup_single(&id) {
- let extra_offset = Point::new(0., source_tile.tab_indicator_extra_size().h);
+ let extra_offset = source_tile.tab_indicator_content_offset();
let to_update = source_tile.focused_window().id().clone();
// we need to refresh the window here to avoid triggering its resize animation
@@ -1979,14 +1979,21 @@ impl ScrollingSpace {
Some(self.options.animations.window_movement.0),
);
+ let source_position = self
+ .tile_render_pos(source_col_idx + 1, source_tile_idx)
+ .expect("should determine source tile render pos");
+
+ let target_position = self
+ .tile_render_pos(source_col_idx, 0)
+ .expect("should determine source tile render pos");
+
let inserted_tile = self.columns[source_col_idx]
.tiles
.first_mut()
.expect("should have first tile");
- inserted_tile.animate_move_from(Point::new(
- inserted_tile.tile_bounding_box().w + self.options.layout.gaps,
- extra_offset.y,
- ));
+ inserted_tile.animate_move_from(
+ source_position - target_position + extra_offset,
+ );
inserted_tile.focused_window().id().clone()
}
WindowMoveDirection::Right => {
@@ -2001,14 +2008,17 @@ impl ScrollingSpace {
Some(self.options.animations.window_movement.0),
);
+ let target_position = self
+ .tile_render_pos(source_col_idx + 1, 0)
+ .expect("should determine source tile render pos");
+
let inserted_tile = self.columns[source_col_idx + 1]
.tiles
.first_mut()
.expect("should have first tile");
- inserted_tile.animate_move_from(Point::new(
- -(inserted_tile.tile_bounding_box().w + self.options.layout.gaps),
- extra_offset.y,
- ));
+ inserted_tile.animate_move_from(
+ source_position - target_position + extra_offset,
+ );
inserted_tile.focused_window().id().clone()
}
@@ -2059,7 +2069,7 @@ impl ScrollingSpace {
if let Some(ungrouped) = source_tile.ungroup_single(&id) {
let to_update = source_tile.focused_window().id().clone();
- let extra_offset = Point::new(0., source_tile.tab_indicator_extra_size().h);
+ let extra_offset = source_tile.tab_indicator_content_offset();
// we need to refresh the window here to avoid triggering its resize animation
source_tile.focused_window().refresh();
self.update_window(&to_update, None);
diff --git a/src/layout/tab_indicator.rs b/src/layout/tab_indicator.rs
index adc24a66c..220e554e9 100644
--- a/src/layout/tab_indicator.rs
+++ b/src/layout/tab_indicator.rs
@@ -1,24 +1,40 @@
+use std::cell::RefCell;
+use std::cmp::min;
use std::iter::zip;
use std::mem;
+use anyhow::ensure;
+use itertools::izip;
use niri_config::{CornerRadius, Gradient, GradientRelativeTo, TabIndicatorPosition};
-use smithay::utils::{Logical, Point, Rectangle, Size};
+use pango::glib::property::PropertySet;
+use pango::FontDescription;
+use pangocairo::cairo::{self, ImageSurface};
+use smithay::backend::allocator::Fourcc;
+use smithay::backend::renderer::element::Kind;
+use smithay::backend::renderer::gles::{GlesRenderer, GlesTexture};
+use smithay::utils::{Logical, Physical, Point, Rectangle, Size, Transform};
-use super::tile::Tile;
use super::LayoutElement;
use crate::animation::{Animation, Clock};
use crate::niri_render_elements;
use crate::render_helpers::border::BorderRenderElement;
+use crate::render_helpers::primary_gpu_texture::PrimaryGpuTextureRenderElement;
use crate::render_helpers::renderer::NiriRenderer;
+use crate::render_helpers::texture::{TextureBuffer, TextureRenderElement};
use crate::utils::{
floor_logical_in_physical_max1, round_logical_in_physical, round_logical_in_physical_max1,
+ to_physical_precise_round,
};
+const MIN_DIST_TO_EDGES: f64 = 20.;
+
#[derive(Debug)]
pub struct TabIndicator {
shader_locs: Vec>,
shaders: Vec,
open_anim: Option,
+ tabs: Vec,
+ title_textures: Vec,
config: niri_config::TabIndicator,
}
@@ -28,19 +44,36 @@ pub struct TabInfo {
pub gradient: Gradient,
/// Tab geometry in the same coordinate system as the area.
pub geometry: Rectangle,
+ /// The title for this tab.
+ pub title: String,
}
niri_render_elements! {
TabIndicatorRenderElement => {
Gradient = BorderRenderElement,
+ Title = PrimaryGpuTextureRenderElement,
}
}
+#[derive(Debug, Default)]
+struct TitleTexture {
+ title: String,
+ scale: f64,
+ max_size: Size,
+ // cached result of the rendered title texture
+ texture: RefCell