notification daemon
git clone https://git.lucas.co/cce-notifier.git
refactor: update Vertex attributes to include clip_circle
Cargo.lock | 1 +
Makefile | 14 ++++++++++++++
src/main.rs | 16 +++++++++-------
3 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index b79444f..358fa0a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -356,6 +356,7 @@ dependencies = [
"raw-window-handle",
"resvg",
"serde",
+ "serde_json",
"smithay-client-toolkit",
"tokio",
"wayland-backend",
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0fd32b6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,14 @@
+.PHONY: build install run clean
+
+build:
+ cargo build --release
+
+install: build
+ mkdir -p ~/.local/bin
+ install -m 755 target/release/clear-notification-daemon ~/.local/bin/clear-notification-daemon
+
+run:
+ cargo run
+
+clean:
+ cargo clean
diff --git a/src/main.rs b/src/main.rs
index 76abca0..b16e790 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -41,12 +41,14 @@ use calloop_wayland_source::WaylandSource;
struct Vertex {
position: [f32; 2],
color: [f32; 4],
+ clip_circle: [f32; 3],
}
impl Vertex {
- const ATTRIBS: [wgpu::VertexAttribute; 2] = wgpu::vertex_attr_array![
+ const ATTRIBS: [wgpu::VertexAttribute; 3] = wgpu::vertex_attr_array![
0 => Float32x2,
1 => Float32x4,
+ 2 => Float32x3,
];
fn desc() -> wgpu::VertexBufferLayout<'static> {
@@ -64,12 +66,12 @@ fn quad_vertices(x: f32, y: f32, w: f32, h: f32, sw: f32, sh: f32, c: [f32; 4])
let x1 = ((x + w) / sw) * 2.0 - 1.0;
let y1 = 1.0 - ((y + h) / sh) * 2.0;
[
- Vertex { position: [x0, y0], color: c },
- Vertex { position: [x1, y0], color: c },
- Vertex { position: [x0, y1], color: c },
- Vertex { position: [x1, y0], color: c },
- Vertex { position: [x1, y1], color: c },
- Vertex { position: [x0, y1], color: c },
+ Vertex { position: [x0, y0], color: c, clip_circle: [0.0; 3] },
+ Vertex { position: [x1, y0], color: c, clip_circle: [0.0; 3] },
+ Vertex { position: [x0, y1], color: c, clip_circle: [0.0; 3] },
+ Vertex { position: [x1, y0], color: c, clip_circle: [0.0; 3] },
+ Vertex { position: [x1, y1], color: c, clip_circle: [0.0; 3] },
+ Vertex { position: [x0, y1], color: c, clip_circle: [0.0; 3] },
]
}