Skip to content

Commit

Permalink
Merge pull request #12 from TheBestPessimist/ahk_2
Browse files Browse the repository at this point in the history
Upgrade to Autohotkey 2
  • Loading branch information
TheBestPessimist authored Dec 26, 2022
2 parents 8271e33 + da6da78 commit f80a625
Show file tree
Hide file tree
Showing 58 changed files with 4,126 additions and 959 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/.idea/
/Private.ahk
/AutoHotkey_2.0.0/Private.ahk
Binary file added AutoHotkey.chm
Binary file not shown.
67 changes: 28 additions & 39 deletions AutoHotkeyU64.ahk → AutoHotkey64.ahk
Original file line number Diff line number Diff line change
@@ -1,91 +1,80 @@
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

#SingleInstance force
#MaxHotkeysPerInterval 200
#WinActivateForce
#InstallKeybdHook
#InstallMouseHook
#Requires AutoHotkey v2.0

#SingleInstance Force
;#WinActivateForce ; disabled to check if AHK v2 works better than AHK V1
InstallKeybdHook
InstallMouseHook
; these 2 settings are killing the telegram starter, since the telegram process exists,
; just that it is hidden in the tray, instead of taskbar
; DetectHiddenWindows, On
; SetTitleMatchMode, 2

#MenuMaskKey vk07

; Change the icon in taskbar
; Ref: https://github.com/TaranVH/2nd-keyboard/blob/master/INFO_and_PROFILES/system32-shell32_dll.png
; Menu, Tray, Icon, shell32.dll, 303 ; changes tray icon to a check mark
; Menu, Tray, Icon, shell32.dll, 16 ; change tray icon to a little laptop
; Menu, Tray, Icon, shell32.dll, 321 ; change tray icon to a blue star
; Menu, Tray, Icon, shell32.dll, 44 ; change tray icon to a yellow star
Menu, Tray, Icon, resources/blueStar.ico
; TraySetIcon "shell32.dll", 303 ; changes tray icon to a check mark
; TraySetIcon "shell32.dll", 16 ; change tray icon to a little laptop
; TraySetIcon "shell32.dll", 321 ; change tray icon to a blue star
; TraySetIcon "shell32.dll", 44 ; change tray icon to a yellow star
TraySetIcon("resources/blueStar.ico")


; rest of everything
#include lib/clipboard.ahk
;; rest of everything
#Include lib/Tippy.ahk
#Include lib/libdebug.ahk
#Include app_handling.ahk
#Include lib/Tippy.ahk
#Include lib/ReloadScript.ahk
#Include PowerManager.ahk
#Include CapsLockToggle.ahk
#Include SoundBalance.ahk
; #Include games/StarCraft2.ahk
#Include FixKeyGhostPresses.ahk
#Include XmgFusion15.ahk

#Include hotstrings/MarkdownEmoji.ahk
#Include hotstrings/GenericHotstrings.ahk
#Include hotstrings/MarkdownHotstrings.ahk
#Include hotstrings/ResetHotstrings.ahk

#Include *i Private.ahk

;-------------------------------------------------
; Handle multiple virtual desktops
CapsLock & D:: SendInput ^#{Right}
CapsLock & A:: SendInput ^#{Left}
CapsLock & D:: SendInput "^#{Right}"
CapsLock & A:: SendInput "^#{Left}"



;-------------------------------------------------
; CapsLock media keys
CapsLock & Right::SendInput {Media_Next}
CapsLock & Left::SendInput {Media_Prev}
CapsLock & Up::SendInput {Media_Play_Pause}
CapsLock & Down::SendInput {Media_Play_Pause}
CapsLock & Right::SendInput "{Media_Next}"
CapsLock & Left::SendInput "{Media_Prev}"
CapsLock & Up::SendInput "{Media_Play_Pause}"
CapsLock & Down::SendInput "{Media_Play_Pause}"



