-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multiple desktops based on Windows settings #151
base: main
Are you sure you want to change the base?
Add support for multiple desktops based on Windows settings #151
Conversation
Include windows cloaked by the shell, but exclude "invisible" windows. This seems to result in pretty much the expected list of windows across all desktops instead of just the current one.
Windows already has a setting for the Alt-tab switcher to include virtual desktops, so we can just use that instead of a config.
Add two configuration items.[switch-windows]
# Only switch windows in the current desktop
only_current_desktop = yes
[switch-apps]
# Only switch apps in the current desktop, yes/no/auto
# If auto, follow the system setting (Settings > System > Multitasking -> Virtual Desktops)
only_current_desktop = auto pub struct Config {
...
pub switch_windows_only_current_desktop: bool,
...
pub switch_apps_only_current_desktop: Option<bool<,
} Why add
|
There are a handful of programs that appear as "invisible", which Windows does not appear to include in its own task switcher:
In particular, I will work on adding the new configs and push my changes once I have it working. |
It seems that Why not merge it into the Since we have window-switcher/src/utils/window.rs Lines 211 to 212 in eb6341a
|
Did a bit of cleanup / refactoring as well.
trace!("registry configured alt-tab filter: {alt_tab_filter}"); | ||
|
||
alt_tab_filter != 0 | ||
}); | ||
|
||
let cloak_type = get_window_cloak_type(hwnd); | ||
trace!("only_current_desktop: {only_current_desktop:?}, cloak_type={cloak_type:?}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please delete these two traces!
This function is called by enum_windows
, and it generates a large amount of log entries each time
It is also impossible to distinguish which window they come from, so logging it have litte value.
let mut owner_hwnds = vec![]; | ||
for hwnd in hwnds.iter().cloned() { | ||
let mut valid = is_visible_window(hwnd) | ||
&& !is_cloaked_window(hwnd) | ||
&& !is_cloaked_window(hwnd, only_current_desktop) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should solve the value of only_current_desktop
with the registry key before the loop.
Reading the registry key in a loop is not a good practice.
if !title.is_empty() && title != "Program Manager" { | ||
valid_hwnds.push((hwnd, title)) | ||
} | ||
valid_hwnds.push((hwnd, title)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to check the title for Program Manager
, but we should keep checking title.is_empty
just in case.
if !title.is_empty() {
valid_hwnds.push((hwnd, title))
}
Closes #99
Include windows cloaked by the shell, but exclude "invisible" windows. This seems to result in pretty much the expected list of windows across all desktops instead of just the current one.
We read the Windows registry to decide whether to filter windows on other desktops or not, based on the corresponding multitasking setting.