Last active
January 17, 2024 12:32
-
-
Save roseckyj/9db7a98650738fcbdeaf507311e6b2e3 to your computer and use it in GitHub Desktop.
The everyday AutoHotkey script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv | |
#SingleInstance Force | |
#InstallKeybdHook | |
#KeyHistory 10 | |
SendMode Input | |
SetWorkingDir %A_ScriptDir% | |
Menu, Tray, Icon, startup.ico | |
; =================== | |
; ===== HOTKEYS ===== | |
; =================== | |
; ===== MOUSE ALT+TAB ===== | |
XButton1:: | |
Duration=0 | |
Loop | |
{ | |
Duration ++ | |
If !GetKeyState("XButton1","P") { | |
Send {Ctrl down}{Alt down}{Tab}{Ctrl up}{Alt up} | |
break | |
} | |
If Duration > 20 | |
{ | |
Send {Enter} | |
break | |
} | |
Sleep, 10 | |
} | |
return | |
; ===== FERDI HOTKEY ===== | |
XButton2::ToggleWindow("C:\Program Files\Ferdium\Ferdium.exe") | |
<#Escape::ToggleWindow("C:\Program Files\Ferdium\Ferdium.exe") | |
; ===== SPOTIFY HOTKEY ===== | |
*Media_Stop:: | |
ToggleWindow("C:\Users\me\AppData\Roaming\Spotify\Spotify.exe") | |
return | |
; ===== ALT MEDIA CONTROLS ===== | |
<!Volume_Up::Send {Media_Next} | |
<!Volume_Down::Send {Media_Prev} | |
<!Volume_Mute::toggleDolby() | |
; ===== TWINKLE TRAY BRIGHTNESS CONTROLS ===== | |
<#Volume_Up::Send #^!{e} | |
<#Volume_Down::Send #^!{w} | |
<#Volume_Mute::ToggleNightMode() | |
; ===== KEYBOARD LAYOUT OVERRIDE ===== | |
; Remap capslock to pipe | |
+CapsLock::Send | | |
; Remap european to american enter layout | |
$SC02B::Send {Enter} | |
$<^>!SC02B::Send ¨ | |
; Remap stupid MS keyboard play pause button replacement | |
#^!p::Send {Media_Play_Pause} | |
; Copilot key :D | |
AppsKey::Run "microsoft-edge:///?ux=copilot&tcp=1&source=taskbar" | |
; ===== WIN TO HOME END ===== | |
<#Left::Send {Home} | |
<#Right::Send {End} | |
^<#Left::Send ^{Home} | |
^<#Right::Send ^{End} | |
+<#Left::Send +{Home} | |
+<#Right::Send +{End} | |
^+<#Left::Send ^+{Home} | |
^+<#Right::Send ^+{End} | |
; ===== INSERT HOTKEYS ===== | |
~Insert & Numpad1:: | |
Send {w down}{Ctrl down}{Space down} | |
Gui, 1:Hide | |
return | |
~Insert & Numpad2:: | |
SendInput,{LButton down} | |
Gui, 1:Hide | |
return | |
~Insert & Numpad3:: | |
Send {w down} | |
SendInput,{LButton down} | |
Gui, 1:Hide | |
return | |
~Insert & Numpad0:: | |
Loop, 0xFF | |
{ | |
Key := Format("VK{:02X}",A_Index) | |
IF GetKeyState(Key) | |
Send, {%Key% Up} | |
} | |
SendInput,{LButton Up} | |
return | |
~Insert & M:: | |
run, *RunAs powershell.exe -File "C:\System tools\Touchpad fix.ps1" | |
Gui, 1:Hide | |
return | |
~Insert & N:: | |
Run windowsToHomeEnd.ahk | |
Gui, 1:Hide | |
return | |
; ===== KEYBOARD OVERLAY ===== | |
Insert:: | |
w = 1508 | |
h = 460 | |
Gui, 1:+AlwaysOnTop -Caption +LastFound -SysMenu +ToolWindow -DPIScale +E0x20 | |
Gui, 1:Color, black | |
Gui, 1:Add, Picture,% "w" w " h" h " x"A_ScreenWidth//2-w//2 " y"A_ScreenHeight//2-h//2 " +BackgroundTrans", keyboard.png | |
Gui, 1:Show,% "w" A_ScreenWidth " h" A_ScreenHeight " x0 y0 NoActivate" | |
GUI_ID := WinExist() | |
WinSet, Transparent, 220 , % "ahk_id " . GUI_ID | |
WinSet, ExStyle , +0x00000020, % "ahk_id " . GUI_ID | |
keywait, Insert | |
Gui, 1:Hide | |
return | |
; ============================= | |
; ===== UTILITY FUNCTIONS ===== | |
; ============================= | |
ToggleNightMode() | |
{ | |
run ms-settings:nightlight | |
WinWait Settings | |
WinActivate, Settings | |
sleep, 1200 | |
Send {Enter} | |
WinClose, Settings | |
return | |
} | |
toggleDolby() { | |
run C:\System tools\dolby.lnk | |
WinWait, Dolby Audio Speaker System | |
WinActivate, Dolby Audio Speaker System | |
sleep, 500 | |
FileRead, filetext, C:\Program Files\Common Files\Dolby\DAX3\Runtime.xml | |
IfInString, filetext, <DolbyEnabled value=`"True`" /> | |
{ | |
; Dolby is enabled | |
Send {Tab} | |
sleep, 50 | |
Send {Tab} | |
sleep, 50 | |
Send {Tab} | |
sleep, 50 | |
Send {Tab} | |
sleep, 50 | |
Send {Enter} | |
} | |
else | |
{ | |
; Dolby is disabled | |
Send {Enter} | |
} | |
WinClose, Dolby Audio Speaker System | |
return | |
} | |
ToggleWindow(exeName) | |
{ | |
IfWinExist, ahk_exe %exeName% | |
{ | |
IfWinActive, ahk_exe %exeName% | |
{ | |
WinClose, ahk_exe %exeName% | |
} | |
else | |
{ | |
WinActivate, ahk_exe %exeName% | |
WinActivate, ahk_exe %exeName% | |
} | |
} | |
else | |
{ | |
Run %exeName% | |
} | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment