Compare commits

..

2 Commits

Author SHA1 Message Date
cd53858190 fix: refuse to clobber active socket 2025-06-25 01:55:53 +10:00
3288f18d85 fix: don't disable base tag on exclusive 2025-06-25 01:13:41 +10:00
2 changed files with 15 additions and 2 deletions

View File

@ -47,6 +47,16 @@ async fn create_provider_socket(name: &'static str, socket: &'static str) -> Res
let mut sock_path = get_run_path()?;
sock_path.push(format!("{}.sock", socket));
if smol::fs::metadata(&sock_path).await.is_ok() {
for entry in smol::fs::read_to_string("/proc/net/unix").await?.lines() {
if entry.contains(socket) {
tracing::error!(
"Another instance is already using the {} socket {}!",
name,
socket
);
return Err(anyhow!("Socket in use"));
}
}
tracing::debug!("removing old {} socket", name);
smol::fs::remove_file(&sock_path).await?;
}

View File

@ -220,8 +220,11 @@ impl NiriTag {
}
TagExclusive(t) => {
tracing::debug!("Changing all tags");
let (active_wid, inactive_wid): (HashMap<u64, u8>, HashMap<u64, u8>) =
self.windows.iter().partition(|(_, it)| **it == t);
let (active_wid, inactive_wid): (HashMap<u64, u8>, HashMap<u64, u8>) = self
.windows
.iter()
.filter(|(_, it)| **it != 0)
.partition(|(_, it)| **it == t);
let focus = active_wid.keys().last();
self.move_windows(&inactive, inactive_wid.keys().cloned().collect())
.await;