feat: add activation on fill
All checks were successful
Nix Build / nix build (push) Successful in 1m38s

This commit is contained in:
atagen 2025-07-05 15:30:44 +10:00
parent 555ffca915
commit 52a17e19e9
3 changed files with 21 additions and 0 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 any disabled tag you send a window to
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_with_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,15 @@ 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_with_fill
{
entry.enabled = true;
self.fire_event(TagEvent::TagEnabled(t)).await;
&[Tag(t), Window(wid)]
} else {
&[Window(wid)]
}
}
TagCmd::EnableTag(t) => {

View file

@ -48,6 +48,7 @@ impl Default for TagState {
pub struct Config {
pub prepopulate: u8,
pub strict: bool,
pub activation_with_fill: bool,
}
impl Default for Config {
@ -55,6 +56,7 @@ impl Default for Config {
Self {
prepopulate: 3,
strict: true,
activation_with_fill: true,
}
}
}