mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 05:41:16 +01:00
fix(wm): expand hack from 4d25d4e for chrome
This commit expands the hack introduced in 4d25d4e which deals with
inconsistent window titles returned by apps from different macOS APIs.
The same issue that was happening with Activity Monitor was also
happening with Google Chrome, so this hack has been updated to a more
general "contains" check.
This commit is contained in:
1 parent
3128968634
commit
fe8dbca204
3 files changed
+8
-6
No files matched your search
@@ -189,9 +189,9 @@ impl Application {
|
||||
|
||||
if let Some(window_title) = window.title()
|
||||
&& (window_title.eq(title)
|
||||
// TODO: find a better way to deal with these hacks
|
||||
|| (self.name().unwrap_or_default() == "Activity Monitor"
|
||||
&& window_title.starts_with(title)))
|
||||
// a hack for handling already-launched apps with inconsistent titles when
|
||||
// komorebi launches, such as Activity Monitor, Google Chrome, and counting...
|
||||
|| window_title.contains(title))
|
||||
{
|
||||
target = Some(window);
|
||||
}
|
||||
|
||||
@@ -371,6 +371,7 @@ impl MacosApi {
|
||||
)?)
|
||||
}
|
||||
|
||||
// #[track_caller] // use this to with std::panic::Location::caller() to debug failures
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub fn window_rect(element: &AXUIElement) -> Result<CGRect, AccessibilityError> {
|
||||
let mut position_receiver = std::ptr::null();
|
||||
|
||||
@@ -1171,9 +1171,10 @@ impl Workspace {
|
||||
layout.add_padding(border_width);
|
||||
|
||||
for window in container.windows_mut() {
|
||||
let current_percentage = work_area.percentage_within_horizontal_bounds(
|
||||
&Rect::from(MacosApi::window_rect(&window.element)?),
|
||||
);
|
||||
let current_rect =
|
||||
MacosApi::window_rect(&window.element).unwrap_or_default();
|
||||
let current_percentage = work_area
|
||||
.percentage_within_horizontal_bounds(&Rect::from(current_rect));
|
||||
let proposed_percentage =
|
||||
work_area.percentage_within_horizontal_bounds(layout);
|
||||
|
||||
|
||||
Reference in new issue
Block a user