leftwm_core/utils/
window_updater.rs

1use crate::config::Config;
2use crate::display_servers::DisplayServer;
3use crate::models::{Handle, Manager};
4
5impl<H: Handle, C: Config, SERVER: DisplayServer<H>> Manager<H, C, SERVER> {
6    /*
7     * step over all the windows for each workspace and updates all the things
8     * based on the new state of the WM
9     */
10    pub fn update_windows(&mut self) {
11        // set all tagged windows as visible
12        self.state
13            .windows
14            .iter_mut()
15            .for_each(|w| w.set_visible(w.tag.is_none()));
16
17        for ws in &self.state.workspaces {
18            let windows = &mut self.state.windows;
19            let all_tags = &self.state.tags;
20            if let Some(Some(tag)) = ws.tag.map(|tag_id| all_tags.get(tag_id)) {
21                tag.update_windows(windows, ws, &mut self.state.layout_manager);
22            }
23        }
24    }
25}