updated version: 8.2.1.02

fix bug        #018431: Immediate run-time errors running bug.n built from source
workaround bug #018364: Evernote: new note
feature        #005446: Reload function
This commit is contained in:
joten 2011-12-05 22:20:38 +01:00
parent 0a193919bb
commit 01e5239b25
6 changed files with 125 additions and 39 deletions

View file

@ -15,7 +15,7 @@
* 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.2.1.01 (31.08.2011)
* @version 8.2.1.02 (05.12.2011)
*/
Bar_init(m) {
@ -23,7 +23,7 @@ Bar_init(m) {
If (SubStr(Config_barWidth, 0) = "%") {
StringTrimRight, wndWidth, Config_barWidth, 1
wndWidth := Monitor_#%m%_width * wndWidth / 100
wndWidth := Round(Monitor_#%m%_width * wndWidth / 100)
} Else
wndWidth := Config_barWidth
Monitor_#%m%_barWidth := wndWidth
@ -135,9 +135,9 @@ Bar_init(m) {
y1 := Monitor_#%m%_barY
If Monitor_#%m%_showBar
Gui, Show, +NoActivate x%x1% y%y1% w%wndWidth% h%Bar_height%, %wndTitle%
Gui, Show, NoActivate x%x1% y%y1% w%wndWidth% h%Bar_height%, %wndTitle%
Else
Gui, Show, +NoActivate Hide x%x1% y%y1% w%wndWidth% h%Bar_height%, %wndTitle%
Gui, Show, NoActivate Hide x%x1% y%y1% w%wndWidth% h%Bar_height%, %wndTitle%
wndId := WinExist(wndTitle)
If (Config_verticalBarPos = "tray" And m = Manager_taskBarMonitor) {
trayWndId := WinExist("ahk_class Shell_TrayWnd")
@ -342,7 +342,7 @@ Bar_evaluateCommand() {
Else If (Bar_command_#1 = "activate prev")
Manager_activateMonitor(-1)
} Else If (Bar_command_#1 = "Reload")
Reload
Main_reload()
Else If (Bar_command_#1 = "Quit")
ExitApp

View file

@ -15,7 +15,7 @@
* 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.2.1.01 (14.09.2011)
* @version 8.2.1.02 (24.09.2011)
*/
Config_init() {
@ -29,6 +29,11 @@ Config_init() {
Config_singleRowBar := True ; If false, the bar will have to rows, one for the window title and one for all other GUI controls.
Config_spaciousBar := False ; If true, the height of the bar will be set to a value equal to the height of an edit control, else it will be set to the text height.
Config_fontName := "Lucida Console" ; A monospace font is preferable for bug.n to calculate the correct width of the bar and its elements (sub-windows).
Config_fontSize :=
Config_normBgColor :=
Config_normFgColor :=
Config_selBgColor :=
Config_selFgColor :=
Config_readinBat := False ; If true, the system battery status is read in and displayed in the status bar. This only makes sense, if you have a system battery (notebook).
Config_readinCpu := False ; If true, the current CPU load is read in and displayed in the status bar.
Config_readinDate := True ; If true, the current date is read in (format: "WW, DD. MMM. YYYY") and displayed in the status bar.
@ -44,19 +49,20 @@ Config_init() {
Config_selBorderColor := "" ; Border colour of the active window; format: 0x00BBGGRR (e. g. "0x006A240A", if = "", the system's window border colour is not changed).
; Config_borderWidth, Config_borderPadding and Config_selBorderColor are especially usefull, if you are not allowed to set the design in the system settings.
; window arrangement
Config_viewCount := 9 ; The total number of views. This has effects on the displayed groups in the bar, and should not be exceeded in the hotkeys below.
Config_layout_#1 := "[]=;tile" ; The layout symbol and arrange function (the first entry is set as the default layout, no layout function means floating behavior)
Config_layout_#2 := "[M];monocle"
Config_layout_#3 := "><>;"
Config_layoutCount := 3 ; Total number of layouts defined above.
Config_layoutAxis_#1 := 1 ; The layout axis: 1 = x, 2 = y; negative values mirror the layout, setting the master area to the right / bottom instead of left / top.
Config_layoutAxis_#2 := 2 ; The master axis: 1 = x (from left to right), 2 = y (from top to bottom), 3 = z (monocle).
Config_layoutAxis_#3 := 2 ; The stack axis: 1 = x (from left to right), 2 = y (from top to bottom), 3 = z (monocle).
Config_layoutMFactor := 0.6 ; The factor for the size of the master area, which is multiplied by the monitor size.
Config_mouseFollowsFocus := True ; If true, the mouse pointer is set over the focused window, if a window is activated by bug.n.
Config_shellMsgDelay := 350 ; The time bug.n waits after a shell message (a window is opened, closed or the focus has been changed); if there are any problems recognizing, when windows are opened or closed, try to increase this number.
Config_syncMonitorViews := 0 ; The number of monitors (2 or more), for which views should be activated, when using the accordant hotkey. If set to 1, the views are actiated for all monitors. If set to 0, views are activated independently (only on the active monitor).
Config_viewFollowsTagged := False ; If true and a window is tagged with a single tag, the view is correspondingly set to the tag.
Config_viewCount := 9 ; The total number of views. This has effects on the displayed groups in the bar, and should not be exceeded in the hotkeys below.
Config_layout_#1 := "[]=;tile" ; The layout symbol and arrange function (the first entry is set as the default layout, no layout function means floating behavior)
Config_layout_#2 := "[M];monocle"
Config_layout_#3 := "><>;"
Config_layoutCount := 3 ; Total number of layouts defined above.
Config_layoutAxis_#1 := 1 ; The layout axis: 1 = x, 2 = y; negative values mirror the layout, setting the master area to the right / bottom instead of left / top.
Config_layoutAxis_#2 := 2 ; The master axis: 1 = x (from left to right), 2 = y (from top to bottom), 3 = z (monocle).
Config_layoutAxis_#3 := 2 ; The stack axis: 1 = x (from left to right), 2 = y (from top to bottom), 3 = z (monocle).
Config_layoutMFactor := 0.6 ; The factor for the size of the master area, which is multiplied by the monitor size.
Config_mouseFollowsFocus := True ; If true, the mouse pointer is set over the focused window, if a window is activated by bug.n.
Config_onActiveHiddenWnds := "view" ; The action, which will be taken, if a window e. g. should be activated, but is not visible; "view": show the view accordng to the first tag of the window in question, "tag": add the window in question to the current visible view, "hide": hide the window again ignoring the activation.
Config_shellMsgDelay := 350 ; The time bug.n waits after a shell message (a window is opened, closed or the focus has been changed); if there are any problems recognizing, when windows are opened or closed, try to increase this number.
Config_syncMonitorViews := 0 ; The number of monitors (2 or more), for which views should be activated, when using the accordant hotkey. If set to 1, the views are actiated for all monitors. If set to 0, views are activated independently (only on the active monitor).
Config_viewFollowsTagged := False ; If true and a window is tagged with a single tag, the view is correspondingly set to the tag.
; Config_rule_#i := "<class (regular expression string)>;<title (regular expression string)>;<window style (hexadecimal number or blank)>;
; <is managed (1 = True or 0 = False)>;
@ -413,4 +419,7 @@ Config_saveSession() {
#y::Bar_toggleCommandGui() ; Open the command GUI for executing programmes or bug.n functions.
#^e::Run, edit %Config_filePath% ; Open the configuration file in the standard text editor.
#^s::Config_saveSession() ; Save the current state of monitors, views, layouts to the configuration file.
#^r::Main_reload() ; Reload bug.n (i. e. the configuration and its dependent settings) without deleting the window lists of bug.n and restoring windows.
; It does not reset internal configuration variables, the tray icon or menu, hotkeys (unless set explicitly in Config.ini), individual window settings like Config_showBorder (since windows might be hidden) or hiding the title bar, the monitor count or views.
; It does not reload functions. Changed rules are only applied to new windows.
#^q::ExitApp ; Quit bug.n, restore the default Windows UI and show all windows.

View file

@ -15,7 +15,7 @@
* 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.2.1.01 (14.09.2011)
* @version 8.2.1.02 (24.09.2011)
*/
NAME := "bug.n"
@ -65,6 +65,65 @@ Main_quit:
ExitApp
Return
Main_reload() {
Local i, ncm, ncmSize
; Reset border color, padding and witdh.
If Config_selBorderColor
DllCall("SetSysColors", "Int", 1, "Int*", 10, "UInt*", Manager_normBorderColor)
If (Config_borderWidth > 0) Or (Config_borderPadding >= 0 And A_OSVersion = WIN_VISTA) {
ncmSize := VarSetCapacity(ncm, 4 * (A_OSVersion = WIN_VISTA ? 11 : 10) + 5 * (28 + 32 * (A_IsUnicode ? 2 : 1)), 0)
NumPut(ncmSize, ncm, 0, "UInt")
DllCall("SystemParametersInfo", "UInt", 0x0029, "UInt", ncmSize, "UInt", &ncm, "UInt", 0)
If (Config_borderWidth > 0)
NumPut(Manager_borderWidth, ncm, 4, "Int")
If (Config_borderPadding >= 0 And A_OSVersion = WIN_VISTA)
NumPut(Manager_borderPadding, ncm, 40 + 5 * (28 + 32 * (A_IsUnicode ? 2 : 1)), "Int")
DllCall("SystemParametersInfo", "UInt", 0x002a, "UInt", ncmSize, "UInt", &ncm, "UInt", 0)
}
DllCall("Shell32.dll\SHAppBarMessage", "UInt", (ABM_REMOVE := 0x1), "UInt", &Bar_appBarData)
; SKAN: Crazy Scripting : Quick Launcher for Portable Apps (http://www.autohotkey.com/forum/topic22398.html)
Config_init()
; Windows UI
If Config_selBorderColor {
SetFormat, Integer, hex
Manager_normBorderColor := DllCall("GetSysColor", "Int", 10)
SetFormat, Integer, d
DllCall("SetSysColors", "Int", 1, "Int*", 10, "UInt*", Config_selBorderColor)
}
If (Config_borderWidth > 0) Or (Config_borderPadding >= 0 And A_OSVersion = WIN_VISTA) {
ncmSize := VarSetCapacity(ncm, 4 * (A_OSVersion = WIN_VISTA ? 11 : 10) + 5 * (28 + 32 * (A_IsUnicode ? 2 : 1)), 0)
NumPut(ncmSize, ncm, 0, "UInt")
DllCall("SystemParametersInfo", "UInt", 0x0029, "UInt", ncmSize, "UInt", &ncm, "UInt", 0)
Manager_borderWidth := NumGet(ncm, 4, "Int")
Manager_borderPadding := NumGet(ncm, 40 + 5 * (28 + 32 * (A_IsUnicode ? 2 : 1)), "Int")
If (Config_borderWidth > 0)
NumPut(Config_borderWidth, ncm, 4, "Int")
If (Config_borderPadding >= 0 And A_OSVersion = WIN_VISTA)
NumPut(Config_borderPadding, ncm, 40 + 5 * (28 + 32 * (A_IsUnicode ? 2 : 1)), "Int")
DllCall("SystemParametersInfo", "UInt", 0x002a, "UInt", ncmSize, "UInt", &ncm, "UInt", 0)
}
Bar_getHeight()
Loop, % Manager_monitorCount {
Monitor_getWorkArea(A_Index)
Bar_init(A_Index)
}
Bar_initCmdGui()
If Not (Manager_showTaskBar = Config_showTaskBar)
Monitor_toggleTaskBar()
Bar_updateStatus()
Bar_updateTitle()
Loop, % Manager_monitorCount {
i := A_Index
Loop, % Config_viewCount
Bar_updateView(i, A_Index)
View_arrange(i, Monitor_#%i%_aView_#1)
}
Manager_registerShellHook()
SetTimer, Bar_loop, %Config_readinInterval%
}
Main_toggleBar:
Monitor_toggleBar()
Return

View file

@ -15,7 +15,7 @@
* 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.2.1.01 (21.09.2011)
* @version 8.2.1.02 (24.09.2011)
*/
Manager_init() {
@ -332,7 +332,7 @@ Manager_moveWindow() {
}
Manager_onShellMessage(wParam, lParam) {
Local a, aWndClass, aWndHeight, aWndId, aWndTitle, aWndWidth, aWndX, aWndY, flag, m, tags, wndClass, wndId, wndPName, wndTitle, x, y
Local a, aWndClass, aWndHeight, aWndId, aWndTitle, aWndWidth, aWndX, aWndY, flag, m, t, wndClass, wndId, wndIds, wndPName, wndTitle, x, y
SetFormat, Integer, hex
lParam := lParam+0
@ -353,7 +353,7 @@ Manager_onShellMessage(wParam, lParam) {
}
If (wParam = 1 Or wParam = 2 Or wParam = 4 Or wParam = 6 Or wParam = 32772) And lParam And Not Manager_hideShow And Not Manager_focus {
If Not (wParam = 4 Or wParam = 32772) {
If Not (wParam = 4 Or wParam = 32772)
If Not wndClass And Not (wParam = 2) {
WinGetClass, wndClass, ahk_id %lParam%
If wndClass {
@ -362,14 +362,13 @@ Manager_onShellMessage(wParam, lParam) {
} Else
Sleep, %Config_shellMsgDelay%
}
}
If (wParam = 1 Or wParam = 6) And Not InStr(Manager_allWndIds, lParam ";") And Not InStr(Manager_managedWndIds, lParam ";")
a := Manager_manage(lParam)
Else {
flag := True
a := Manager_sync(tags)
If tags
a := Manager_sync(wndIds)
If wndIds
a := False
}
If a {
@ -385,12 +384,33 @@ Manager_onShellMessage(wParam, lParam) {
Manager_aMonitor := m
}
If tags
Loop, % Config_viewCount
If (tags & 1 << A_Index - 1) {
Monitor_activateView(A_Index)
Break
If wndIds {
If (Config_onActiveHiddenWnds = "view") {
wndId := SubStr(wndIds, 1, InStr(wndIds, ";") - 1)
Loop, % Config_viewCount
If (Manager_#%wndId%_tags & 1 << A_Index - 1) {
Monitor_activateView(A_Index)
Break
}
} Else {
StringTrimRight, wndIds, wndIds, 1
StringSplit, wndId, wndIds, `;
If (Config_onActiveHiddenWnds = "hide") {
Loop, % wndId0
WinHide, % "ahk_id " wndId%A_Index%
} Else If (Config_onActiveHiddenWnds = "tag") {
t := Monitor_#%Manager_aMonitor%_aView_#1
Loop, % wndId0 {
wndId := wndId%A_Index%
View_#%Manager_aMonitor%_#%t%_wndIds := wndId ";" View_#%Manager_aMonitor%_#%t%_wndIds
View_#%Manager_aMonitor%_#%t%_aWndId := wndId
Manager_#%wndId%_tags += 1 << t - 1
}
Bar_updateView(Manager_aMonitor, t)
View_arrange(Manager_aMonitor, t)
}
}
}
Bar_updateTitle()
}
@ -478,8 +498,8 @@ Manager_sizeWindow() {
SendMessage, WM_SYSCOMMAND, SC_SIZE, , , ahk_id %aWndId%
}
Manager_sync(ByRef tags = 0) {
Local a, aWndId, flag, shownWndIds, v, visibleWndIds, wndId
Manager_sync(ByRef wndIds = "") {
Local a, flag, shownWndIds, v, visibleWndIds, wndId
Loop, % Manager_monitorCount {
v := Monitor_#%A_Index%_aView_#1
@ -493,10 +513,8 @@ Manager_sync(ByRef tags = 0) {
flag := Manager_manage(wndId%A_Index%)
If flag
a := flag
} Else {
aWndId := wndId%A_Index%
tags := Manager_#%aWndId%_tags
}
} Else
wndIds .= wndId%A_Index% ";"
}
visibleWndIds := visibleWndIds wndId%A_Index% ";"
}

View file

@ -15,7 +15,7 @@
* 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.2.1.01 (18.09.2011)
* @version 8.2.1.02 (18.09.2011)
*/
Monitor_init(m) {

View file

@ -15,7 +15,7 @@
* 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.2.1.01 (11.08.2011)
* @version 8.2.1.02 (11.08.2011)
*/
View_init(m, v) {