;-------------------------------------------------
; CapsLock volume
CapsLock & 3::SendInput {Volume_Down 1}
CapsLock & 4::SendInput {Volume_Up 1}
CapsLock & 3::SendInput "{Volume_Down 1}"
CapsLock & 4::SendInput "{Volume_Up 1}"


;-------------------------------------------------
; Mouse buttons Volume
XButton1::SendInput {Volume_Down 1}
XBUtton2::SendInput {Volume_Up 1}
XButton1::SendInput "{Volume_Down 1}"
XBUtton2::SendInput "{Volume_Up 1}"


;------------------------------------------------
; caps lock + space => always on top
CapsLock & SPACE:: Winset, Alwaysontop, , A
CapsLock & SPACE::WinSetAlwaysOnTop(-1, "A")



;------------------------------------------------
; caps lock + 1 => sleep screen
CapsLock & 1::
{
CapsLock & 1::{
Sleep 200 ; if you use this with a hotkey, not sleeping will make it so your keyboard input wakes up the monitor immediately
SendMessage 0x112, 0xF170, 2,,Program Manager ; send the monitor into off mode
SendMessage(0x112, 0xF170, 2,, "Program Manager") ; send the monitor into off mode
; unsure why, but sending the second message makes f.lux activate correctly when screen wakes up. otherwise i have to alt-tab for f.lux to work properly
Sleep 2000
SendMessage 0x112, 0xF170, 2,,Program Manager
Return
SendMessage(0x112, 0xF170, 2,, "Program Manager")
}


Expand Down
Binary file added AutoHotkey64.exe
Binary file not shown.
Binary file removed AutoHotkeyU64.exe
Binary file not shown.
58 changes: 11 additions & 47 deletions CapsLockToggle.ahk
Original file line number Diff line number Diff line change
@@ -1,52 +1,16 @@
; There is no need for a standard ahk auto-execute area anymore because of this method.
; This method is called automatically when the static variable autoExecute is instantiated,
; and since it's a static, it will only be instantiated once!
;
; Idea provided by @nnnik#6686 on the AHK Discord Server: https://discord.gg/s3Fqygv
CapsLockToggleAutoExecute()
{
static autoExecute := CapsLockToggleAutoExecute()
#Include lib/Tippy.ahk

; Every second enforce the correct CapsLock state
SetTimer, enforceCapsLockState, 1000
SetCapsLockState("AlwaysOff")

; Sometimes i may want to use caps. This is a toggle to control that.
global CapsLockState := "off"
}

; disable normal CapsLock usage
CapsLock::return

enforceCapsLockState()
{
global CapsLockState

if (CapsLockState = "on")
{
SetCapsLockState On
Tippy("CapsLock is: ON")
}
else if(CapsLockState = "off")
{
SetCapsLockState Off
}
}


CapsLock & Alt::
ToggleCapsLockState()
{
Critical
global CapsLockState

if (CapsLockState = "on")
{
CapsLockState := "off"
Tippy("CapsLock is: off")
CapsLock & Alt:: {
static state := 0
state := !state
if state {
SetCapsLockState("AlwaysOn")
Tippy("CapsLock is: ON", 99999999999999, 15)
}
else if(CapsLockState = "off")
{
CapsLockState := "on"
else {
SetCapsLockState("AlwaysOff")
Tippy("CapsLock is: off",, 15)
}
enforceCapsLockState()
}
166 changes: 0 additions & 166 deletions FixKeyGhostPresses.ahk

This file was deleted.

2 changes: 2 additions & 0 deletions Install.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
start "" "%~dp0AutoHotkey32.exe" "%~dp0UX\ui-setup.ahk"
6 changes: 6 additions & 0 deletions UX/Templates/Minimal for v2.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
[NewScriptTemplate]
Description = Just #Requires v2.0
*/
#Requires AutoHotkey v2.0

Loading

0 comments on commit f80a625

Please sign in to comment.