niri update

This commit is contained in:
Schrottkatze 2026-05-05 01:15:06 +02:00
commit b85f0a45d6
No known key found for this signature in database
4 changed files with 84 additions and 31 deletions

35
Cargo.lock generated
View file

@ -689,9 +689,9 @@ dependencies = [
[[package]]
name = "niri-ipc"
version = "25.5.1"
version = "26.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc3e165f7854b2f83054a2e8f7024baa49666ad25cdb95b8fb9fd17c48045605"
checksum = "6a4adbddf4037ce047854d36a60b5bf80a7990b8db2f0a0b9ede7534b0bae09a"
dependencies = [
"serde",
"serde_json",
@ -1028,18 +1028,28 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "serde"
version = "1.0.219"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
name = "serde_core"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.219"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
@ -1048,14 +1058,15 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.140"
version = "1.0.149"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
dependencies = [
"itoa",
"memchr",
"ryu",
"serde",
"serde_core",
"zmij",
]
[[package]]
@ -1731,3 +1742,9 @@ name = "zeroize"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
[[package]]
name = "zmij"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"

View file

@ -1,3 +1,5 @@
prefer-no-csd
cursor {
xcursor-theme "phinger-cursors-dark"
xcursor-size 32
@ -80,3 +82,35 @@ layer-rule {
}
baba-is-float true
}
layer-rule {
match namespace="^launcher$"
background-effect {
blur true
xray false
}
opacity 0.8
}
window-rule {
match is-floating=true
draw-border-with-background false
background-effect {
blur true
xray false
}
opacity 0.85
}
window-rule {
match app-id="cool-retro-term."
open-floating true
opacity 1.0
}
blur {
passes 3
offset 4
noise 0.05
saturation 2
}

View file

@ -6,4 +6,4 @@ edition = "2021"
[dependencies]
serde = { version = "1.0.209", features = [ "derive" ] }
serde_json = "1.0.127"
niri-ipc = "25.5.1"
niri-ipc = "26.4"

View file

@ -1,5 +1,5 @@
use core::panic;
use std::{collections::HashMap, io::Write};
use std::collections::HashMap;
use niri_ipc::{
socket::Socket,
@ -19,18 +19,14 @@ const COLORS: [[&str; 2]; 7] = [
["#cc241d", "#fb4934"], // red
];
const ERR_COLORS: [&str; 2] = ["#ff0000", "#ffff00"];
// tildes because they're at the end of the ascii
const BROKEN_NAME: &str = "~~~~~~~";
fn main() -> Result<(), std::io::Error> {
let mut state = EventStreamState::default();
let mut sock = Socket::connect()?;
// let mut func = sock.send(Request::EventStream).and_then(|it| match it {
// (Ok(Response::Handled), func) => Ok(func),
// _ => unreachable!(),
// })?;
// let mut func = sock.send(Request::EventStream).and_then(|it| match it {
// Ok(Response::Handled) => {}
// Ok(_) => panic!("???"),
// Err(e) => panic!("e"),
// });
let r = sock.send(Request::EventStream)?;
match r {
Ok(Response::Handled) => {}
@ -38,7 +34,7 @@ fn main() -> Result<(), std::io::Error> {
}
let mut receiver = sock.read_events();
while let Ok(ev) = receiver() {
'outer: while let Ok(ev) = receiver() {
// check only relevant later, only done here to avoid a clone
let ev_is_ws_related = matches!(
&ev,
@ -55,21 +51,26 @@ fn main() -> Result<(), std::io::Error> {
.workspaces
.workspaces
.values()
.map(|it| it.clone())
.cloned()
.collect::<Vec<Workspace>>();
workspaces.sort_by(|a, b| a.idx.cmp(&b.idx));
workspaces.sort_by_key(|a| a.idx);
workspaces.sort_by(|a, b| {
a.output
.clone()
.expect("unreachable")
.unwrap_or_else(|| BROKEN_NAME.to_string())
.to_lowercase()
.cmp(&b.output.clone().expect("unreachable").to_lowercase())
.cmp(
&b.output
.clone()
.unwrap_or_else(|| BROKEN_NAME.to_string())
.to_lowercase(),
)
});
let output_colors_lut = workspaces
.iter()
.map(|it| it.output.clone().expect("unreachable"))
.map(|it| it.output.clone().unwrap_or_else(|| BROKEN_NAME.to_string()))
.fold(Vec::new(), |mut acc, it| {
if !acc.contains(&it) {
acc.push(it);
@ -92,15 +93,16 @@ fn main() -> Result<(), std::io::Error> {
name,
..
}| WsData {
color: output_colors_lut[&output.clone().expect("unreachable")]
[if *is_active { 1 } else { 0 }],
color: output
.as_ref()
.map(|output| output_colors_lut[output])
.unwrap_or(&ERR_COLORS)[if *is_active { 1 } else { 0 }],
idx: *idx,
focused: *is_focused,
active: *is_active,
icon: name.as_ref().map(|name| match name.as_str() {
"aaa social" => "󰭹",
"bbb browser" => "󰈹",
"ccc notes" => "󰎚",
"social" => "󰭹",
"browser" => "󰈹",
&_ => "!",
}),
},