Skip to content

When application starts after talon, the scope is wrong #613

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

Closed
PetrKryslUCSD opened this issue May 5, 2023 · 21 comments
Closed

When application starts after talon, the scope is wrong #613

PetrKryslUCSD opened this issue May 5, 2023 · 21 comments

Comments

@PetrKryslUCSD
Copy link

On Windows 10: when an application is started at the point where Talon is already running, often the scope is that of the previously active window. Sometimes switching applications will correct the issue, sometimes one has to restart Talon for the scope to be correct.

@lunixbochs
Copy link

lunixbochs commented May 5, 2023

I just fixed a bug related to this in beta 592, please confirm whether the issue appears after that version

@PetrKryslUCSD
Copy link
Author

Looks good! Many thanks. P

@PetrKryslUCSD
Copy link
Author

Spoke to soon. The error still persists.

@lunixbochs lunixbochs reopened this May 6, 2023
@lunixbochs
Copy link

lunixbochs commented May 6, 2023

does the new application show up in ui.apps() in the repl?
does the new window show up in ui.windows()?
is the right window active for the app, if you find the app in ui.apps() and check app.active_window?
is this related to specific apps each time, or if you launch a random app like notepad does it also have the issue?

@AndreasArvidsson
Copy link

AndreasArvidsson commented May 7, 2023

  • yes
  • yes
  • no: Window(None) is the active window. app.windows shows the correct window as the first item though
  • Seems to happen with different applications, but doesn't happen every time. If I restart Talon multiple times sometimes there is a problem and sometimes not. Notepad is one of the applications I've had problems with but also firefox for example.

beta 596
windows 11

@PetrKryslUCSD
Copy link
Author

Just happened again. 596, Win 11.
image
The application is SublimeMerge.

@PetrKryslUCSD
Copy link
Author

Switching applications a few times and checking the scope again: now it is correct.

@dgrunwald
Copy link

I frequently have this issue with a newly started windows terminal (the modern app; on Windows 10). Just had it again with 0.3.1-596-ge72c.
Switching focus to another app and back to Windows terminal is almost always sufficient as a workaround; though very rarely I had to restart talon (but the last time that happened was a couple versions ago).

@mirober
Copy link

mirober commented May 9, 2023

I've very occasionally run into the same thing but have never been able to find a reliable repro for it. One thing that seems to be able to trigger it is launching applications from the path bar of a file explorer window. This only triggers the bug sometimes though and usually only the first time after a restart. Just tried it on the latest beta and got this:

image

image

The imgui window is showing:

    gui.text(f"{ui.active_app()}")
    gui.text(f"{ui.active_app().exe}")
    gui.text(f"{ui.active_window().title}")
    gui.text(f"{GetForegroundWindow()}")
    gui.text(f"{GetWindowText(GetForegroundWindow())}")
    gui.text(f"{GetWindowText(ui.active_window().id)}")

This may be a separate issue to the OP.

@lunixbochs
Copy link

try again on 597

@AndreasArvidsson
Copy link

I've been trying to recreate the problem and can't anymore. That could mean that it's fixed or that it has just become more seldom since it was intermittent before, but so far so good!

@dgrunwald
Copy link

I got the problem again on version 597, this time the variant where focus switching does not help.
I had to restart talon to get it to recognize the newly opened applications (VSCode, notepad, ...)

It was affecting all newly opened apps after the problem started occurring (probably when resuming from hibernation over night?), but not newly opened windows of already-running apps.

@mirober
Copy link

mirober commented May 11, 2023

repro'd mine on 597

@lunixbochs
Copy link

after your repro, is there an error in your log? I found the cause for dgrunwald's and it was due to an exception

@mirober
Copy link

mirober commented May 11, 2023

Could a user level error in a win_title event handler cause this? There aren't any errors from talon itself

@lunixbochs
Copy link

ping me on slack, you might have a different issue

@lunixbochs
Copy link

no, win_title wouldn't cause this. fwiw there's a new update (599) for the general case

@PetrKryslUCSD
Copy link
Author

With 599 I haven't been able to reproduce yet. Fingers crossed...

@lunixbochs
Copy link

closing this again, respond here if it reappears

@PetrKryslUCSD
Copy link
Author

It happened again today.

@lunixbochs
Copy link

@PetrKryslUCSD going to DM you on the slack, there are some extra troubleshooting steps required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants