feat: add activation on fill
This commit is contained in:
parent
555ffca915
commit
66c3bab2fa
3 changed files with 20 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -48,6 +48,7 @@ impl Default for TagState {
|
|||
pub struct Config {
|
||||
pub prepopulate: u8,
|
||||
pub strict: bool,
|
||||
pub activation_on_fill: bool,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
|
@ -55,6 +56,7 @@ impl Default for Config {
|
|||
Self {
|
||||
prepopulate: 3,
|
||||
strict: true,
|
||||
activation_on_fill: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue