Skip to content
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

[feature]: #95

Open
CappyD opened this issue Jan 25, 2025 · 2 comments
Open

[feature]: #95

CappyD opened this issue Jan 25, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@CappyD
Copy link

CappyD commented Jan 25, 2025

Add option to specify which app window keystrokes should go to

It would be helpful to add an option (maybe --targeted-window) so that the keystrokes sent can be directed to a specific window of a specific application when the windows don't have their own process. The option could be used with --application-name --targeted and --no-activate. Currently, it seems they go to whatever was the last active window of the application and if the application doesn't create a separate process for each window then the --pid option isn't a solution. The new option could look for the supplied argument string occurring anywhere in the title of the desired window (ignoring case).

Other information:

No response

@CappyD CappyD added the enhancement New feature or request label Jan 25, 2025
@socsieng
Copy link
Owner

Is there a specific app that you are looking at?

I've played around with some of the APIs available with CGWindowListCopyWindowInfo and there doesn't appear to be much information available for window names.

Not my area of expertise, but here are a few examples of what I've seen:

kCGWindowAlpha: 0
kCGWindowOwnerPID: 569
kCGWindowStoreType: 1
kCGWindowMemoryUsage: 2272
kCGWindowNumber: 2842
kCGWindowBounds: {
    Height = 999;
    Width = 1188;
    X = 261;
    Y = 78;
}
kCGWindowLayer: 3
kCGWindowOwnerName: Finder
kCGWindowSharingState: 0
kCGWindowAlpha: 1
kCGWindowStoreType: 1
kCGWindowBounds: {
    Height = 1112;
    Width = 1710;
    X = 0;
    Y = 0;
}
kCGWindowSharingState: 0
kCGWindowNumber: 20
kCGWindowMemoryUsage: 2272
kCGWindowLayer: -2147483603
kCGWindowOwnerName: Finder
kCGWindowIsOnscreen: 1
kCGWindowOwnerPID: 569

Notice that there are multiple Finder windows here but nothing

kCGWindowStoreType: 1
kCGWindowOwnerPID: 827
kCGWindowMemoryUsage: 2272
kCGWindowNumber: 70
kCGWindowSharingState: 0
kCGWindowLayer: 0
kCGWindowBounds: {
    Height = 1069;
    Width = 1710;
    X = 0;
    Y = 43;
}
kCGWindowAlpha: 1
kCGWindowOwnerName: iTerm2
kCGWindowOwnerPID: 1385
kCGWindowOwnerName: Docker Desktop
kCGWindowBounds: {
    Height = 500;
    Width = 500;
    X = 0;
    Y = 612;
}
kCGWindowSharingState: 0
kCGWindowNumber: 68333
kCGWindowMemoryUsage: 2272
kCGWindowStoreType: 1
kCGWindowLayer: 0
kCGWindowAlpha: 1

The example below does have kCGWindowName, but very few other windows do have a name.

kCGWindowOwnerPID: 377
kCGWindowMemoryUsage: 2272
kCGWindowAlpha: 1
kCGWindowSharingState: 1
kCGWindowOwnerName: Window Server
kCGWindowName: Menubar
kCGWindowBounds: {
    Height = 43;
    Width = 1710;
    X = 0;
    Y = 0;
}
kCGWindowStoreType: 1
kCGWindowNumber: 54844
kCGWindowLayer: 24

@CappyD
Copy link
Author

CappyD commented Jan 28, 2025

I really appreciate you looking into the possibility. Was hoping that you could see and use window names in apps to make such an option available. The app I'm trying to work with is Microsoft Remote Desktop. Maybe it has window names that can be used? When started, it displays a Connection Center window and from that you can start a session connecting to a remote PC in a new window and that window displays a different name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants