Skip to content

Instantly share code, notes, and snippets.

@pwang2
Last active October 31, 2022 05:25

Revisions

  1. pwang2 revised this gist Oct 31, 2022. No changes.
  2. pwang2 revised this gist Sep 21, 2022. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions windows.ahk
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,3 @@
    global dark := true

    CapsLock::Esc
    return

  3. pwang2 revised this gist Sep 21, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions windows.ahk
    Original file line number Diff line number Diff line change
    @@ -126,3 +126,5 @@ ShortBind(ahk_exe, start_path, fullscreen=false) {
    CenterActiveWindow()
    }
    }

    ;GistID: 1298e99da93ad857d77e737cd0f03716
  4. pwang2 created this gist Sep 21, 2022.
    128 changes: 128 additions & 0 deletions windows.ahk
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,128 @@
    global dark := true

    CapsLock::Esc
    return

    MButton::
    Send ^w
    return

    +!r::
    Reload
    TrayTip "Reload", "Success"
    return

    ;-------------------------------------------
    !w::
    Send ^w
    return

    !q::
    Send {ALT DOWN}{F4}{ALT UP}
    return

    ;--------------------------------------------
    !Up::
    CenterActiveWindow()
    return

    !Left::
    Send #{Left}
    return

    !Right::
    Send #{Right}
    return

    !c::
    Send ^c
    return

    !v::
    Send ^v
    return

    ;-------------------------------------------
    !+s::
    Run, https://global.summitweb.williamblair.com
    return

    ;-------------------------------------------
    !+e::
    Run, https://imem.williamblair.com
    return

    ;-------------------------------------------
    !+a::
    Run, https://portal.azure.com
    return

    #+e::
    Run, powershell.exe -WindowStyle hidden "New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 1 -Type Dword -Force; New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 1 -Type Dword -Force"
    return

    #+d::
    Run, powershell.exe -WindowStyle hidden "New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 0 -Type Dword -Force; New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force"
    return

    ;-------------------------------------------
    !+g::
    Run, https://dev.azure.com/wbim/EMDebtAndEquity
    return

    ;--------------------------------------------
    !j::
    ShortBind("ahk_exe chrome.exe", "C:\Program Files\Google\Chrome\Application\chrome.exe")
    return

    ;-----------------------------------
    !k::
    WinMinimizeAll
    ShortBind("ahk_exe WindowsTerminal.exe", "C:\Users\pw618\scoop\apps\windows-terminal\current\wt.exe")
    return

    ;-----------------------------------
    !o::
    ShortBind("ahk_exe OUTLOOK.exe", "C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE")
    return

    ;-----------------------------------
    !p::
    ShortBind("ahk_exe Teams.exe", "C:\Users\PW618\AppData\Local\Microsoft\Teams\current\Teams.exe")
    return

    ;--------------------------------------------
    CenterActiveWindow(hideTitle = false) {
    ; get the actual work area. That is, screen size w/o the taskbar.
    SysGet, WA_, MonitorWorkArea

    A_ScreenWidthWA := WA_Right - WA_Left
    A_ScreenHeightWA := WA_Bottom - WA_Top

    WinRestore A
    WinGetTitle, windowName, A
    WinGetClass, windowClass, A

    topMargin := hideTitle ? -2 : 48
    windowHeight := WA_Bottom - topMargin
    windowWidth := A_ScreenWidthWA > 2000 ? A_ScreenWidthWA * 0.75 : windowWidth

    WinMove, %windowName%, , (A_ScreenWidthWA - windowWidth) / 2, topMargin, windowWidth, windowHeight
    }

    ShortBind(ahk_exe, start_path, fullscreen=false) {
    if !WinExist(ahk_exe) {
    Run, %start_path%
    TrayTip Starting, Starting %ahk_exe%
    }

    WinActivate, %ahk_exe%
    if(fullscreen) {
    WinGetPos,,,W,H,A
    if (W < A_ScreenWidthWA || H < A_ScreenHeightWA) {
    Send !{Enter}
    }
    } else {
    CenterActiveWindow()
    }
    }