Skip to content

Commit

Permalink
fix setting last found window in few commands
Browse files Browse the repository at this point in the history
  • Loading branch information
phil294 committed Aug 12, 2023
1 parent 3f5b4a7 commit 62da8af
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/cmd/x11/window/win-wait-active.cr
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Cmd::X11::Window::WinWaitActive < Cmd::Base
is_active = ::Util::ExponentialBackOff.back_off(initial_interval: 5.milliseconds, factor: 1.15, max_interval: 0.8.seconds, timeout: seconds ? seconds.seconds : nil) do
active = false
Util.match(thread, match_conditions, empty_is_last_found: true, a_is_active: false) do |win|
thread.settings.last_found_window = win
active = win == thread.runner.display.x_do.active_window
end
active
Expand Down
1 change: 1 addition & 0 deletions src/cmd/x11/window/win-wait-not-active.cr
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Cmd::X11::Window::WinWaitNotActive < Cmd::Base
is_not_active = ::Util::ExponentialBackOff.back_off(initial_interval: 5.milliseconds, factor: 1.15, max_interval: 0.8.seconds, timeout: seconds ? seconds.seconds : nil) do
not_active = false
Util.match(thread, match_conditions, empty_is_last_found: true, a_is_active: false) do |win|
thread.settings.last_found_window = win
not_active = win != thread.runner.display.x_do.active_window
end
not_active
Expand Down
3 changes: 2 additions & 1 deletion src/cmd/x11/window/win-wait.cr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class Cmd::X11::Window::WinWait < Cmd::Base
match_conditions = args
match_conditions.delete_at(2)
match = ::Util::ExponentialBackOff.back_off(initial_interval: 20.milliseconds, factor: 1.15, max_interval: 0.8.seconds, timeout: seconds ? seconds.seconds : nil) do
Util.match(thread, match_conditions, empty_is_last_found: false, a_is_active: false) do |win|
# a_is_active: Not documented but appears to have been the case according to MinimizeToTrayMenu.ahk (not verified in any win ahk version)
Util.match(thread, match_conditions, empty_is_last_found: false, a_is_active: true) do |win|
thread.settings.last_found_window = win
end
end
Expand Down

0 comments on commit 62da8af

Please sign in to comment.