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 * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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) { Bar_init(m) {
@ -23,7 +23,7 @@ Bar_init(m) {
If (SubStr(Config_barWidth, 0) = "%") { If (SubStr(Config_barWidth, 0) = "%") {
StringTrimRight, wndWidth, Config_barWidth, 1 StringTrimRight, wndWidth, Config_barWidth, 1
wndWidth := Monitor_#%m%_width * wndWidth / 100 wndWidth := Round(Monitor_#%m%_width * wndWidth / 100)
} Else } Else
wndWidth := Config_barWidth wndWidth := Config_barWidth
Monitor_#%m%_barWidth := wndWidth Monitor_#%m%_barWidth := wndWidth
@ -135,9 +135,9 @@ Bar_init(m) {
y1 := Monitor_#%m%_barY y1 := Monitor_#%m%_barY
If Monitor_#%m%_showBar 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 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) wndId := WinExist(wndTitle)
If (Config_verticalBarPos = "tray" And m = Manager_taskBarMonitor) { If (Config_verticalBarPos = "tray" And m = Manager_taskBarMonitor) {
trayWndId := WinExist("ahk_class Shell_TrayWnd") trayWndId := WinExist("ahk_class Shell_TrayWnd")
@ -342,7 +342,7 @@ Bar_evaluateCommand() {
Else If (Bar_command_#1 = "activate prev") Else If (Bar_command_#1 = "activate prev")
Manager_activateMonitor(-1) Manager_activateMonitor(-1)
} Else If (Bar_command_#1 = "Reload") } Else If (Bar_command_#1 = "Reload")
Reload Main_reload()
Else If (Bar_command_#1 = "Quit") Else If (Bar_command_#1 = "Quit")
ExitApp ExitApp

View file

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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() { 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_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_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_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_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_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. 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_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. ; 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 ; 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_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_#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_#2 := "[M];monocle"
Config_layout_#3 := "><>;" Config_layout_#3 := "><>;"
Config_layoutCount := 3 ; Total number of layouts defined above. 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_#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_#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_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_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_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_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_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_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_viewFollowsTagged := False ; If true and a window is tagged with a single tag, the view is correspondingly set to the tag. 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)>; ; Config_rule_#i := "<class (regular expression string)>;<title (regular expression string)>;<window style (hexadecimal number or blank)>;
; <is managed (1 = True or 0 = False)>; ; <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. #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. #^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. #^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. #^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 * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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" NAME := "bug.n"
@ -65,6 +65,65 @@ Main_quit:
ExitApp ExitApp
Return 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: Main_toggleBar:
Monitor_toggleBar() Monitor_toggleBar()
Return Return

View file

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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() { Manager_init() {
@ -332,7 +332,7 @@ Manager_moveWindow() {
} }
Manager_onShellMessage(wParam, lParam) { 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 SetFormat, Integer, hex
lParam := lParam+0 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 (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) { If Not wndClass And Not (wParam = 2) {
WinGetClass, wndClass, ahk_id %lParam% WinGetClass, wndClass, ahk_id %lParam%
If wndClass { If wndClass {
@ -362,14 +362,13 @@ Manager_onShellMessage(wParam, lParam) {
} Else } Else
Sleep, %Config_shellMsgDelay% Sleep, %Config_shellMsgDelay%
} }
}
If (wParam = 1 Or wParam = 6) And Not InStr(Manager_allWndIds, lParam ";") And Not InStr(Manager_managedWndIds, lParam ";") If (wParam = 1 Or wParam = 6) And Not InStr(Manager_allWndIds, lParam ";") And Not InStr(Manager_managedWndIds, lParam ";")
a := Manager_manage(lParam) a := Manager_manage(lParam)
Else { Else {
flag := True flag := True
a := Manager_sync(tags) a := Manager_sync(wndIds)
If tags If wndIds
a := False a := False
} }
If a { If a {
@ -385,12 +384,33 @@ Manager_onShellMessage(wParam, lParam) {
Manager_aMonitor := m Manager_aMonitor := m
} }
If tags If wndIds {
Loop, % Config_viewCount If (Config_onActiveHiddenWnds = "view") {
If (tags & 1 << A_Index - 1) { wndId := SubStr(wndIds, 1, InStr(wndIds, ";") - 1)
Monitor_activateView(A_Index) Loop, % Config_viewCount
Break 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() Bar_updateTitle()
} }
@ -478,8 +498,8 @@ Manager_sizeWindow() {
SendMessage, WM_SYSCOMMAND, SC_SIZE, , , ahk_id %aWndId% SendMessage, WM_SYSCOMMAND, SC_SIZE, , , ahk_id %aWndId%
} }
Manager_sync(ByRef tags = 0) { Manager_sync(ByRef wndIds = "") {
Local a, aWndId, flag, shownWndIds, v, visibleWndIds, wndId Local a, flag, shownWndIds, v, visibleWndIds, wndId
Loop, % Manager_monitorCount { Loop, % Manager_monitorCount {
v := Monitor_#%A_Index%_aView_#1 v := Monitor_#%A_Index%_aView_#1
@ -493,10 +513,8 @@ Manager_sync(ByRef tags = 0) {
flag := Manager_manage(wndId%A_Index%) flag := Manager_manage(wndId%A_Index%)
If flag If flag
a := flag a := flag
} Else { } Else
aWndId := wndId%A_Index% wndIds .= wndId%A_Index% ";"
tags := Manager_#%aWndId%_tags
}
} }
visibleWndIds := visibleWndIds 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 * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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) { Monitor_init(m) {

View file

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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) { View_init(m, v) {