From 8afb29339a6d93dc993e9d1ed4c13ae7be6be3fb Mon Sep 17 00:00:00 2001 From: Pawel Grochola Date: Wed, 4 Sep 2019 23:52:34 +0200 Subject: [PATCH] Separate function definitions from general script settings --- desktop-switcher.ahk | 12 ++++++++++++ desktop_switcher.ahk => functions.ahk | 10 ---------- 2 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 desktop-switcher.ahk rename desktop_switcher.ahk => functions.ahk (94%) diff --git a/desktop-switcher.ahk b/desktop-switcher.ahk new file mode 100644 index 0000000..a845c27 --- /dev/null +++ b/desktop-switcher.ahk @@ -0,0 +1,12 @@ +#SingleInstance Force ; The script will Reload if launched while already running +#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases +#KeyHistory 0 ; Ensures user privacy when debugging is not needed +SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory +SendMode Input ; Recommended for new scripts due to its superior speed and reliability + +; Main +SetKeyDelay, 75 + +#Include %A_ScriptDir%\functions.ahk +#Include %A_ScriptDir%\user_config.ahk +return \ No newline at end of file diff --git a/desktop_switcher.ahk b/functions.ahk similarity index 94% rename from desktop_switcher.ahk rename to functions.ahk index a719ecd..5f65d3c 100644 --- a/desktop_switcher.ahk +++ b/functions.ahk @@ -1,9 +1,3 @@ -#SingleInstance Force ; The script will Reload if launched while already running -#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases -#KeyHistory 0 ; Ensures user privacy when debugging is not needed -SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory -SendMode Input ; Recommended for new scripts due to its superior speed and reliability - ; Globals DesktopCount := 2 ; Windows starts with 2 desktops at boot CurrentDesktop := 1 ; Desktop count is 1-indexed (Microsoft numbers them this way) @@ -15,13 +9,9 @@ global IsWindowOnDesktopNumberProc := DllCall("GetProcAddress", Ptr, hVirtualDes global MoveWindowToDesktopNumberProc := DllCall("GetProcAddress", Ptr, hVirtualDesktopAccessor, AStr, "MoveWindowToDesktopNumber", "Ptr") ; Main -SetKeyDelay, 75 mapDesktopsFromRegistry() OutputDebug, [loading] desktops: %DesktopCount% current: %CurrentDesktop% -#Include %A_ScriptDir%\user_config.ahk -return - ; ; This function examines the registry to build an accurate list of the current virtual desktops and which one we're currently on. ; Current desktop UUID appears to be in HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SessionInfo\1\VirtualDesktops