Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you like macOS keyboard shortcuts, I recommend you checkout Kinto go Windows and Linux. On Windows, Kinto used AHK https://kinto.sh However, at least when I set it up Kinto did not provide switching windows in this fashion. Here is the script I use. This includes some related functionality to make the handling of windows more Mac-like

```

; BRING FORWARD ALL WINDOWS OF THE CURRENT APPLICATION ; This is a generalized version of ; https://superuser.com/questions/113162/bring-to-front-all-wi...

    ^!`::
        WinGetClass, class, A
        WinGet, id, list, ahk_class  %class%
        Loop, %id%
        {
            this_id := id%A_Index%
            WinActivate, ahk_id %this_id%
            ; MsgBox, The active window's this_id is "%this_id%".
        }
    return

    ; MINIMIZE ALL WINDOWS OF THE CURRENT APPLICATION
    ^!m::
        WinGetClass, class, A
        WinGet, id, list, ahk_class  %class%
        Loop, %id%
        {
            this_id := id%A_Index%
            WinMinimize, ahk_id %this_id%
        }
    return


    ; CYCLE ALL WINDOWS OF CURRENT APPLICATION
    ; Pull bottom window to the top, and force it to display
    ^`::
        ; need Process and Class to restrict to current application
        ; most apps have unquie window classes, but Chromium based apps
        ; share their primary window class. Thus Google Chrome, VS Code and
        ; Electron based apps all looked the same using only `class`
        WinGet, Active_ID, ID, A
        WinGet, Active_Process, ProcessName, ahk_id %Active_ID%
        WinGetClass, class, A
        WinGet, id, list, ahk_class  %class% ahk_exe %Active_Process%
        lastItem := id%id0%
        lastItemId :=  id%lastItem%
        WinActivate, ahk_id %lastItemId%
        WinSet, Top,,  ahk_id %lastItemId%
        Winset, AlwaysOnTop, On
        Winset, AlwaysOnTop, Off
    return

    ; CLOSE CURRENT WINDOW AND ACTIVATE NEXT WINDOW OF CURRENT APP
    ; similar to the CYLCE ALL WINDOWS OF CURRENT APP, but closes the
    ; current window.
    ;
    ; Because some Apps have Tabs that are closed via the same `^w` shortcut,
    ; we only switch to the next active window if the current window no longer
    ; exists after sending `^w`
    ;
    ; RATIONAL: This makes the Application Context a little more like macOS
    ; where closing windows leaves you in the current application, and not
    ; a random window that is the next in the stack.
    $^w::
        ; need Process and Class to restrict to current application
        ; most apps have unquie window classes, but Chromium based apps
        ; share their primary window class. Thus Google Chrome, VS Code and
        ; Electron based apps all looked the same using only `class`
        WinGet, Active_ID, ID, A
        WinGet, Active_Process, ProcessName, ahk_id %Active_ID%
        WinGetClass, class, A
        WinGet, id, list, ahk_class  %class% ahk_exe %Active_Process%
        lastItem := id%id0%
        lastItemId :=  id%lastItem%
        Send ^w
        Sleep 50
        WinGet, Current_ID, ID, A
        If (Current_ID != Active_ID) {
            WinActivate, ahk_id %lastItemId%
            WinSet, Top,,  ahk_id %lastItemId%
            Winset, AlwaysOnTop, On
            Winset, AlwaysOnTop, Off
        }
    return
```


Thank you so much!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: