Compare commits

...

3 commits

Author SHA1 Message Date
atagen
0cb4072040 chore: flake bump
All checks were successful
Nix Build / nix build (push) Successful in 25s
2025-07-06 12:09:13 +10:00
atagen
ffd05c012c fix: enable partial defaults in config 2025-07-06 12:09:13 +10:00
atagen
66c3bab2fa feat: add activation on fill 2025-07-06 12:09:13 +10:00
4 changed files with 60 additions and 29 deletions

View file

@ -113,6 +113,10 @@ prepopulate = 3
# paradigm, or get your desktop stuck in a weird state.
strict = true
# activation on fill
# this will auto-activate an empty + disabled tags if you send a window to it
activation_on_fill = true
````
## ipc

View file

@ -295,7 +295,14 @@ impl NiriTag {
TagCmd::AddTagToWin(t) => {
let wid = self.get_focused_window().await?.id;
self.change_window_tag(wid, Some(t)).await?;
let entry = self.tags.entry(t).or_default();
if entry.windows.len() == 1 && self.config.activation_on_fill {
entry.enabled = true;
self.fire_event(TagEvent::TagEnabled(t)).await;
&[Tag(t), Window(wid)]
} else {
&[Window(wid)]
}
}
TagCmd::RemoveTagFromWin(_) => {
let wid = self.get_focused_window().await?.id;
@ -311,7 +318,14 @@ impl NiriTag {
};
self.change_window_tag(wid, Some(new_tag)).await?;
tracing::debug!("toggling {} to tag {}", wid, new_tag);
let entry = self.tags.entry(new_tag).or_default();
if new_tag != 0 && entry.windows.len() == 1 && self.config.activation_on_fill {
entry.enabled = true;
self.fire_event(TagEvent::TagEnabled(t)).await;
&[Tag(t), Window(wid)]
} else {
&[Window(wid)]
}
}
TagCmd::EnableTag(t) => {

58
flake.lock generated
View file

@ -28,11 +28,11 @@
"xwayland-satellite-unstable": "xwayland-satellite-unstable"
},
"locked": {
"lastModified": 1749890123,
"narHash": "sha256-pRkyWFytGAMaHlrOJIYYEur8NRDe0kTfMIhRdTeasRQ=",
"lastModified": 1751653855,
"narHash": "sha256-JzPiCLz/ESg5OJ3uYPP141HTPEpfDA+g/8LPVtNiQdA=",
"owner": "sodiboo",
"repo": "niri-flake",
"rev": "8f39eb82488525728eda222b34e79b1ecf6d3f96",
"rev": "0ca4dc1ae61f37b9f2f15225b3015a2dea3413da",
"type": "github"
},
"original": {
@ -44,16 +44,16 @@
"niri-stable": {
"flake": false,
"locked": {
"lastModified": 1740117926,
"narHash": "sha256-mTTHA0RAaQcdYe+9A3Jx77cmmyLFHmRoZdd8RpWa+m8=",
"lastModified": 1748151941,
"narHash": "sha256-z4viQZLgC2bIJ3VrzQnR+q2F3gAOEQpU1H5xHtX/2fs=",
"owner": "YaLTeR",
"repo": "niri",
"rev": "b94a5db8790339cf9134873d8b490be69e02ac71",
"rev": "8ba57fcf25d2fc9565131684a839d58703f1dae7",
"type": "github"
},
"original": {
"owner": "YaLTeR",
"ref": "v25.02",
"ref": "v25.05.1",
"repo": "niri",
"type": "github"
}
@ -61,11 +61,11 @@
"niri-unstable": {
"flake": false,
"locked": {
"lastModified": 1749797708,
"narHash": "sha256-P5x0U6AW5Zn20bARv4D83d8XlNaWK1st9QwBfSe+Vfg=",
"lastModified": 1750791124,
"narHash": "sha256-F5iVU/hjoSHSSe0gllxm0PcAaseEtGNanYK5Ha3k2Tg=",
"owner": "YaLTeR",
"repo": "niri",
"rev": "f3f6e79eeca8924ff9cfea4b30006e5b782bc93e",
"rev": "37458d94b288945f6cfbd3c5c233f634d59f246c",
"type": "github"
},
"original": {
@ -76,11 +76,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1749871736,
"narHash": "sha256-K9yBph93OLTNw02Q6e9CYFGrUhvEXnh45vrZqIRWfvQ=",
"lastModified": 1751625545,
"narHash": "sha256-4E7wWftF1ExK5ZEDzj41+9mVgxtuRV3wWCId7QAYMAU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6afe187897bef7933475e6af374c893f4c84a293",
"rev": "c860cf0b3a0829f0f6cf344ca8de83a2bbfab428",
"type": "github"
},
"original": {
@ -92,11 +92,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1749727998,
"narHash": "sha256-mHv/yeUbmL91/TvV95p+mBVahm9mdQMJoqaTVTALaFw=",
"lastModified": 1751582995,
"narHash": "sha256-u7ubvtxdTnFPpV27AHpgoKn7qHuE7sgWgza/1oj5nzA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "fd487183437963a59ba763c0cc4f27e3447dd6dd",
"rev": "7a732ed41ca0dd64b4b71b563ab9805a80a7d693",
"type": "github"
},
"original": {
@ -108,11 +108,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1749794982,
"narHash": "sha256-Kh9K4taXbVuaLC0IL+9HcfvxsSUx8dPB5s5weJcc9pc=",
"lastModified": 1751271578,
"narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ee930f9755f58096ac6e8ca94a1887e0534e2d81",
"rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df",
"type": "github"
},
"original": {
@ -124,11 +124,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1749213349,
"narHash": "sha256-UAaWOyQhdp7nXzsbmLVC67fo+QetzoTm9hsPf9X3yr4=",
"lastModified": 1751625545,
"narHash": "sha256-4E7wWftF1ExK5ZEDzj41+9mVgxtuRV3wWCId7QAYMAU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a4ff0e3c64846abea89662bfbacf037ef4b34207",
"rev": "c860cf0b3a0829f0f6cf344ca8de83a2bbfab428",
"type": "github"
},
"original": {
@ -164,16 +164,16 @@
"xwayland-satellite-stable": {
"flake": false,
"locked": {
"lastModified": 1739246919,
"narHash": "sha256-/hBM43/Gd0/tW+egrhlWgOIISeJxEs2uAOIYVpfDKeU=",
"lastModified": 1748488455,
"narHash": "sha256-IiLr1alzKFIy5tGGpDlabQbe6LV1c9ABvkH6T5WmyRI=",
"owner": "Supreeeme",
"repo": "xwayland-satellite",
"rev": "44590a416d4a3e8220e19e29e0b6efe64a80315d",
"rev": "3ba30b149f9eb2bbf42cf4758d2158ca8cceef73",
"type": "github"
},
"original": {
"owner": "Supreeeme",
"ref": "v0.5.1",
"ref": "v0.6",
"repo": "xwayland-satellite",
"type": "github"
}
@ -181,11 +181,11 @@
"xwayland-satellite-unstable": {
"flake": false,
"locked": {
"lastModified": 1749315541,
"narHash": "sha256-bEik1BfVOFnWvtOrcOHluos/edJ8f+G2y1QySbt/0Ak=",
"lastModified": 1751228685,
"narHash": "sha256-MENtauGBhJ+kDeFaawvWGXaFG3Il6qQzjaP0RmtfM0k=",
"owner": "Supreeeme",
"repo": "xwayland-satellite",
"rev": "da2ecb5be816de35e2efe23a408a1c49fe8b11ba",
"rev": "557ebeb616e03d5e4a8049862bbbd1f02c6f020b",
"type": "github"
},
"original": {

View file

@ -44,10 +44,22 @@ impl Default for TagState {
}
}
fn default_true() -> bool {
true
}
fn default_3() -> u8 {
3
}
#[derive(Deserialize)]
pub struct Config {
#[serde(default = "default_3")]
pub prepopulate: u8,
#[serde(default = "default_true")]
pub strict: bool,
#[serde(default = "default_true")]
pub activation_on_fill: bool,
}
impl Default for Config {
@ -55,6 +67,7 @@ impl Default for Config {
Self {
prepopulate: 3,
strict: true,
activation_on_fill: true,
}
}
}