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

About ways to call desktop manager other than Win+Tab #106

Open
friedham opened this issue Dec 5, 2024 · 1 comment
Open

About ways to call desktop manager other than Win+Tab #106

friedham opened this issue Dec 5, 2024 · 1 comment

Comments

@friedham
Copy link

friedham commented Dec 5, 2024

I configured to use Win + Tab to cycle around desk tops (as I figure it should have been in the first place like Alt+Tab ), but original desktop manager function is still useful to me.
However, since I already used win + tab as hotkey, I can't simply re-map it to something else like #41 did.
So is there anyway to call original desktop manager other than using win + tab that can be included in the script?

Sorry for the possible noob question tho.

@friedham
Copy link
Author

friedham commented Dec 5, 2024

I tried using timer to track key holding time and send output accordingly, but it seems the Win+Tab hotkey is processed in a way that is easily compromised while mannually send key stroke with script.
I turned to us Alt+Q as trigger, but still open to opinions.

Here are some of the examples I tried with the help of ChatGPT, but none of them really works as intended.

; Define the hold duration threshold (in milliseconds)
HoldThreshold := 500 ; 0.5 second

; Variable to track if the combination is held
isHeld := false

; Detect when Win + Tab is pressed
#Tab::
    isHeld := false
    StartTime := A_TickCount
    SetTimer, CheckHold, % HoldThreshold
return

; Timer to check if the key is held beyond the threshold
CheckHold:
    if (GetKeyState("LWin", "P") && GetKeyState("Tab", "P")) {
        isHeld := true
    }
    SetTimer, CheckHold, Off
return

; Handle key release
#Tab Up::
    ; If the combination is held, let Windows handle it without interference
    if (isHeld) {
        ; Explicitly bypass the script and let Task View handle the key
        Send, {LWin Up}{Tab Up}
        return
    } else {
        ; Short press action
        switchDesktopToRight()  ; Your custom function
    }
return

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