Skip to content

Commit

Permalink
Improve window filtering in X11 backend
Browse files Browse the repository at this point in the history
- Enhance window detection logic by checking window class and title
- Add more comprehensive filtering for panel, notification, and desktop windows
- Remove redundant 'vpanel' class from skip list
- Reorganize window state and title checks for better readability
  • Loading branch information
JoaquinDecima committed Feb 14, 2025
1 parent d95092d commit 7bc31ac
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions src-tauri/src/window_manager/x11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,7 @@ impl X11Manager {
}

fn should_show_window(&self, win: Window, atoms: &HashMap<&str, Atom>) -> Result<bool, Box<dyn std::error::Error>> {
let state = self.get_window_state(win, atoms)?;
let skip_states = [
atoms["_NET_WM_STATE_SKIP_TASKBAR"],
atoms["_NET_WM_STATE_SKIP_PAGER"],
atoms["_NET_WM_STATE_MODAL"],
];

if state.iter().any(|s| skip_states.contains(s)) {
return Ok(false);
}

// Verificar la clase de la ventana primero
let class_name = self.get_window_class(win)?;
let skip_classes = [
"desktop_window",
Expand All @@ -265,7 +255,6 @@ impl X11Manager {
"wrapper-2.0",
"notification",
"Notification",
"vpanel",
"panel",
"dock",
"toolbar",
Expand All @@ -276,6 +265,29 @@ impl X11Manager {
return Ok(false);
}

// Verificar el título de la ventana
let title = self.get_window_title(win, atoms)?;
let skip_titles = [
"Vasak Panel",
"VPanel",
"vpanel",
];

if skip_titles.iter().any(|t| title.contains(t)) {
return Ok(false);
}

let state = self.get_window_state(win, atoms)?;
let skip_states = [
atoms["_NET_WM_STATE_SKIP_TASKBAR"],
atoms["_NET_WM_STATE_SKIP_PAGER"],
atoms["_NET_WM_STATE_MODAL"],
];

if state.iter().any(|s| skip_states.contains(s)) {
return Ok(false);
}

let title = self.get_window_title(win, atoms)?;
if title.trim().is_empty() {
return Ok(false);
Expand Down

0 comments on commit 7bc31ac

Please sign in to comment.