2021-01-29 15:32:21 +00:00
|
|
|
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
|
|
|
|
; #Warn ; Enable warnings to assist with detecting common errors.
|
|
|
|
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
|
|
|
|
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
|
|
|
|
CoordMode, Mouse, Screen ; mouse coordinates relative to the screen
|
2021-08-11 03:05:21 +00:00
|
|
|
CoordMode, Pixel, Screen ; mouse coordinates relative to the screen
|
2021-01-29 15:32:21 +00:00
|
|
|
|
|
|
|
; =========================
|
2021-07-08 08:16:21 +00:00
|
|
|
; DEBUGGING
|
2021-01-29 15:32:21 +00:00
|
|
|
; =========================
|
2021-07-23 07:17:11 +00:00
|
|
|
global DEBUGGING := False
|
2021-07-08 08:16:21 +00:00
|
|
|
|
|
|
|
ToggleDebugging() {
|
|
|
|
global DEBUGGING
|
|
|
|
DEBUGGING := not DEBUGGING
|
|
|
|
}
|
|
|
|
|
2021-07-08 13:36:12 +00:00
|
|
|
LogDebug(params*) {
|
2021-07-08 08:16:21 +00:00
|
|
|
global DEBUGGING
|
|
|
|
if (not DEBUGGING) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
FormatTIme, now, , MM-dd HH:mm:ss
|
|
|
|
log := FileOpen("d:\win.ahk.log", "a")
|
2021-07-08 13:36:12 +00:00
|
|
|
log.WriteLine(Format("[{1}] {2}", now, Format(params*)))
|
2021-07-08 08:16:21 +00:00
|
|
|
log.Close()
|
|
|
|
}
|
|
|
|
|
2021-07-23 04:59:49 +00:00
|
|
|
SetDisableLockWorkstationRegKeyValue(value) {
|
|
|
|
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, DisableLockWorkstation, %value%
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LockWorkStation() {
|
|
|
|
SetDisableLockWorkstationRegKeyValue( 0 )
|
|
|
|
; Lock
|
|
|
|
DllCall( "User32\LockWorkStation" )
|
|
|
|
; Disable locking again
|
|
|
|
SetDisableLockWorkstationRegKeyValue( 1 )
|
|
|
|
}
|
2021-07-08 08:16:21 +00:00
|
|
|
|
2021-01-29 15:32:21 +00:00
|
|
|
; =========================
|
2021-07-08 08:16:21 +00:00
|
|
|
; LIBS
|
2021-01-29 15:32:21 +00:00
|
|
|
; =========================
|
2021-07-08 08:16:21 +00:00
|
|
|
InitWindowManager()
|
|
|
|
InitClipboardManager()
|
2021-07-31 10:03:28 +00:00
|
|
|
; SetDisableLockWorkstationRegKeyValue(1) ; in order to remap win+l
|
2021-07-08 08:16:21 +00:00
|
|
|
#Include, ahk\JSON.ahk
|
|
|
|
#Include, ahk\WindowManager.ahk
|
|
|
|
#Include, ahk\ClipboardManager.ahk
|
2021-08-04 13:09:59 +00:00
|
|
|
#Include, ahk\Spotlight.ahk
|
2021-07-08 08:16:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
; =========================
|
|
|
|
; KEY BINDINGS
|
|
|
|
; =========================
|
|
|
|
; Super + Shift + r => Reload ahk
|
|
|
|
#+r::Reload
|
|
|
|
; Ctrl + ESC => Ctrl+`
|
2020-05-10 07:20:40 +00:00
|
|
|
^Esc:: Send ^{``}
|
2021-07-08 08:16:21 +00:00
|
|
|
; Win + q => Close window
|
|
|
|
#q:: !F4
|
|
|
|
; Ctrl+ backspace => Delete all text
|
2020-05-10 07:20:40 +00:00
|
|
|
^BS::
|
2021-07-08 08:16:21 +00:00
|
|
|
Send ^a
|
|
|
|
Send {BS}
|
|
|
|
return
|
|
|
|
; Win + = => Increase Volume
|
2021-07-01 14:16:25 +00:00
|
|
|
#=::SoundSet, +5
|
2021-07-08 08:16:21 +00:00
|
|
|
; Win + - => Decrease volume
|
2021-07-01 14:16:25 +00:00
|
|
|
#-::SoundSet, -5
|
2021-07-08 08:16:21 +00:00
|
|
|
; Win + \ => Toggle mute
|
2021-07-01 14:16:25 +00:00
|
|
|
#\::Send {Volume_Mute}
|
2021-07-08 08:16:21 +00:00
|
|
|
; Win + backspace => Lock
|
2021-07-23 04:59:49 +00:00
|
|
|
#BS::LockWorkStation()
|
2021-07-08 08:16:21 +00:00
|
|
|
|
|
|
|
; WINDOW MANAGER
|
|
|
|
|
|
|
|
; Win + j => Focus right window
|
2021-01-29 15:32:21 +00:00
|
|
|
#j:: FocusWinByDirection("right")
|
2021-07-08 08:16:21 +00:00
|
|
|
; Win + k => Focus left window
|
2021-01-29 15:32:21 +00:00
|
|
|
#k:: FocusWinByDirection("left")
|
2021-07-23 04:59:49 +00:00
|
|
|
; Win + f => Move active window as monocle
|
|
|
|
#f::ArrangeActiveWindow("monocle")
|
2021-07-08 08:16:21 +00:00
|
|
|
; Win + Shift + j => Move active window to right side
|
2021-07-23 04:59:49 +00:00
|
|
|
#+j::ArrangeActiveWindow("right")
|
2021-07-08 08:16:21 +00:00
|
|
|
; Win + Shift + k => Move active window to left side
|
2021-07-23 04:59:49 +00:00
|
|
|
#+k::ArrangeActiveWindow("left")
|
2021-07-08 08:16:21 +00:00
|
|
|
; Win + Shift + b => Blacklist active window so it won't be arranged when launched
|
|
|
|
#+b::BlacklistArrangementForActiveWindow()
|
|
|
|
; Win + Shift + b => Whitelist active window so it always be arranged when launched
|
|
|
|
#+w::WhitelistArrangementForActiveWindow()
|
2021-07-31 10:03:28 +00:00
|
|
|
; Win + Shift + g => Remove active window from Blacklist/Whitelist
|
2021-07-23 07:17:11 +00:00
|
|
|
#+g::IgnoreArrangementForActiveWindow()
|
2021-07-08 08:16:21 +00:00
|
|
|
; Win + Shift + d => Toggle debug logging
|
|
|
|
#+d::ToggleDebugging()
|
2021-07-23 07:17:11 +00:00
|
|
|
#u::MoveCursorToMonitor("left")
|
|
|
|
#i::MoveCursorToMonitor("right")
|
|
|
|
#+u::MoveWindowToMonitor("left")
|
|
|
|
#+i::MoveWindowToMonitor("right")
|
2020-05-10 07:20:40 +00:00
|
|
|
|
|
|
|
|
2021-08-04 13:09:59 +00:00
|
|
|
; SPOTLIGHT
|
|
|
|
#p::Spotlight()
|
|
|
|
|
2021-07-08 08:16:21 +00:00
|
|
|
; CLIPBOARD MANAGER
|
|
|
|
#c::AlternativeCopy()
|
2021-07-08 14:14:13 +00:00
|
|
|
#+c::CopyClipboardToAlternative()
|
2021-07-08 08:16:21 +00:00
|
|
|
#v::AlternativePaste()
|
2020-05-10 07:20:40 +00:00
|
|
|
|
|
|
|
|
2021-01-29 15:32:21 +00:00
|
|
|
; CAPSLOCK AS HYBRID KEY
|
2020-07-23 01:52:04 +00:00
|
|
|
|
|
|
|
; Capslock & h:: Send {Left}
|
|
|
|
; Capslock & j:: Send {Down}
|
|
|
|
; Capslock & k:: Send {Up}
|
|
|
|
; Capslock & l:: Send {Right}
|
|
|
|
; Capslock & y:: Send {Browser_Back}
|
|
|
|
; Capslock & u:: Send ^{PgUp}
|
|
|
|
; Capslock & i:: Send ^{PgDn}
|
|
|
|
; Capslock & o:: Send {Browser_Forward}
|
|
|
|
; Capslock & BackSpace:: Send {Del}
|
|
|
|
|
|
|
|
; Capslock & n:: Send {Home}
|
|
|
|
; Capslock & m:: Send {PgUp}
|
|
|
|
; Capslock & ,:: Send {PgDn}
|
|
|
|
; Capslock & .:: Send {End}
|
|
|
|
|
2021-07-01 14:16:25 +00:00
|
|
|
; Capslock & Space:: SetCapsLockState % !GetKeyState("CapsLock", "T")
|
2020-07-23 01:52:04 +00:00
|
|
|
; +CapsLock::
|
|
|
|
; Send {~}
|
|
|
|
; SetCapsLockState % !GetKeyState("CapsLock", "T")
|
|
|
|
; Return
|
2021-08-11 03:05:21 +00:00
|
|
|
; Capslock::return
|
|
|
|
|
|
|
|
|
|
|
|
; HELPER
|
|
|
|
|
|
|
|
; toggle mute for feishu meeting
|
|
|
|
#m::
|
|
|
|
WinGet, prevWinId, ID, A
|
|
|
|
MouseGetPos, ox, oy
|
|
|
|
WinGet, meetingWinId, ID, 视频会议 ahk_exe Feishu.exe, , 视频会议 | 迷你视图
|
|
|
|
if (meetingWinId) {
|
|
|
|
WinGetPos, x, y , w, h, ahk_id %meetingWinId%
|
|
|
|
WinActivate, ahk_id %meetingWinId%
|
|
|
|
mx := x + 20
|
|
|
|
my := y + h - 20
|
|
|
|
SetCursorPos(mx, my)
|
|
|
|
SetCursorPos(mx, my)
|
|
|
|
MouseClick
|
|
|
|
Sleep, 100
|
|
|
|
; mx := x + 38
|
|
|
|
; my := y + h - 36
|
|
|
|
; PixelGetColor, color, %mx%, %my%
|
|
|
|
; MsgBox, %mx% %my% %color%
|
|
|
|
WinActivate, ahk_id %prevWinId%
|
|
|
|
SetCursorPos(ox, oy)
|
|
|
|
; if (color = 0x5d5651) {
|
|
|
|
; TrayTip, note, feishu meeting unmuted
|
|
|
|
; Sleep 3000
|
|
|
|
; HideTrayTip()
|
|
|
|
; }
|
|
|
|
}
|
|
|
|
Return
|