2012-09-27 20:32:27 +00:00
|
|
|
/*
|
|
|
|
bug.n -- tiling window management
|
|
|
|
Copyright (c) 2010-2012 Joshua Fuhs, joten
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
@version 8.3.0
|
|
|
|
*/
|
2011-07-27 17:43:34 +00:00
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
NAME := "bug.n"
|
2012-05-31 15:44:05 +00:00
|
|
|
VERSION := "8.3.0"
|
2011-07-27 17:43:34 +00:00
|
|
|
|
2012-09-29 18:30:48 +00:00
|
|
|
;; Script settings
|
2011-07-27 17:43:34 +00:00
|
|
|
OnExit, Main_cleanup
|
|
|
|
SetBatchLines, -1
|
|
|
|
SetTitleMatchMode, 3
|
|
|
|
SetTitleMatchMode, fast
|
|
|
|
SetWinDelay, 10
|
|
|
|
#NoEnv
|
|
|
|
#SingleInstance force
|
|
|
|
#WinActivateForce
|
|
|
|
|
2012-09-29 18:30:48 +00:00
|
|
|
;; Pseudo main function
|
2012-09-27 20:32:27 +00:00
|
|
|
If 0 = 1
|
2012-09-28 14:15:20 +00:00
|
|
|
Main_dataDir = %1%
|
|
|
|
Else
|
2012-09-29 18:30:48 +00:00
|
|
|
Main_dataDir = %A_ScriptDir%
|
2012-09-28 15:46:17 +00:00
|
|
|
Debug_initLog(Main_dataDir "\log.txt", 0, False)
|
2012-09-28 14:15:20 +00:00
|
|
|
Config_filePath := Main_dataDir "\config.ini"
|
2012-09-27 20:32:27 +00:00
|
|
|
Config_init()
|
|
|
|
|
|
|
|
Menu, Tray, Tip, %NAME% %VERSION%
|
2012-09-28 13:54:06 +00:00
|
|
|
IfExist %A_ScriptDir%\logo.ico
|
|
|
|
Menu, Tray, Icon, %A_ScriptDir%\logo.ico
|
2012-09-27 20:32:27 +00:00
|
|
|
Menu, Tray, NoStandard
|
|
|
|
Menu, Tray, Add, Toggle bar, Main_toggleBar
|
|
|
|
Menu, Tray, Add, Help, Main_help
|
|
|
|
Menu, Tray, Add,
|
|
|
|
Menu, Tray, Add, Exit, Main_quit
|
|
|
|
|
2012-09-30 19:16:31 +00:00
|
|
|
ResourceMonitor_init()
|
2012-09-27 20:32:27 +00:00
|
|
|
Manager_init()
|
2012-09-29 18:30:48 +00:00
|
|
|
Return ;; end of the auto-execute section
|
2011-07-27 17:43:34 +00:00
|
|
|
|
2012-09-29 18:30:48 +00:00
|
|
|
;; Function & label definitions
|
|
|
|
Main_cleanup:
|
2012-09-28 15:46:17 +00:00
|
|
|
Debug_logMessage("Cleaning up", 0)
|
2012-09-27 20:32:27 +00:00
|
|
|
If Config_autoSaveSession
|
|
|
|
Config_saveSession()
|
|
|
|
Manager_cleanup()
|
2012-09-30 19:16:31 +00:00
|
|
|
ResourceMonitor_cleanup()
|
2012-09-28 15:46:17 +00:00
|
|
|
Debug_logMessage("Exiting bug.n", 0)
|
2011-07-27 17:43:34 +00:00
|
|
|
ExitApp
|
2012-10-01 18:06:48 +00:00
|
|
|
|
|
|
|
Main_evalCommand(command)
|
|
|
|
{
|
|
|
|
type := SubStr(command, 1, 5)
|
|
|
|
If (type = "Run, ")
|
|
|
|
{
|
|
|
|
parameters := SubStr(command, 6)
|
|
|
|
If InStr(parameters, ", ")
|
|
|
|
{
|
|
|
|
StringSplit, parameter, parameters, `,
|
|
|
|
If (parameter0 = 2)
|
|
|
|
{
|
|
|
|
StringTrimLeft, parameter2, parameter2, 1
|
|
|
|
Run, %parameter1%, %parameter2%
|
|
|
|
}
|
|
|
|
Else If (parameter0 > 2)
|
|
|
|
{
|
|
|
|
StringTrimLeft, parameter2, parameter2, 1
|
|
|
|
StringTrimLeft, parameter3, parameter3, 1
|
|
|
|
Run, %parameter1%, %parameter2%, %parameter3%
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Else
|
|
|
|
Run, %parameters%
|
|
|
|
}
|
|
|
|
Else If (type = "Send ")
|
|
|
|
Send % SubStr(command, 6)
|
|
|
|
Else If (command = "Reload")
|
|
|
|
Reload
|
|
|
|
Else If (command = "ExitApp")
|
|
|
|
ExitApp
|
|
|
|
Else
|
|
|
|
{
|
|
|
|
i := InStr(command, "(")
|
|
|
|
j := InStr(command, ")", False, i)
|
|
|
|
If i And j
|
|
|
|
{
|
|
|
|
functionName := SubStr(command, 1, i - 1)
|
|
|
|
functionArguments := SubStr(command, i + 1, j - (i + 1))
|
|
|
|
StringSplit, functionArgument, functionArguments, `,
|
|
|
|
If (functionArgument0 < 2)
|
|
|
|
%functionName%(functionArguments)
|
|
|
|
Else If (functionArgument0 = 2)
|
|
|
|
{
|
|
|
|
StringTrimLeft, functionArgument2, functionArgument2, 1
|
|
|
|
%functionName%(functionArgument1, functionArgument2)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-07-27 17:43:34 +00:00
|
|
|
|
|
|
|
Main_help:
|
2012-09-27 20:32:27 +00:00
|
|
|
Run, explore %A_ScriptDir%\docs
|
2011-07-27 17:43:34 +00:00
|
|
|
Return
|
|
|
|
|
|
|
|
Main_quit:
|
2012-09-27 20:32:27 +00:00
|
|
|
ExitApp
|
2011-07-27 17:43:34 +00:00
|
|
|
Return
|
|
|
|
|
2012-09-29 18:30:48 +00:00
|
|
|
Main_reload()
|
|
|
|
{
|
|
|
|
Local i
|
|
|
|
|
|
|
|
Manager_resetWindowBorder()
|
2012-09-27 20:32:27 +00:00
|
|
|
|
|
|
|
DllCall("Shell32.dll\SHAppBarMessage", "UInt", (ABM_REMOVE := 0x1), "UInt", &Bar_appBarData)
|
2012-09-29 18:30:48 +00:00
|
|
|
;; SKAN: Crazy Scripting : Quick Launcher for Portable Apps (http://www.autohotkey.com/forum/topic22398.html)
|
2011-12-05 21:20:38 +00:00
|
|
|
|
2012-09-29 18:30:48 +00:00
|
|
|
Config_init()
|
|
|
|
Manager_setWindowBorder()
|
2012-09-27 20:32:27 +00:00
|
|
|
Bar_getHeight()
|
2012-09-29 18:30:48 +00:00
|
|
|
Loop, % Manager_monitorCount
|
|
|
|
{
|
2012-09-27 20:32:27 +00:00
|
|
|
Monitor_getWorkArea(A_Index)
|
|
|
|
Bar_init(A_Index)
|
|
|
|
}
|
|
|
|
Bar_initCmdGui()
|
|
|
|
If Not (Manager_showTaskBar = Config_showTaskBar)
|
|
|
|
Monitor_toggleTaskBar()
|
|
|
|
Bar_updateStatus()
|
|
|
|
Bar_updateTitle()
|
2012-09-29 18:30:48 +00:00
|
|
|
Loop, % Manager_monitorCount
|
|
|
|
{
|
2012-09-27 20:32:27 +00:00
|
|
|
i := A_Index
|
2012-09-29 18:30:48 +00:00
|
|
|
Loop, % Config_viewCount
|
|
|
|
{
|
2012-09-27 20:32:27 +00:00
|
|
|
Bar_updateView(i, A_Index)
|
2012-09-29 18:30:48 +00:00
|
|
|
}
|
2012-09-27 20:32:27 +00:00
|
|
|
View_arrange(i, Monitor_#%i%_aView_#1)
|
|
|
|
}
|
|
|
|
Manager_registerShellHook()
|
|
|
|
SetTimer, Bar_loop, %Config_readinInterval%
|
2011-12-05 21:20:38 +00:00
|
|
|
}
|
|
|
|
|
2011-07-27 17:43:34 +00:00
|
|
|
Main_toggleBar:
|
2012-09-27 20:32:27 +00:00
|
|
|
Monitor_toggleBar()
|
2011-07-27 17:43:34 +00:00
|
|
|
Return
|
|
|
|
|
|
|
|
#Include Bar.ahk
|
|
|
|
#Include Config.ahk
|
2012-09-28 15:46:17 +00:00
|
|
|
#Include Debug.ahk
|
2011-07-27 17:43:34 +00:00
|
|
|
#Include Manager.ahk
|
|
|
|
#Include Monitor.ahk
|
2012-09-30 17:50:12 +00:00
|
|
|
#Include ResourceMonitor.ahk
|
2011-07-27 17:43:34 +00:00
|
|
|
#Include View.ahk
|