glazewm
glazewm copied to clipboard
feat: Allow Mouse to Follow Cursor onto Empty Workspace and Simulate Mouse Click to Facilitate Launching Flow Launcher Search
Here's my attempt to address Issue #554 which allows Flow Launcher to launch search on an empty workspace as well as other programs that do not like that funky state of a Workspace that has been focused but not clicked (e.g., Windows Screenshot Tool).
I'm an avid user of i3 and am very happy that this project exists which allows me to have nearly the same experience on my Windows machine. Thanks and kudos to the devs who started this!
Overview of Changes:
-
Enable mouse cursor to follow onto a workspace that is empty.
- After debugging the console output, I noticed that when the focus is changed to a workspace that has no active windows, the
FocusedContainer
is aGlazeWM.Domains.Workspaces.Workspace
type container. I modified the.Where()
on WmStartup.cs:123 to also invoke theCenterCursorOnContainerCommand
when this happens. This allows for the cursor to follow onto an empty workspace.
- After debugging the console output, I noticed that when the focus is changed to a workspace that has no active windows, the
-
Simulates Mouse Click only when Focus is changed to an Empty Workspace.
- Even after getting the mouse cursor to follow onto an empty workspace, I was still not able to launch the Search Window of Flow Launcher after focusing. It appears that the empty workspace is not actually focused (?) since I can still see the title of the last focused window in the Polybar even though the Workspace Number in the polybar is showing active.
(I can't even initiate the Windows Screenshot tool (WIN+SHIFT+S) to get a full screenshot of the highlighted workspace number and the title of the last window on my polybar when in this state so it's not just Flow Launcher that's having issues.) When I click on the empty workspace, that seems to effectively focus the workspace and the polybar title is cleared and I can launch Flow Launcher (and the Windows Screenshot tool).
- I added
SendInput
along with the required structs for Mouse Input and added that to theCenterCursorOnContainerHandler
with a check that the container is of typeWorkspace
.
- Even after getting the mouse cursor to follow onto an empty workspace, I was still not able to launch the Search Window of Flow Launcher after focusing. It appears that the empty workspace is not actually focused (?) since I can still see the title of the last focused window in the Polybar even though the Workspace Number in the polybar is showing active.
Investigating exception being thrown when coming out of the lock screen. Looks like result
from SendInput is triggered and is 0
.
I was running an old build where I didn't add the
if (container is Workspace) {}
check in the CenterCursorOnContainerHandler
which was causing the Exception to be thrown.
It's good.
Due to the C# -> Rust rewrite, some of these older PRs aren't compatible anymore. Can't merge as is, and I'm sorry about not finding the time to get this in while the C# version was active. Nevertheless, thank you for contributing🙏