Skip to content

Position popup windows on the screen where the mouse cursor is located#249

Open
shymega wants to merge 1 commit intodevfrom
shymega/make-tk-appear-on-current-screen
Open

Position popup windows on the screen where the mouse cursor is located#249
shymega wants to merge 1 commit intodevfrom
shymega/make-tk-appear-on-current-screen

Conversation

@shymega
Copy link
Copy Markdown
Member

@shymega shymega commented Mar 7, 2026

This commit fixes the Tk windows to appear on the currently focused screen.

I was finding it behaved differently on Hyprland.

@shymega shymega requested a review from marvin1099 March 7, 2026 22:19
@shymega shymega self-assigned this Mar 7, 2026
@shymega shymega changed the base branch from main to dev March 7, 2026 22:26
@shymega shymega force-pushed the shymega/make-tk-appear-on-current-screen branch from 23254d2 to 32da17e Compare March 7, 2026 22:29
@marvin1099
Copy link
Copy Markdown
Collaborator

marvin1099 commented Mar 7, 2026

Would this pace the top left of the window to mouse pos or the middle of the window to mouse pos.

Probably more expected that the window spawns so that the mouse pos is in the middle

@shymega
Copy link
Copy Markdown
Member Author

shymega commented Mar 10, 2026

Would this pace the top left of the window to mouse pos or the middle of the window to mouse pos.

Probably more expected that the window spawns so that the mouse pos is in the middle

I agree, this only does the top left. I also want to test it on KDE, as that's what SteamOS/Bazzite use, but I won't test on X11.

@marvin1099
Copy link
Copy Markdown
Collaborator

marvin1099 commented Mar 10, 2026

I agree, this only does the top left. I also want to test it on KDE, as that's what SteamOS/Bazzite use, but I won't test on X11.

Sounds good.
Probably just remove half the window size in the gui window functions (that shoud be the middle).
Then location parrameter is always expected as center cordinates.

A alternative would be to get the detktop the mouse is on and center it on the desktop.
We could also do that.

@shymega shymega force-pushed the shymega/make-tk-appear-on-current-screen branch 2 times, most recently from 6100c1d to 5aa9b49 Compare March 20, 2026 20:37
@shymega shymega force-pushed the shymega/make-tk-appear-on-current-screen branch from 5aa9b49 to 32c43ac Compare March 31, 2026 18:05
@marvin1099
Copy link
Copy Markdown
Collaborator

marvin1099 commented Mar 31, 2026

Is it ready for testing / or did you test.

@shymega
Copy link
Copy Markdown
Member Author

shymega commented Mar 31, 2026

Is it ready for testing / or did you test.

Its ready for testing, but I'm still waiting for my GPD WM2 to come back from China. Its in transit, should have it in a week or two.

@marvin1099 marvin1099 added the test me Added to PRs that look merge‑ready, but still clone and test the code to confirm expected behavior. label Mar 31, 2026
Adds get_mouse_location() function that uses tkinter to get the current
mouse position, then passes this location to PySimpleGUI windows so they
appear on the active screen in multi-monitor setups.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@shymega shymega force-pushed the shymega/make-tk-appear-on-current-screen branch from 32c43ac to 3c789b4 Compare May 2, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test me Added to PRs that look merge‑ready, but still clone and test the code to confirm expected behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants