diff options
-rw-r--r-- | scripts.ahk | 6 | ||||
-rw-r--r-- | tiny/cfg.ahk | 114 | ||||
-rw-r--r-- | tt.keyboard.ahk | 33 | ||||
-rw-r--r-- | tt.layout.ahk | 10 | ||||
-rw-r--r-- | tt.programs.ahk | 4 | ||||
-rw-r--r-- | tt.programs.explorer.ahk | 1 | ||||
-rw-r--r-- | tt.volume.ahk | 2 | ||||
-rw-r--r-- | tt.windows.ahk | 27 | ||||
-rw-r--r-- | tt.windowselect.ahk | 71 |
9 files changed, 253 insertions, 15 deletions
diff --git a/scripts.ahk b/scripts.ahk index 1cde37d..7866b7a 100644 --- a/scripts.ahk +++ b/scripts.ahk @@ -29,9 +29,9 @@ return ; Zoom toggle mute -#If !GetKeyState("NumLock", "T") -F1::ControlSend, ZPControlPanelClass1, {Alt down}a{Alt up}, ahk_class ZPContentViewWndClass -#If +;#If !GetKeyState("NumLock", "T") +;F1::ControlSend, ZPControlPanelClass1, {Alt down}a{Alt up}, ahk_class ZPContentViewWndClass +;#If ; Caps Lock toggle/display diff --git a/tiny/cfg.ahk b/tiny/cfg.ahk new file mode 100644 index 0000000..12be889 --- /dev/null +++ b/tiny/cfg.ahk @@ -0,0 +1,114 @@ +#SingleInstance Force +#Persistent + +;; Initialization. +ShellApp := ComObjCreate("Shell.Application") +us := DllCall("LoadKeyboardLayout", "Str", "00000409", "Int", 1) +jp := DllCall("LoadKeyboardLayout", "Str", "00000411", "Int", 1) +;; ru := DllCall("LoadKeyboardLayout", "Str", "00000419", "Int", 1) +;; sv := DllCall("LoadKeyboardLayout", "Str", "0000041D", "Int", 1) + +Menu, Tray, Tip, Cfg +Menu, Tray, Icon, shell32.dll, 105 + +GroupAdd, Explorer, ahk_class CabinetWClass +GroupAdd, Explorer, ahk_class ExploreWClass +GroupAdd, Desktop, ahk_class Progman +GroupAdd, Desktop, ahk_class WorkerW + +Gui +LastFound +DllCall("RegisterShellHookWindow", UInt, WinExist()) +msg := DllCall("RegisterWindowMessage", Str, "SHELLHOOK") +OnMessage(msg, "FixZ") +return + +;; Fix z-order after minimization. +FixZ(wParam, lParam){ + static HSHELL_GETMINRECT := 5 + static HWND_BOTTOM := 1 + static SWP_NOSIZE := 0x0001 + static SWP_NOMOVE := 0x0002 + static SWP_ASYNCWINDOWPOS := 0x4000 + if(wParam = HSHELL_GETMINRECT and WinActive("A") = 0){ + hwnd := NumGet(lParam + 0) + WinWaitNotActive, ahk_id 0 ; Wait until end of minimization. + Sleep, 20 + DllCall("SetWindowPos", "UInt", hwnd, "UInt", HWND_BOTTOM + , "Int", 0, "Int", 0, "Int", 0, "Int", 0 + , "UInt", SWP_NOSIZE | SWP_NOMOVE | SWP_ASYNCWINDOWPOS) + } +} + +;; Window management hotkeys. +#o::WinSet, AlwaysOnTop, Toggle, A +#z::WinMinimize, A + +;; Command prompt hotkeys. +#IfWinActive ahk_group Explorer +^p:: +WinGet, hwnd, id, A +for window in ShellApp.Windows + if (window.hwnd = hwnd) + window.Document.Application.ShellExecute("cmd" + , "/k cd /d """ window.Document.Folder.Self.path """") + +return +#IfWinActive ahk_class ConsoleWindowClass +!F4::WinClose, A +#IfWinActive + +;; Volume hotkeys. +RAlt & F6::SetVolume(GetKeyState("Shift") ? 2 : 1) +RAlt & F5::SetVolume(GetKeyState("Shift") ? -2 : -1) +SetVolume(n){ + SoundGet, s + s := round(s) + n + if (s > 100) + s := 100 + if (s < 0) + s := 0 + SoundSet, %s% + ToolTip, %s% + SetTimer, RemoveToolTip, -100 +} +RemoveToolTip: +ToolTip +return + +;; Toggle keyboard layout. +^\:: +<^>!^SC00C:: +if(Layout() == us) + new := jp +else + new := us +DllCall("SendMessage", "UInt", WinActive("A"), "UInt", 80, "UInt", 1, "UInt", new) +return +Layout(){ + f := A_FormatInteger + SetFormat, Integer, H + if (hwnd = "") + WinGet, hwnd, id, A + thread := DllCall("GetWindowThreadProcessId", "UInt",hwnd, "UInt",0) + layout := DllCall("user32.dll\GetKeyboardLayout", "UInt",thread, "UInt") + SetFormat, Integer, %f% + return layout +} + +;; Extra keys. +#If Layout() == us && !WinActive("ahk_exe VirtualBoxVM.exe") +:z*?:aa::å +:z*?:ae::ä +:z*?:oe::ö +:z*?:AA::Å +:z*?:AE::Ä +:z*?:OE::Ö +:z*?:a``::à +:z*?:e``::é +:z*?:A``::À +:z*?:E``::É +>!a::SendInput, a +>!e::SendInput, e +>!+a::SendInput, A +>!+e::SendInput, E +#If
\ No newline at end of file diff --git a/tt.keyboard.ahk b/tt.keyboard.ahk index 82d0469..599f328 100644 --- a/tt.keyboard.ahk +++ b/tt.keyboard.ahk @@ -7,7 +7,7 @@ >!s::SendInput, {ASC 0223} ; ß <^>!s::SendInput, {ASC 0223} -#If Layout() = layouts.sv && GetKeyState("NumLock", "T") ; see tt.layout.ahk +#If Layout() = layouts.sv && GetKeyState("NumLock", "T") && !WinActive("ahk_exe VirtualBoxVM.exe") +SC00D::SendInput, ``{Space} +SC01B::SendInput, {^}{Space} <^>!SC01B::SendInput, ~{Space} @@ -27,9 +27,26 @@ ;; ANSI keyboard mappings ----------------------------------------------------- -/* -#If Layout() = layouts.us ; see tt.layout.ahk +#If Layout() = layouts.us && !WinActive("ahk_exe VirtualBoxVM.exe") ; see tt.layout.ahk + +>!a::SendInput, a +>!e::SendInput, e +>!+a::SendInput, A +>!+e::SendInput, E + +:z*?:aa::å +:z*?:ae::ä +:z*?:oe::ö +:z*?:AA::Å +:z*?:AE::Ä +:z*?:OE::Ö + +:z*?:a``::à +:z*?:e``::é +:z*?:A``::À +:z*?:E``::É +/* SC01A::å SC01B::ä SC02B::ö @@ -52,9 +69,9 @@ SC02B::ö >!+e::SendInput, {ASC 0201} ; É >!4::SendInput, {ASC 0164} ; ¤ >!+4::SendInput, {ASC 0128} ; € +*/ #If -*/ ;; Acer 6312-K mappings ------------------------------------------------------- @@ -104,6 +121,14 @@ Modifiers() { #i Up::SendInput, {PgUp up} *#o::SendInput, % Modifiers() "{End down}" #o Up::SendInput, {End up} + +#n:: +SendInput, {NumLock} +if (!GetKeyState("NumLock", "T")) + ToolTip, NumLock disabled +Sleep, 500 +ToolTip +return */ ;; -> init diff --git a/tt.layout.ahk b/tt.layout.ahk index 688c050..0c89e04 100644 --- a/tt.layout.ahk +++ b/tt.layout.ahk @@ -2,7 +2,8 @@ ;; -> body -LWin & SC029:: ; key left of 1 +^\:: +^+\:: if (GetKeyState("Shift")) new := altlayout else @@ -28,9 +29,10 @@ return layouts := { ru: DllCall("LoadKeyboardLayout", "Str", "00000419", "Int", 1) , sv: DllCall("LoadKeyboardLayout", "Str", "0000041D", "Int", 1) - , us: DllCall("LoadKeyboardLayout", "Str", "00000409", "Int", 1) } -activelayouts := [layouts.sv, layouts.ru] -altlayout := layouts.us + , us: DllCall("LoadKeyboardLayout", "Str", "00000409", "Int", 1) + , jp: DllCall("LoadKeyboardLayout", "Str", "00000411", "Int", 1) } +activelayouts := [layouts.us, layouts.jp] +altlayout := layouts.ru ShowLayout() diff --git a/tt.programs.ahk b/tt.programs.ahk index 0459825..2e5337f 100644 --- a/tt.programs.ahk +++ b/tt.programs.ahk @@ -172,7 +172,7 @@ F5:: return */ -#If WinActive("ahk_exe v2game.exe") +#If WinActive("ahk_exe v2game.exe") or WinActive("ahk_exe CK2game.exe") MButton::RButton RButton::MButton @@ -195,7 +195,7 @@ VictoriaWindowMessage(wParam, lParam) if (wParam = 4 or wParam = 32772) ; HSHELL_WINDOW_ACTIVATED | HSHELL_RUDEAPPACTIVATED { WinGet, exe, ProcessName, A - if (exe = "v2game.exe") + if (exe = "v2game.exe" or exe = "CK2game.exe") { Sleep, 1500 ClipCursor(True, 6, 6, A_ScreenWidth-5, A_ScreenHeight-5) diff --git a/tt.programs.explorer.ahk b/tt.programs.explorer.ahk index 0b2b842..9d76e3e 100644 --- a/tt.programs.explorer.ahk +++ b/tt.programs.explorer.ahk @@ -87,6 +87,7 @@ return #IfWinActive +LWin & LButton:: *#LButton:: MouseGetPos,,, hwnd if (not DoubleClick() or not WinActive("ahk_group Explorer")) ; see tt.doubleclick.ahk diff --git a/tt.volume.ahk b/tt.volume.ahk index 5946469..4c69248 100644 --- a/tt.volume.ahk +++ b/tt.volume.ahk @@ -2,9 +2,11 @@ ;; -> body +/* XButton2::SendInput, {XButton2} XButton2 & WheelUp::SetVolume(GetKeyState("Shift") ? 2 : 1) XButton2 & WheelDown::SetVolume(GetKeyState("Shift") ? -2 : -1) +*/ RAlt & F6::SetVolume(GetKeyState("Shift") ? 2 : 1) RAlt & F5::SetVolume(GetKeyState("Shift") ? -2 : -1) diff --git a/tt.windows.ahk b/tt.windows.ahk index 26748a0..437af3e 100644 --- a/tt.windows.ahk +++ b/tt.windows.ahk @@ -14,9 +14,9 @@ Gui, FakeWindow:Show, x0 y%y% AutoSize NA, FakeWindow ; Raise all windows of the same process LWin Up:: +hwnd := WinActive("A") Loop, 2 { - hwnd := WinActive("A") WinGet, exe, ProcessName, A WinGet, L, List, ahk_exe %exe% Loop, % L @@ -26,14 +26,15 @@ Loop, 2 , "Int", 0, "Int", 0, "Int", 0, "Int", 0 , "UInt", 0x0001|0x0002|0x4000) ; SWP_NOSIZE|SWP_NOMOVE|SWP_ASYNCWINDOWPOS } + WinActivate, ahk_id %hwnd% } return ; Hide all windows of the same process (except the current one) +LWin Up:: +hwnd := WinActive("A") Loop, 2 { - hwnd := WinActive("A") WinGet, exe, ProcessName, A WinGet, L, List, ahk_exe %exe% Loop, % L @@ -45,6 +46,7 @@ Loop, 2 , "Int", 0, "Int", 0, "Int", 0, "Int", 0 , "UInt", 0x0001|0x0002|0x4000) ; SWP_NOSIZE|SWP_NOMOVE|SWP_ASYNCWINDOWPOS } + WinActivate, ahk_id %hwnd% } return @@ -94,6 +96,27 @@ Loop { WinMinimize, ahk_id %hwnd% return +/* +#If ShouldActivateMButton() +MButton:: + Send, {Shift Down} + MouseClick, Right + Send, {Shift Up}{Down}{Down}{Down}{Down}{Down}{Enter} + return +#If +*/ + +;; -> library + +/* +ShouldActivateMButton() { + MouseGetPos, xpos, ypos, , ControlUnderMouse + return ControlUnderMouse = "MSTaskSwWClass1" + || ControlUnderMouse = "ApplicationManager_DesktopShellWindow" + || ControlUnderMouse = "Shell_TrayWnd1" + || ControlUnderMouse = "MSTaskListWClass1" +} +*/ ;; -> body diff --git a/tt.windowselect.ahk b/tt.windowselect.ahk index 889c735..088f3a9 100644 --- a/tt.windowselect.ahk +++ b/tt.windowselect.ahk @@ -2,6 +2,20 @@ ;; -> body +/* +*#1::QuickLaunch(1) +*#2::QuickLaunch(2) +*#3::QuickLaunch(3) +*#4::QuickLaunch(4) +*#5::QuickLaunch(5) +*#6::QuickLaunch(6) +*#7::QuickLaunch(7) +*#8::QuickLaunch(8) +*#9::QuickLaunch(9) +*#0::QuickLaunch(10) +*/ + +/* #1::Taskbar(1) #2::Taskbar(2) #3::Taskbar(3) @@ -12,9 +26,60 @@ #8::Taskbar(8) #9::Taskbar(9) #0::Taskbar(10) +*/ + +; Shortcuts +/* +*#q::QuickLaunch(4) +*#w::QuickLaunch(5) +*#a::QuickLaunch(6) +*/ +/* +#q::Taskbar(4) +#w::Taskbar(5) +#a::Taskbar(6) +*/ + +/* +#q:: +hwnd := WinActive("A") +WinGet, mm, MinMax, ahk_id %hwnd% +WinGetPos, wx, wy, ww, wh, ahk_id %hwnd% +MsgBox, %wx%x%wy% -- %ww%x%wh% +if ((mm = 0) && (wx = 0) && (xy = 0) && (ww = A_ScreenWidth) && (wh = A_ScreenHeight)) + WinActivate, ahk_class Progman +return +*/ ;; -> library +QuickLaunch(n) +{ + static start := 56 ; set this to your start menu button width + static width := 24 ; set this to your taskbar button width + static offset := 0 ; don't change this + if (offset = 0) + offset := 15 + else + offset := 0 + x := start + width*(n-1) + offset + + ; Activate taskbar if full-screen + WinGetPos, wx, wy, ww, wh, A + if (wx = 0 and wy = 0 and ww = A_ScreenWidth and wh = A_ScreenHeight) + WinActivate, ahk_class Shell_TrayWnd + + ;DllCall("SwitchToThisWindow", "UInt", WinExist("ahk_class Progman"), "UInt", 1) + tmp := A_CoordModeMouse + CoordMode, Mouse, Screen + MouseGetPos, ox, oy + BlockInput, MouseMove + MouseClick, Left, %x%, %A_ScreenHeight%, 1, 0 + MouseMove, %ox%, %oy%, 0 + BlockInput, MouseMoveOff + CoordMode, Mouse, %tmp% +} + Taskbar(n) { static start := 63 ; set this to your start menu button width @@ -26,6 +91,12 @@ Taskbar(n) offset := 0 x := start + width*(n-1) + offset + ; Activate taskbar if full-screen + WinGetPos, wx, wy, ww, wh, A + if (wx = 0 and wy = 0 and ww = A_ScreenWidth and wh = A_ScreenHeight) + WinActivate, ahk_class Shell_TrayWnd + + ;DllCall("SwitchToThisWindow", "UInt", WinExist("ahk_class Progman"), "UInt", 1) tmp := A_CoordModeMouse CoordMode, Mouse, Screen MouseGetPos, ox, oy |