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

feat: Allow Mouse to Follow Cursor onto Empty Workspace and Simulate Mouse Click to Facilitate Launching Flow Launcher Search #557

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

blampewpew
Copy link

@blampewpew blampewpew commented Mar 15, 2024

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 a GlazeWM.Domains.Workspaces.Workspace type container. I modified the .Where() on WmStartup.cs:123 to also invoke the CenterCursorOnContainerCommand when this happens. This allows for the cursor to follow onto an empty workspace.
  • 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.
      image
      image
      (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 the CenterCursorOnContainerHandler with a check that the container is of type Workspace.

@blampewpew
Copy link
Author

Investigating exception being thrown when coming out of the lock screen. Looks like result from SendInput is triggered and is 0.

…nContainerCommand and simulate Mouse Click when this is the case

Update the .where() and .subscribe() to allow Workspace containers and logic for invoking SimulateMouseClickOnContainerCommand

Removed SimulateMouseClickOnContainer and moved logic into CenterCursorOnContainerHandler with type check for Workspace

Reverted .Subscribe back to original state.

Removed empty lines that were added.
@blampewpew blampewpew force-pushed the add-simulate-mouse-click-empty-workspace branch from 4dce4b6 to f609e58 Compare March 15, 2024 17:50
@blampewpew
Copy link
Author

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.

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

Successfully merging this pull request may close these issues.

None yet

1 participant