dotfiles

My PC Dotfiles & Website

files/windows/scripts/keybinds.ahk (2313B)


 1#Requires AutoHotkey v2.0
 2
 3; ==============================================================================
 4; Keybinds
 5; ==============================================================================
 6
 7; Win + Shift + Q: Force quit
 8#+q::
 9{
10    activePID := WinGetPID("A")
11    ProcessClose(activePID)
12}
13
14; ==============================================================================
15; Horizontal Scrolling (Shift + Scroll)
16; ==============================================================================
17; Shift + Scroll Up: Scroll Left
18+WheelUp::
19{
20    Send "{WheelLeft}"
21}
22
23; Shift + Scroll Down: Scroll Right
24+WheelDown::
25{
26    Send "{WheelRight}"
27}
28
29; ==============================================================================
30; Window Transparency Control (Ctrl + Shift + Scroll)
31; ==============================================================================
32^+WheelUp:: {
33    MouseGetPos(, , &win)
34
35    try {
36        Trans := WinGetTransparent(win)
37    } catch {
38        return
39    }
40
41    if (Trans = "")
42        Trans := 255
43
44    newTrans := Trans + 15
45
46    if (newTrans > 255)
47        newTrans := 255
48
49    WinSetTransparent(newTrans, win)
50}
51
52^+WheelDown:: {
53    MouseGetPos(, , &win)
54
55    try {
56        Trans := WinGetTransparent(win)
57    } catch {
58        return
59    }
60
61    if (Trans = "")
62        Trans := 255
63
64    newTrans := Trans - 15
65
66    if (newTrans < 75)
67        newTrans := 75
68
69    WinSetTransparent(newTrans, win)
70}
71
72; ==============================================================================
73; App Window Switcher (Alt + Grave)
74; ==============================================================================
75!`:: {
76    active_pid := WinGetPID("A")
77    active_exe := WinGetProcessName("A")
78    win_list := WinGetList("ahk_exe " active_exe)
79
80    if (win_list.Length < 2)
81        return
82
83    for i, hwnd in win_list {
84        if (hwnd = WinGetID("A")) {
85            next_index := (i = win_list.Length) ? 1 : i + 1
86            WinActivate(win_list[next_index])
87            break
88        }
89    }
90}
91
92; ==============================================================================
93; Miscellaneous
94; ==============================================================================
95; [SumatraPDF] Shift + /: Command Pallete
96#HotIf WinActive("ahk_exe SumatraPDF.exe")
97^vkBF:: Send "^k"
98#HotIf