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

[Question] Any way to implement BLOCKING CALL when calling the function from cmd? #273

Open
Zevan770 opened this issue Sep 10, 2024 · 0 comments

Comments

@Zevan770
Copy link

Background

I read the document here and command line help, and learned that win-vind functions could be called from command line, by win-vind -c "<FUNCTION>" or win-vind -f "FUNCTION". But the calling is not blocking, which means it will return immediately.

Question

Is there a way to call win-vind functions from command line, and wait for the function to finish?

More details

I use autohotkey for most of my keybindings, which conflict s with many win-vind keybindings. So I only need the awesome <easy_click> and <gridmove> function of win-vind. I just keep win-vind in Resident mode, and create keybingdings by calling win-vind with cmdline flags in autohotkey scripts.

My .vindrc:

version tiny
set initmode=r  " resident mode
set novcmdline
set uiacachebuild
set uiacachebuild_lifetime=5000
set uiacachebuild_staybegin=500
set uiacachebuild_stayend=2000

autohotkey v2 script:

; My Keymap class and Map method
class Keymap {
  Map(hotkeyName, handler, keymapToLock := false, winTitle := "", conditionType := 0, options := "") {
  }
}

; bind win-vind gridmove to "<!<_s"(saying <lalt_lshift_s>), 
; and wait until it finishs, before locking/activating my own mouse keybindings
globalKeyMap.Map("<!<+s", _ => (Runwait("win-vind -f gridmove")), slowMouseKeymap)

I want to activate my own mouse keymap right after calling gridmove, so I used RunWait(wait until finish) as handler.

However, the cmdline calling is not blocking, so my mouse keybindings are activated before gridmove finishes. It means that autohotkey will swallow key inputs, and will not sent to gridmove.

If I could blocking call gridmove, it will be solved.

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

No branches or pull requests

1 participant