2022-02-15 21:38:14 +00:00
|
|
|
|
/*
|
2016-03-09 18:34:57 +00:00
|
|
|
|
bug.n -- tiling window management
|
2019-04-07 19:11:56 +00:00
|
|
|
|
Copyright (c) 2010-2019 Joshua Fuhs, joten
|
2016-03-09 18:34:57 +00:00
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
@license GNU General Public License version 3
|
|
|
|
|
../LICENSE.md or <http://www.gnu.org/licenses/>
|
|
|
|
|
|
2019-04-07 19:28:37 +00:00
|
|
|
|
@version 9.1.0
|
2012-09-27 20:32:27 +00:00
|
|
|
|
*/
|
2011-07-27 17:43:34 +00:00
|
|
|
|
|
2015-01-30 19:13:10 +00:00
|
|
|
|
Bar_init(m) {
|
2015-01-30 22:38:40 +00:00
|
|
|
|
Local appBarMsg, anyText, color, color0, GuiN, h1, h2, i, id, id0, text, text0, titleWidth, trayWndId, w, wndId, wndTitle, wndWidth, x1, x2, y1, y2
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2015-01-30 19:13:10 +00:00
|
|
|
|
If (SubStr(Config_barWidth, 0) = "%") {
|
2012-09-27 20:32:27 +00:00
|
|
|
|
StringTrimRight, wndWidth, Config_barWidth, 1
|
|
|
|
|
wndWidth := Round(Monitor_#%m%_width * wndWidth / 100)
|
2015-01-30 19:13:10 +00:00
|
|
|
|
} Else
|
2012-09-27 20:32:27 +00:00
|
|
|
|
wndWidth := Config_barWidth
|
2014-12-13 15:12:38 +00:00
|
|
|
|
|
2019-03-25 14:04:26 +00:00
|
|
|
|
wndWidth := Round(wndWidth / mmngr1.monitors[m].scaleX)
|
2015-01-31 00:45:36 +00:00
|
|
|
|
If (Config_verticalBarPos = "tray" And Monitor_#%m%_taskBarClass) {
|
2019-03-25 14:04:26 +00:00
|
|
|
|
Bar_ctrlHeight := Round(Bar_ctrlHeight / mmngr1.monitors[m].scaleY)
|
|
|
|
|
Bar_height := Round(Bar_height / mmngr1.monitors[m].scaleY)
|
2014-12-13 15:12:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Monitor_#%m%_barWidth := wndWidth
|
|
|
|
|
titleWidth := wndWidth
|
|
|
|
|
h1 := Bar_ctrlHeight
|
2022-09-24 04:07:07 +00:00
|
|
|
|
x1 := Config_barItemSpacing
|
2012-09-27 20:32:27 +00:00
|
|
|
|
x2 := wndWidth
|
|
|
|
|
y1 := 0
|
|
|
|
|
y2 := (Bar_ctrlHeight - Bar_textHeight) / 2
|
2015-01-30 19:13:10 +00:00
|
|
|
|
h2 := Bar_textHeight
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-10-02 10:11:00 +00:00
|
|
|
|
;; Create the GUI window
|
2012-09-27 20:32:27 +00:00
|
|
|
|
wndTitle := "bug.n_BAR_" m
|
|
|
|
|
GuiN := (m - 1) + 1
|
2012-09-28 15:46:17 +00:00
|
|
|
|
Debug_logMessage("DEBUG[6] Bar_init(): Gui, " . GuiN . ": Default", 6)
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Gui, %GuiN%: Default
|
2012-10-01 19:20:45 +00:00
|
|
|
|
Gui, Destroy
|
2022-02-15 21:38:14 +00:00
|
|
|
|
Gui, -Caption +LabelBar_Gui +LastFound +ToolWindow
|
2015-01-30 19:13:10 +00:00
|
|
|
|
Gui, Color, %Config_backColor_#1_#3%
|
|
|
|
|
Gui, Font, c%Config_fontColor_#1_#3% s%Config_fontSize%, %Config_fontName%
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2015-01-30 19:13:10 +00:00
|
|
|
|
;; Views
|
|
|
|
|
Loop, % Config_viewCount {
|
2022-09-24 04:07:07 +00:00
|
|
|
|
w := Bar_getTextWidth(Config_viewNames_#%A_Index%)
|
|
|
|
|
Bar_addElement(m, "view_#" A_Index, " " Config_viewNames_#%A_Index%, x1, y1, w, Config_backColor_#1_#1, Config_foreColor_#1_#1, Config_fontColor_#1_#1)
|
2012-09-27 20:32:27 +00:00
|
|
|
|
titleWidth -= w
|
2022-09-24 04:07:07 +00:00
|
|
|
|
x1 += w + Config_barItemSpacing
|
2012-09-27 20:32:27 +00:00
|
|
|
|
}
|
2012-10-02 10:11:00 +00:00
|
|
|
|
;; Layout
|
2022-09-24 04:07:07 +00:00
|
|
|
|
w := Bar_getTextWidth("??????")
|
|
|
|
|
Bar_addElement(m, "layout", "??????", x1, y1, w, Config_backColor_#1_#2, Config_foreColor_#1_#2, Config_fontColor_#1_#2)
|
2012-09-27 20:32:27 +00:00
|
|
|
|
titleWidth -= w
|
2022-09-24 04:07:07 +00:00
|
|
|
|
x1 += w + Config_barItemSpacing
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-10-02 10:11:00 +00:00
|
|
|
|
;; The x-position and width of the sub-windows right of the window title are set from the right.
|
2022-02-15 21:38:14 +00:00
|
|
|
|
;; <view>;<layout>;<title>;<shebang>;<time>;<date>;<anyText>;<battery>;<volumeLevel>
|
|
|
|
|
;color := "4"
|
|
|
|
|
;id := "shebang"
|
|
|
|
|
;text := " #! "
|
|
|
|
|
color := ""
|
|
|
|
|
id := ""
|
|
|
|
|
text := ""
|
2015-01-30 22:38:40 +00:00
|
|
|
|
If Config_readinTime {
|
2022-02-15 21:38:14 +00:00
|
|
|
|
color .= "4"
|
|
|
|
|
id .= "time"
|
|
|
|
|
text .= "" . Config_readinTimeFormat
|
2015-01-30 22:38:40 +00:00
|
|
|
|
}
|
2022-02-15 21:38:14 +00:00
|
|
|
|
If (Config_readinDate And !Config_combineDateAndTime) {
|
|
|
|
|
color .= ";5"
|
2015-01-30 22:38:40 +00:00
|
|
|
|
id .= ";date"
|
2022-02-15 21:38:14 +00:00
|
|
|
|
text .= ";" . Config_readinDateFormat
|
2015-01-30 22:38:40 +00:00
|
|
|
|
}
|
|
|
|
|
If Config_readinVolume {
|
|
|
|
|
color .= ";9"
|
|
|
|
|
id .= ";volume"
|
2022-09-24 04:07:07 +00:00
|
|
|
|
text .= ";???%"
|
2015-01-30 22:38:40 +00:00
|
|
|
|
}
|
2022-02-15 21:38:14 +00:00
|
|
|
|
If Config_readinRam {
|
|
|
|
|
color .= ";6"
|
|
|
|
|
id .= ";ram"
|
|
|
|
|
text .= ";" . ResourceMonitor_getRamText()
|
|
|
|
|
}
|
|
|
|
|
If Config_readinCpu {
|
2015-01-30 22:38:40 +00:00
|
|
|
|
color .= ";7"
|
2022-02-15 21:38:14 +00:00
|
|
|
|
id .= ";cpu"
|
|
|
|
|
text .= ";" . ResourceMonitor_getCpuText()
|
2015-01-30 22:38:40 +00:00
|
|
|
|
}
|
|
|
|
|
If Config_readinBat {
|
|
|
|
|
color .= ";8"
|
2022-02-15 21:38:14 +00:00
|
|
|
|
id .= ";battery"
|
2022-09-24 04:07:07 +00:00
|
|
|
|
text .= ";???%"
|
2022-02-15 21:38:14 +00:00
|
|
|
|
}
|
|
|
|
|
If Config_readinMusic {
|
|
|
|
|
color .= ";10"
|
|
|
|
|
id .= ";music"
|
|
|
|
|
text .= ";" . MusicBee_GetNowPlaying()
|
2015-01-30 22:38:40 +00:00
|
|
|
|
}
|
|
|
|
|
StringSplit, color, color, `;
|
|
|
|
|
StringSplit, id, id, `;
|
|
|
|
|
StringSplit, text, text, `;
|
|
|
|
|
Loop, % id0 {
|
2022-02-15 21:38:14 +00:00
|
|
|
|
elemId := id%A_Index%
|
|
|
|
|
If (elemId = "shebang")
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Gui, -Disabled
|
2015-01-30 22:38:40 +00:00
|
|
|
|
w := Bar_getTextWidth(text%A_Index%)
|
|
|
|
|
x2 -= w
|
|
|
|
|
titleWidth -= w
|
|
|
|
|
i := color%A_Index%
|
2022-02-15 21:38:14 +00:00
|
|
|
|
iconIndex := i - 3
|
|
|
|
|
icon := Config_barIcon_#%iconIndex%
|
|
|
|
|
iconId := % elemId "_icon"
|
|
|
|
|
Bar_addElement(m, elemId, text%A_Index%, x2, y1, wndWidth, Config_backColor_#1_#%i%, Config_foreColor_#1_#%i%, Config_fontColor_#1_#%i%)
|
|
|
|
|
Bar_addElement(m, iconId, icon, x2, y1, wndWidth, Config_backColor_#1_#%i%, Config_foreColor_#1_#%i%, Config_fontColor_#1_#%i%, Config_iconFontSize, Config_iconFontName)
|
2023-03-02 03:55:50 +00:00
|
|
|
|
If (Config_verticalBarPos = "tray" And Monitor_#%m%_taskBarClass) {
|
|
|
|
|
trayWndId := WinExist("ahk_class " Monitor_#%m%_taskBarClass)
|
|
|
|
|
ControlGet, TrayRoot, Hwnd, , TrayNotifyWnd1, ahk_id %trayWndId%
|
|
|
|
|
|
|
|
|
|
DllCall("SetParent", "UInt", HwndBar_#%m%_%elemId%_hwnd, "UInt", TrayRoot)
|
|
|
|
|
DllCall("SetParent", "UInt", HwndBar_#%m%_%iconId%_hwnd, "UInt", TrayRoot)
|
|
|
|
|
}
|
2022-02-15 21:38:14 +00:00
|
|
|
|
GuiControl, -Center, Bar_#%m%_%elemId%
|
2023-03-02 03:55:50 +00:00
|
|
|
|
GuiControl, -Center, Bar_#%m%_%iconId%
|
2012-09-27 20:32:27 +00:00
|
|
|
|
}
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-10-02 10:11:00 +00:00
|
|
|
|
;; Window title (remaining space)
|
2015-01-30 19:13:10 +00:00
|
|
|
|
If Not Config_singleRowBar {
|
2012-09-27 20:32:27 +00:00
|
|
|
|
titleWidth := wndWidth
|
|
|
|
|
x1 := 0
|
|
|
|
|
y1 += h1
|
|
|
|
|
y2 += h1
|
|
|
|
|
}
|
2023-03-02 03:55:50 +00:00
|
|
|
|
If Config_readinTitle
|
|
|
|
|
Bar_addElement(m, "title", "", x1, y1, titleWidth, Config_backColor_#1_#3, Config_foreColor_#1_#3, Config_fontColor_#1_#3)
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
If (Config_horizontalBarPos = "left")
|
|
|
|
|
x1 := 0
|
|
|
|
|
Else If (Config_horizontalBarPos = "right")
|
2019-03-25 14:04:26 +00:00
|
|
|
|
x1 := Monitor_#%m%_width - wndWidth * mmngr1.monitors[m].scaleX
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Else If (Config_horizontalBarPos = "center")
|
2019-03-25 14:04:26 +00:00
|
|
|
|
x1 := (Monitor_#%m%_width - wndWidth * mmngr1.monitors[m].scaleX) / 2
|
2014-12-13 15:12:38 +00:00
|
|
|
|
Else If (Config_horizontalBarPos >= 0)
|
2012-09-27 20:32:27 +00:00
|
|
|
|
x1 := Config_horizontalBarPos
|
|
|
|
|
Else If (Config_horizontalBarPos < 0)
|
2019-03-25 14:04:26 +00:00
|
|
|
|
x1 := Monitor_#%m%_width - wndWidth * mmngr1.monitors[m].scaleX + Config_horizontalBarPos
|
2015-01-31 00:45:36 +00:00
|
|
|
|
If Not (Config_verticalBarPos = "tray" And Monitor_#%m%_taskBarClass)
|
2012-09-27 20:32:27 +00:00
|
|
|
|
x1 += Monitor_#%m%_x
|
2014-12-13 15:12:38 +00:00
|
|
|
|
x1 := Round(x1)
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Bar_#%m%_titleWidth := titleWidth
|
|
|
|
|
Monitor_#%m%_barX := x1
|
|
|
|
|
y1 := Monitor_#%m%_barY
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
If Monitor_#%m%_showBar
|
|
|
|
|
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%
|
2014-09-30 11:08:48 +00:00
|
|
|
|
WinSet, Transparent, %Config_barTransparency%, %wndTitle%
|
2012-09-27 20:32:27 +00:00
|
|
|
|
wndId := WinExist(wndTitle)
|
2016-02-12 17:58:58 +00:00
|
|
|
|
Bar_appBarData := ""
|
2015-01-31 00:45:36 +00:00
|
|
|
|
If (Config_verticalBarPos = "tray" And Monitor_#%m%_taskBarClass) {
|
|
|
|
|
trayWndId := WinExist("ahk_class " Monitor_#%m%_taskBarClass)
|
2023-03-02 03:55:50 +00:00
|
|
|
|
ControlGet, ToolbarRoot, Hwnd, , ReBarWindow321, ahk_id %trayWndId%
|
|
|
|
|
ControlGet, Toolbar, Hwnd, , ToolbarWindow321, ahk_id %ToolbarRoot%
|
|
|
|
|
DllCall("SetParent", "UInt", wndId, "UInt", Toolbar)
|
|
|
|
|
;Gui, Color, 000000, %wndTitle%
|
|
|
|
|
|
|
|
|
|
WinSet, Style, -0x40000, ahk_id %trayWndId% ; WS_THICKFRAME
|
|
|
|
|
WinSet, Style, +0x80, ahk_id %trayWndId% ; DS_MODALFRAME
|
|
|
|
|
WinSet, Style, +0x0004, ahk_id %trayWndId% ; DS_3DLOOK
|
|
|
|
|
|
|
|
|
|
WinSet, ExStyle, +0x1, ahk_id %trayWndId% ; WS_EX_DLGMODALFRAME
|
|
|
|
|
WinSet, ExStyle, +0x20000, ahk_id %trayWndId% ; WS_EX_STATICEDGE
|
2015-01-30 19:13:10 +00:00
|
|
|
|
} Else {
|
2012-09-27 20:32:27 +00:00
|
|
|
|
appBarMsg := DllCall("RegisterWindowMessage", Str, "AppBarMsg")
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-10-02 10:11:00 +00:00
|
|
|
|
;; appBarData: http://msdn2.microsoft.com/en-us/library/ms538008.aspx
|
2012-09-27 20:32:27 +00:00
|
|
|
|
VarSetCapacity(Bar_appBarData, 36, 0)
|
2012-12-15 19:56:18 +00:00
|
|
|
|
offset := NumPut( 36, Bar_appBarData)
|
|
|
|
|
offset := NumPut( wndId, offset+0)
|
|
|
|
|
offset := NumPut( appBarMsg, offset+0)
|
|
|
|
|
offset := NumPut( 1, offset+0)
|
|
|
|
|
offset := NumPut( x1, offset+0)
|
|
|
|
|
offset := NumPut( y1, offset+0)
|
|
|
|
|
offset := NumPut( x1 + wndWidth, offset+0)
|
|
|
|
|
offset := NumPut(y1 + Bar_height, offset+0)
|
|
|
|
|
offset := NumPut( 1, offset+0)
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
DllCall("Shell32.dll\SHAppBarMessage", "UInt", (ABM_NEW := 0x0) , "UInt", &Bar_appBarData)
|
|
|
|
|
DllCall("Shell32.dll\SHAppBarMessage", "UInt", (ABM_QUERYPOS := 0x2), "UInt", &Bar_appBarData)
|
|
|
|
|
DllCall("Shell32.dll\SHAppBarMessage", "UInt", (ABM_SETPOS := 0x3) , "UInt", &Bar_appBarData)
|
2012-10-02 10:11:00 +00:00
|
|
|
|
;; SKAN: Crazy Scripting : Quick Launcher for Portable Apps (http://www.autohotkey.com/forum/topic22398.html)
|
2012-09-27 20:32:27 +00:00
|
|
|
|
}
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
|
|
|
|
Bar_BinaryClockChars := ["⠀","⠈","⠐","⠘","⠠","⠨","⠰","⠸","⢀","⢈","⠁","⠉","⠑","⠙","⠡","⠩","⠱","⠹","⢁","⢉","⠂","⠊","⠒","⠚","⠢","⠪","⠲","⠺","⢂","⢊","⠃","⠋","⠓","⠛","⠣","⠫","⠳","⠻","⢃","⢋","⠄","⠌","⠔","⠜","⠤","⠬","⠴","⠼","⢄","⢌","⠅","⠍","⠕","⠝","⠥","⠭","⠵","⠽","⢅","⢍"]
|
|
|
|
|
Bar_TimeDateState := 0
|
2011-07-27 17:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-05 12:39:51 +00:00
|
|
|
|
Bar_initCmdGui()
|
2012-10-01 18:06:48 +00:00
|
|
|
|
{
|
2016-02-12 17:58:58 +00:00
|
|
|
|
Global Bar_#0_#0, Bar_#0_#0H, Bar_#0_#0W, Bar_#0_#1, Bar_cmdGuiIsVisible, Config_barCommands, Config_fontName, Config_fontSize
|
|
|
|
|
Global Config_backColor_#1_#3, Config_fontColor_#1_#3, Config_foreColor_#1_#3
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2016-02-12 17:58:58 +00:00
|
|
|
|
Bar_#0_#0 := ""
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Bar_cmdGuiIsVisible := False
|
|
|
|
|
wndTitle := "bug.n_BAR_0"
|
|
|
|
|
Gui, 99: Default
|
|
|
|
|
Gui, +LabelBar_cmdGui
|
|
|
|
|
IfWinExist, %wndTitle%
|
|
|
|
|
Gui, Destroy
|
2012-10-01 18:06:48 +00:00
|
|
|
|
Gui, +LastFound -Caption +ToolWindow +AlwaysOnTop +Delimiter`;
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Gui, Color, Default
|
|
|
|
|
Gui, Font, s%Config_fontSize%, %Config_fontName%
|
2012-10-01 18:06:48 +00:00
|
|
|
|
StringSplit, cmd, Config_barCommands, `;
|
2015-02-08 16:40:19 +00:00
|
|
|
|
Gui, Add, ComboBox, x10 y10 r%cmd0% w300 Background%Config_backColor_#1_#3% c%Config_fontColor_#1_#3% Simple vBar_#0_#0 gBar_cmdGuiEnter, % Config_barCommands
|
|
|
|
|
Gui, Add, Edit, Y0 w300 Hidden vBar_#0_#1 gBar_cmdGuiEnter
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Gui, Add, Button, Y0 Hidden Default gBar_cmdGuiEnter, OK
|
|
|
|
|
GuiControlGet, Bar_#0_#0, Pos
|
2015-02-08 16:40:19 +00:00
|
|
|
|
Bar_#0_#0H += 20
|
2012-10-01 18:06:48 +00:00
|
|
|
|
Bar_#0_#0W += 20
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Gui, Show, Hide w%Bar_#0_#0W% h%Bar_#0_#0H%, %wndTitle%
|
2011-07-27 17:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-15 21:38:14 +00:00
|
|
|
|
Bar_addElement(m, id, text, x, y1, width, backColor, foreColor, fontColor, fontSize="", fontName="") {
|
2015-01-30 19:13:10 +00:00
|
|
|
|
Local y2
|
|
|
|
|
|
2022-02-15 21:38:14 +00:00
|
|
|
|
if (fontSize == "") {
|
|
|
|
|
fontSize = %Config_fontSize%
|
|
|
|
|
}
|
|
|
|
|
if (fontName == "") {
|
|
|
|
|
fontName = %Config_fontName%
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-30 19:13:10 +00:00
|
|
|
|
y2 := y1 + (Bar_ctrlHeight - Bar_textHeight) / 2
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
2015-01-30 19:13:10 +00:00
|
|
|
|
Gui, Add, Text, x%x% y%y1% w%width% h%Bar_ctrlHeight% BackgroundTrans vBar_#%m%_%id%_event gBar_GuiClick,
|
2022-02-15 21:38:14 +00:00
|
|
|
|
;Gui, Add, Progress, x%x% y%y1% w%width% h%Bar_ctrlHeight% Background%backColor% c%foreColor% vBar_#%m%_%id%_highlighted
|
|
|
|
|
;GuiControl, , Bar_#%m%_%id%_highlighted, 100
|
|
|
|
|
Gui, Font, c%fontColor% s%fontSize%, %fontName%
|
|
|
|
|
Gui, Add, Text, x%x% y%y2% w%width% h%Bar_textHeight% BackgroundTrans Center vBar_#%m%_%id% HwndBar_#%m%_%id%_hwnd, %text%
|
2015-01-30 19:13:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-07-27 17:43:34 +00:00
|
|
|
|
Bar_cmdGuiEnter:
|
2015-01-25 21:26:17 +00:00
|
|
|
|
If (A_GuiControl = "OK") Or (A_GuiControl = "Bar_#0_#0" And A_GuiControlEvent = "DoubleClick") {
|
2012-10-01 18:06:48 +00:00
|
|
|
|
Gui, Submit, NoHide
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Bar_cmdGuiIsVisible := False
|
|
|
|
|
Gui, Cancel
|
|
|
|
|
WinActivate, ahk_id %Bar_aWndId%
|
2016-03-09 18:23:53 +00:00
|
|
|
|
Main_evalCommand(Bar_#0_#0)
|
2012-10-01 18:06:48 +00:00
|
|
|
|
Bar_#0_#0 := ""
|
2015-02-08 16:40:19 +00:00
|
|
|
|
} Else If (A_GuiControl = "Bar_#0_#1") {
|
|
|
|
|
Gui, Submit, NoHide
|
|
|
|
|
Debug_logMessage("DEBUG[6] Bar_cmdGuiEnter; command: " . Bar_#0_#1, 6)
|
2015-02-12 18:36:52 +00:00
|
|
|
|
Loop, Parse, Bar_#0_#1, `n, `r
|
2016-03-09 18:23:53 +00:00
|
|
|
|
Main_evalCommand(A_LoopField)
|
2012-09-27 20:32:27 +00:00
|
|
|
|
}
|
2011-07-27 17:43:34 +00:00
|
|
|
|
Return
|
|
|
|
|
|
2015-01-25 21:26:17 +00:00
|
|
|
|
Bar_cmdGuiEscape:
|
|
|
|
|
Bar_cmdGuiIsVisible := False
|
|
|
|
|
Gui, Cancel
|
|
|
|
|
WinActivate, ahk_id %Bar_aWndId%
|
|
|
|
|
Return
|
|
|
|
|
|
2012-12-05 12:39:51 +00:00
|
|
|
|
Bar_getHeight()
|
2012-10-02 10:11:00 +00:00
|
|
|
|
{
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Global Bar_#0_#1, Bar_#0_#1H, Bar_#0_#2, Bar_#0_#2H, Bar_ctrlHeight, Bar_height, Bar_textHeight
|
|
|
|
|
Global Config_fontName, Config_fontSize, Config_singleRowBar, Config_spaciousBar, Config_verticalBarPos
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
wndTitle := "bug.n_BAR_0"
|
|
|
|
|
Gui, 99: Default
|
|
|
|
|
Gui, Font, s%Config_fontSize%, %Config_fontName%
|
|
|
|
|
Gui, Add, Text, x0 y0 vBar_#0_#1, |
|
|
|
|
|
GuiControlGet, Bar_#0_#1, Pos
|
|
|
|
|
Bar_textHeight := Bar_#0_#1H
|
2012-12-05 12:39:51 +00:00
|
|
|
|
If Config_spaciousBar
|
2012-10-02 10:11:00 +00:00
|
|
|
|
{
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Gui, Add, ComboBox, r9 x0 y0 vBar_#0_#2, |
|
|
|
|
|
GuiControlGet, Bar_#0_#2, Pos
|
|
|
|
|
Bar_ctrlHeight := Bar_#0_#2H
|
2012-12-05 12:39:51 +00:00
|
|
|
|
}
|
2012-10-02 10:11:00 +00:00
|
|
|
|
Else
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Bar_ctrlHeight := Bar_textHeight
|
|
|
|
|
Gui, Destroy
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Bar_height := Bar_ctrlHeight
|
|
|
|
|
If Not Config_singleRowBar
|
|
|
|
|
Bar_height *= 2
|
2012-12-05 12:39:51 +00:00
|
|
|
|
If (Config_verticalBarPos = "tray")
|
2012-10-02 10:11:00 +00:00
|
|
|
|
{
|
2012-09-27 20:32:27 +00:00
|
|
|
|
WinGetPos, , , , buttonH, Start ahk_class Button
|
|
|
|
|
WinGetPos, , , , barH, ahk_class Shell_TrayWnd
|
2013-01-17 20:21:28 +00:00
|
|
|
|
If WinExist("Start ahk_class Button") And (buttonH < barH)
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Bar_height := buttonH
|
|
|
|
|
Else
|
|
|
|
|
Bar_height := barH
|
|
|
|
|
Bar_ctrlHeight := Bar_height
|
|
|
|
|
If Not Config_singleRowBar
|
|
|
|
|
Bar_ctrlHeight := Bar_height / 2
|
2023-03-02 03:55:50 +00:00
|
|
|
|
|
|
|
|
|
Bar_height := 22
|
|
|
|
|
Bar_ctrlHeight := 22
|
2012-09-27 20:32:27 +00:00
|
|
|
|
}
|
2011-07-27 17:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-05 12:39:51 +00:00
|
|
|
|
Bar_getTextWidth(x, reverse=False)
|
2012-10-02 10:11:00 +00:00
|
|
|
|
{
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Global Config_fontSize
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
|
|
|
|
If reverse
|
2012-10-02 10:11:00 +00:00
|
|
|
|
{ ;; 'reverse' calculates the number of characters to a given width.
|
2012-09-27 20:32:27 +00:00
|
|
|
|
w := x
|
|
|
|
|
i := w / (Config_fontSize - 1)
|
|
|
|
|
If (Config_fontSize = 7 Or (Config_fontSize > 8 And Config_fontSize < 13))
|
|
|
|
|
i := w / (Config_fontSize - 2)
|
|
|
|
|
Else If (Config_fontSize > 12 And Config_fontSize < 18)
|
|
|
|
|
i := w / (Config_fontSize - 3)
|
|
|
|
|
Else If (Config_fontSize > 17)
|
|
|
|
|
i := w / (Config_fontSize - 4)
|
|
|
|
|
textWidth := i
|
2012-12-05 12:39:51 +00:00
|
|
|
|
}
|
|
|
|
|
Else
|
2012-10-02 10:11:00 +00:00
|
|
|
|
{ ;; 'else' calculates the width to a given string.
|
2012-09-27 20:32:27 +00:00
|
|
|
|
textWidth := StrLen(x) * (Config_fontSize - 1)
|
|
|
|
|
If (Config_fontSize = 7 Or (Config_fontSize > 8 And Config_fontSize < 13))
|
|
|
|
|
textWidth := StrLen(x) * (Config_fontSize - 2)
|
|
|
|
|
Else If (Config_fontSize > 12 And Config_fontSize < 18)
|
|
|
|
|
textWidth := StrLen(x) * (Config_fontSize - 3)
|
|
|
|
|
Else If (Config_fontSize > 17)
|
|
|
|
|
textWidth := StrLen(x) * (Config_fontSize - 4)
|
|
|
|
|
}
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Return, textWidth
|
2011-07-27 17:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-15 21:38:14 +00:00
|
|
|
|
Bar_getTrueTextWidth(controlHwnd, newText) {
|
|
|
|
|
dc := DllCall("GetDC", "Ptr", controlHwnd)
|
|
|
|
|
|
|
|
|
|
; 0x31 = WM_GETFONT
|
|
|
|
|
SendMessage 0x31,,,, ahk_id %controlHwnd%
|
|
|
|
|
hFont := ErrorLevel
|
|
|
|
|
oldFont := 0
|
|
|
|
|
if (hFont != "FAIL")
|
|
|
|
|
oldFont := DllCall("SelectObject", "Ptr", dc, "Ptr", hFont)
|
|
|
|
|
|
|
|
|
|
VarSetCapacity(rect, 16, 0)
|
|
|
|
|
; 0x440 = DT_CALCRECT | DT_EXPANDTABS
|
|
|
|
|
h := DllCall("DrawText", "Ptr", dc, "Ptr", &newText, "Int", -1, "Ptr", &rect, "UInt", 0x440)
|
|
|
|
|
; width = rect.right - rect.left
|
|
|
|
|
w := NumGet(rect, 8, "Int") - NumGet(rect, 0, "Int")
|
|
|
|
|
|
|
|
|
|
if oldFont
|
|
|
|
|
DllCall("SelectObject", "Ptr", dc, "Ptr", oldFont)
|
|
|
|
|
DllCall("ReleaseDC", "Ptr", controlHwnd, "Ptr", dc)
|
|
|
|
|
|
|
|
|
|
return w
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-02 17:46:07 +00:00
|
|
|
|
Bar_GuiClick:
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Manager_winActivate(Bar_aWndId)
|
2015-01-30 19:13:10 +00:00
|
|
|
|
If (A_GuiEvent = "Normal") {
|
2022-02-15 21:38:14 +00:00
|
|
|
|
;If (SubStr(A_GuiControl, -13) = "_shebang_event") {
|
|
|
|
|
; If Not Bar_cmdGuiIsVisible
|
|
|
|
|
; If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
|
|
|
|
|
; Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
|
|
|
|
|
; Bar_toggleCommandGui()
|
|
|
|
|
;} Else
|
|
|
|
|
If (SubStr(A_GuiControl, -10) = "_time_event") {
|
|
|
|
|
If (Config_combineDateAndTime) {
|
|
|
|
|
If (Bar_TimeDateState == 0) {
|
|
|
|
|
Bar_TimeDateState := 1
|
|
|
|
|
} Else {
|
|
|
|
|
Bar_TimeDateState := 0
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-01-30 19:13:10 +00:00
|
|
|
|
} Else {
|
2015-02-01 13:39:46 +00:00
|
|
|
|
If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
|
|
|
|
|
Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
|
2015-01-30 19:13:10 +00:00
|
|
|
|
If (SubStr(A_GuiControl, -12) = "_layout_event")
|
|
|
|
|
View_setLayout(-1)
|
|
|
|
|
Else If InStr(A_GuiControl, "_view_#") And (SubStr(A_GuiControl, -5) = "_event")
|
|
|
|
|
Monitor_activateView(SubStr(A_GuiControl, InStr(A_GuiControl, "_view_#", False, 0) + 7, 1))
|
|
|
|
|
}
|
2012-09-27 20:32:27 +00:00
|
|
|
|
}
|
2011-07-27 17:43:34 +00:00
|
|
|
|
Return
|
|
|
|
|
|
2011-09-02 17:46:07 +00:00
|
|
|
|
Bar_GuiContextMenu:
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Manager_winActivate(Bar_aWndId)
|
2015-01-30 19:13:10 +00:00
|
|
|
|
If (A_GuiEvent = "RightClick") {
|
|
|
|
|
If (SubStr(A_GuiControl, -12) = "_layout_event") {
|
2015-02-01 13:39:46 +00:00
|
|
|
|
If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
|
|
|
|
|
Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
|
2015-01-27 21:13:03 +00:00
|
|
|
|
View_setLayout(0, +1)
|
2015-01-30 19:13:10 +00:00
|
|
|
|
} Else If InStr(A_GuiControl, "_view_#") And (SubStr(A_GuiControl, -5) = "_event") {
|
2015-02-01 13:39:46 +00:00
|
|
|
|
If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
|
|
|
|
|
Manager_setWindowMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
|
2015-01-30 19:13:10 +00:00
|
|
|
|
Monitor_setWindowTag(SubStr(A_GuiControl, InStr(A_GuiControl, "_view_#", False, 0) + 7, 1))
|
2012-09-27 20:32:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2011-07-27 17:43:34 +00:00
|
|
|
|
Return
|
|
|
|
|
|
|
|
|
|
Bar_loop:
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Bar_updateStatus()
|
2011-07-27 17:43:34 +00:00
|
|
|
|
Return
|
|
|
|
|
|
2012-12-05 12:39:51 +00:00
|
|
|
|
Bar_move(m)
|
2012-10-02 10:11:00 +00:00
|
|
|
|
{
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Local wndTitle, x, y
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
x := Monitor_#%m%_barX
|
|
|
|
|
y := Monitor_#%m%_barY
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
wndTitle := "bug.n_BAR_" m
|
|
|
|
|
WinMove, %wndTitle%, , %x%, %y%
|
2011-07-27 17:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-01-04 19:58:51 +00:00
|
|
|
|
Bar_toggleCommandGui() {
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Local wndId, x, y
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Gui, 99: Default
|
2016-01-04 19:58:51 +00:00
|
|
|
|
If Bar_cmdGuiIsVisible {
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Bar_cmdGuiIsVisible := False
|
|
|
|
|
Gui, Cancel
|
|
|
|
|
Manager_winActivate(Bar_aWndId)
|
2016-01-04 19:58:51 +00:00
|
|
|
|
} Else {
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Bar_cmdGuiIsVisible := True
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
2016-01-04 19:58:51 +00:00
|
|
|
|
If (Config_verticalBarPos = "tray")
|
|
|
|
|
x := Monitor_#%Manager_aMonitor%_x + Monitor_#%Manager_aMonitor%_barX + Monitor_#%Manager_aMonitor%_barWidth - Bar_#0_#0W
|
|
|
|
|
Else
|
|
|
|
|
x := Monitor_#%Manager_aMonitor%_barX + Monitor_#%Manager_aMonitor%_barWidth - Bar_#0_#0W ;; x := mX + (mBarX - mX) + mBarW - w
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
2016-01-04 19:58:51 +00:00
|
|
|
|
If (Config_verticalBarPos = "top") Or (Config_verticalBarPos = "tray") And (Monitor_#%Manager_aMonitor%_taskBarPos = "top" Or Not Monitor_#%Manager_aMonitor%_taskBarClass)
|
2012-09-27 20:32:27 +00:00
|
|
|
|
y := Monitor_#%Manager_aMonitor%_y
|
|
|
|
|
Else
|
|
|
|
|
y := Monitor_#%Manager_aMonitor%_y + Monitor_#%Manager_aMonitor%_height - Bar_#0_#0H
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Gui, Show
|
2015-03-21 11:22:14 +00:00
|
|
|
|
WinGet, wndId, ID, bug.n_BAR_0
|
|
|
|
|
WinMove, ahk_id %wndId%, , %x%, %y%
|
|
|
|
|
Window_set(wndId, "AlwaysOnTop", "On")
|
2012-09-27 20:32:27 +00:00
|
|
|
|
GuiControl, Focus, % Bar_#0_#0
|
|
|
|
|
}
|
2011-07-27 17:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-05 12:39:51 +00:00
|
|
|
|
Bar_toggleVisibility(m)
|
2012-10-02 10:11:00 +00:00
|
|
|
|
{
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Local GuiN
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
GuiN := (m - 1) + 1
|
2012-12-05 12:39:51 +00:00
|
|
|
|
If Monitor_#%m%_showBar
|
2012-10-02 10:11:00 +00:00
|
|
|
|
{
|
2012-09-27 20:32:27 +00:00
|
|
|
|
If Not (GuiN = 99) Or Bar_cmdGuiIsVisible
|
|
|
|
|
Gui, %GuiN%: Show
|
2012-12-05 12:39:51 +00:00
|
|
|
|
}
|
2012-10-02 10:11:00 +00:00
|
|
|
|
Else
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Gui, %GuiN%: Cancel
|
2011-07-27 17:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-01-30 19:13:10 +00:00
|
|
|
|
Bar_updateLayout(m) {
|
|
|
|
|
Local aView, GuiN
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
aView := Monitor_#%m%_aView_#1
|
|
|
|
|
GuiN := (m - 1) + 1
|
2015-01-30 19:13:10 +00:00
|
|
|
|
GuiControl, %GuiN%: , Bar_#%m%_layout, % View_#%m%_#%aView%_layoutSymbol
|
2011-07-27 17:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-02-01 13:39:46 +00:00
|
|
|
|
Bar_updateStatic(m) {
|
|
|
|
|
Local GuiN
|
|
|
|
|
|
|
|
|
|
GuiN := (m - 1) + 1
|
|
|
|
|
GuiControl, %GuiN%: , Bar_#%m%_shebang, #!
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-30 19:13:10 +00:00
|
|
|
|
Bar_updateStatus() {
|
2022-02-15 21:38:14 +00:00
|
|
|
|
Local bat1, bat2, bat3, GuiN, m, mute, time, vol, hours, minutes, seconds, text, textWidth, statusWidth, iconWidth, iconY
|
|
|
|
|
|
|
|
|
|
iconY := (Bar_ctrlHeight - Bar_textHeight) / 2 - %Config_iconFontYOffset%
|
2015-03-01 20:08:22 +00:00
|
|
|
|
|
|
|
|
|
If Config_readinBat {
|
|
|
|
|
ResourceMonitor_getBatteryStatus(bat1, bat2)
|
2022-02-15 21:38:14 +00:00
|
|
|
|
bat3 := bat1
|
2015-03-01 20:08:22 +00:00
|
|
|
|
}
|
|
|
|
|
If Config_readinVolume {
|
|
|
|
|
SoundGet, vol, MASTER, VOLUME
|
|
|
|
|
SoundGet, mute, MASTER, MUTE
|
|
|
|
|
vol := Round(vol)
|
|
|
|
|
}
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2015-01-30 19:13:10 +00:00
|
|
|
|
Loop, % Manager_monitorCount {
|
2012-09-27 20:32:27 +00:00
|
|
|
|
m := A_Index
|
|
|
|
|
GuiN := (m - 1) + 1
|
2012-09-28 15:46:17 +00:00
|
|
|
|
Debug_logMessage("DEBUG[6] Bar_updateStatus(): Gui, " . GuiN . ": Default", 6)
|
2012-09-27 20:32:27 +00:00
|
|
|
|
Gui, %GuiN%: Default
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
|
|
|
|
statusWidth := Monitor_#%m%_barWidth
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barItemSpacing
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
|
|
|
|
If Config_readinTime {
|
|
|
|
|
If Config_readinTimeBinary {
|
|
|
|
|
FormatTime, hours,, H
|
|
|
|
|
FormatTime, minutes,, m
|
|
|
|
|
FormatTime, seconds,, s
|
|
|
|
|
If (Config_combineDateAndTime) {
|
|
|
|
|
If (Bar_TimeDateState == 0) {
|
|
|
|
|
time := % Bar_BinaryClockChars[hours + 1] " " Bar_BinaryClockChars[minutes + 1] " " Bar_BinaryClockChars[seconds + 1]
|
|
|
|
|
} Else {
|
|
|
|
|
FormatTime, time, , % Config_readinDateFormat
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
time := % Bar_BinaryClockChars[hours + 1] " " Bar_BinaryClockChars[minutes + 1] " " Bar_BinaryClockChars[seconds + 1]
|
|
|
|
|
}
|
2015-01-30 19:13:10 +00:00
|
|
|
|
} Else {
|
2022-02-15 21:38:14 +00:00
|
|
|
|
If (Config_combineDateAndTime) {
|
|
|
|
|
If (Bar_TimeDateState == 0) {
|
|
|
|
|
FormatTime, time, , % Config_readinTimeFormat
|
|
|
|
|
} Else {
|
|
|
|
|
FormatTime, time, , % Config_readinDateFormat
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
FormatTime, time, , % Config_readinTimeFormat
|
|
|
|
|
}
|
2012-12-05 12:39:51 +00:00
|
|
|
|
}
|
2022-02-15 21:38:14 +00:00
|
|
|
|
textWidth := Bar_getTrueTextWidth(Bar_#%m%_time_hwnd, time)
|
|
|
|
|
statusWidth -= textWidth
|
|
|
|
|
|
|
|
|
|
GuiControl,, Bar_#%m%_time, % time
|
|
|
|
|
GuiControl, Move, Bar_#%m%_time, % "w" textWidth " x" statusWidth
|
|
|
|
|
GuiControl, Move, Bar_#%m%_time_event, % "w" textWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_time_highlighted, % "w" textWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barIconSpacing
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
|
|
|
|
If (Config_combineDateAndTime) {
|
|
|
|
|
If (Bar_TimeDateState == 0) {
|
|
|
|
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_time_icon_hwnd, Config_barIcon_#1)
|
|
|
|
|
} Else {
|
|
|
|
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_time_icon_hwnd, Config_barIcon_#2)
|
|
|
|
|
}
|
|
|
|
|
} Else {
|
|
|
|
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_time_icon_hwnd, Config_barIcon_#1)
|
|
|
|
|
}
|
|
|
|
|
statusWidth -= iconWidth
|
|
|
|
|
|
|
|
|
|
If (Config_combineDateAndTime) {
|
|
|
|
|
If (Bar_TimeDateState == 0) {
|
|
|
|
|
GuiControl,, Bar_#%m%_time_icon, %Config_barIcon_#1%
|
|
|
|
|
} Else {
|
|
|
|
|
GuiControl,, Bar_#%m%_time_icon, %Config_barIcon_#2%
|
|
|
|
|
}
|
|
|
|
|
} Else {
|
|
|
|
|
GuiControl,, Bar_#%m%_time_icon, %Config_barIcon_#1%
|
|
|
|
|
}
|
|
|
|
|
GuiControl, Move, Bar_#%m%_time_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
|
|
|
|
|
GuiControl, Move, Bar_#%m%_time_icon_event, % "w" iconWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_time_icon_highlighted, % "w" iconWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barItemSpacing
|
2022-02-15 21:38:14 +00:00
|
|
|
|
}
|
|
|
|
|
If Config_readinDate And !Config_combineDateAndTime {
|
|
|
|
|
FormatTime, time, , % Config_readinDateFormat
|
|
|
|
|
textWidth := Bar_getTrueTextWidth(Bar_#%m%_date_hwnd, time)
|
|
|
|
|
statusWidth -= textWidth
|
|
|
|
|
|
|
|
|
|
GuiControl,, Bar_#%m%_date, % time
|
|
|
|
|
GuiControl, Move, Bar_#%m%_date, % "w" textWidth " x" statusWidth
|
|
|
|
|
GuiControl, Move, Bar_#%m%_date_event, % "w" textWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_date_highlighted, % "w" textWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barIconSpacing
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
|
|
|
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_date_icon_hwnd, Config_barIcon_#2)
|
|
|
|
|
statusWidth -= iconWidth
|
|
|
|
|
|
|
|
|
|
GuiControl,, Bar_#%m%_date_icon, %Config_barIcon_#2%
|
|
|
|
|
GuiControl, Move, Bar_#%m%_date_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
|
|
|
|
|
GuiControl, Move, Bar_#%m%_date_icon_event, % "w" iconWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_date_icon_highlighted, % "w" iconWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barItemSpacing
|
2012-09-27 20:32:27 +00:00
|
|
|
|
}
|
2015-01-30 22:38:40 +00:00
|
|
|
|
If Config_readinVolume {
|
|
|
|
|
If (mute = "On") {
|
|
|
|
|
;; Change the color, if the mute is on
|
2022-02-15 21:38:14 +00:00
|
|
|
|
;GuiControl, +Background%Config_backColor_#1_#9% +c%Config_foreColor_#1_#9%, Bar_#%m%_volume_highlighted
|
2015-01-30 22:38:40 +00:00
|
|
|
|
GuiControl, +c%Config_fontColor_#2_#9%, Bar_#%m%_volume
|
2022-02-15 21:38:14 +00:00
|
|
|
|
GuiControl, +c%Config_fontColor_#2_#9%, Bar_#%m%_volume_icon
|
|
|
|
|
} Else {
|
|
|
|
|
;GuiControl, +Background%Config_backColor_#2_#9% +c%Config_foreColor_#2_#9%, Bar_#%m%_volume_highlighted
|
|
|
|
|
GuiControl, +c%Config_fontColor_#1_#9%, Bar_#%m%_volume
|
|
|
|
|
GuiControl, +c%Config_fontColor_#1_#9%, Bar_#%m%_volume_icon
|
2015-01-30 22:38:40 +00:00
|
|
|
|
}
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
|
|
|
|
text := % vol "%"
|
|
|
|
|
textWidth := Bar_getTrueTextWidth(Bar_#%m%_volume_hwnd, text)
|
|
|
|
|
statusWidth -= textWidth
|
|
|
|
|
|
|
|
|
|
GuiControl,, Bar_#%m%_volume, % text
|
|
|
|
|
GuiControl, Move, Bar_#%m%_volume, % "w" textWidth " x" statusWidth
|
|
|
|
|
GuiControl, Move, Bar_#%m%_volume_event, % "w" textWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_volume_highlighted, % "w" textWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barIconSpacing
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
|
|
|
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_volume_icon_hwnd, Config_barIcon_#6)
|
|
|
|
|
statusWidth -= iconWidth
|
|
|
|
|
|
|
|
|
|
GuiControl,, Bar_#%m%_volume_icon, %Config_barIcon_#6%
|
|
|
|
|
GuiControl, Move, Bar_#%m%_volume_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
|
|
|
|
|
GuiControl, Move, Bar_#%m%_volume_icon_event, % "w" iconWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_volume_icon_highlighted, % "w" iconWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barItemSpacing
|
2015-01-30 22:38:40 +00:00
|
|
|
|
}
|
2022-02-15 21:38:14 +00:00
|
|
|
|
If Config_readinRam {
|
|
|
|
|
text := ResourceMonitor_getRamText()
|
|
|
|
|
textWidth := Bar_getTrueTextWidth(Bar_#%m%_ram_hwnd, text)
|
|
|
|
|
statusWidth -= textWidth
|
|
|
|
|
|
|
|
|
|
GuiControl,, Bar_#%m%_ram, % text
|
|
|
|
|
GuiControl, Move, Bar_#%m%_ram, % "w" textWidth " x" statusWidth
|
|
|
|
|
GuiControl, Move, Bar_#%m%_ram_event, % "w" textWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_ram_highlighted, % "w" textWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barIconSpacing
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
|
|
|
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_ram_icon_hwnd, Config_barIcon_#3)
|
|
|
|
|
statusWidth -= iconWidth
|
|
|
|
|
|
|
|
|
|
GuiControl,, Bar_#%m%_ram_icon, %Config_barIcon_#3%
|
|
|
|
|
GuiControl, Move, Bar_#%m%_ram_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
|
|
|
|
|
GuiControl, Move, Bar_#%m%_ram_icon_event, % "w" iconWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_ram_icon_highlighted, % "w" iconWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barItemSpacing
|
2016-04-13 16:48:37 +00:00
|
|
|
|
}
|
2022-02-15 21:38:14 +00:00
|
|
|
|
If Config_readinCpu {
|
|
|
|
|
text := ResourceMonitor_getCpuText()
|
|
|
|
|
textWidth := Bar_getTrueTextWidth(Bar_#%m%_cpu_hwnd, text)
|
|
|
|
|
statusWidth -= textWidth
|
|
|
|
|
|
|
|
|
|
GuiControl,, Bar_#%m%_cpu, % text
|
|
|
|
|
GuiControl, Move, Bar_#%m%_cpu, % "w" textWidth " x" statusWidth
|
|
|
|
|
GuiControl, Move, Bar_#%m%_cpu_event, % "w" textWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_cpu_highlighted, % "w" textWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barIconSpacing
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
|
|
|
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_cpu_icon_hwnd, Config_barIcon_#4)
|
|
|
|
|
statusWidth -= iconWidth
|
|
|
|
|
|
|
|
|
|
GuiControl,, Bar_#%m%_cpu_icon, %Config_barIcon_#4%
|
|
|
|
|
GuiControl, Move, Bar_#%m%_cpu_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
|
|
|
|
|
GuiControl, Move, Bar_#%m%_cpu_icon_event, % "w" iconWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_cpu_icon_highlighted, % "w" iconWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barItemSpacing
|
2022-02-15 21:38:14 +00:00
|
|
|
|
}
|
|
|
|
|
If Config_readinBat {
|
|
|
|
|
If (bat1 < 10) And (bat2 = "off") {
|
|
|
|
|
;; Change the color, if the battery level is below 10%
|
|
|
|
|
;GuiControl, +Background%Config_backColor_#3_#8% +c%Config_foreColor_#3_#8%, Bar_#%m%_battery_highlighted
|
|
|
|
|
GuiControl, +c%Config_fontColor_#3_#8%, Bar_#%m%_battery
|
|
|
|
|
} Else If (bat2 = "off") {
|
|
|
|
|
;; Change the color, if the pc is not plugged in
|
|
|
|
|
;GuiControl, +Background%Config_backColor_#2_#8% +c%Config_foreColor_#2_#8%, Bar_#%m%_battery_highlighted
|
|
|
|
|
GuiControl, +c%Config_fontColor_#2_#8%, Bar_#%m%_battery
|
|
|
|
|
} Else {
|
|
|
|
|
;GuiControl, +Background%Config_backColor_#1_#8% +c%Config_foreColor_#1_#8%, Bar_#%m%_battery_highlighted
|
|
|
|
|
GuiControl, +c%Config_fontColor_#1_#8%, Bar_#%m%_battery
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
text := % bat3 "%"
|
|
|
|
|
textWidth := Bar_getTrueTextWidth(Bar_#%m%_battery_hwnd, text)
|
|
|
|
|
statusWidth -= textWidth
|
|
|
|
|
|
|
|
|
|
GuiControl,, Bar_#%m%_battery, % text
|
|
|
|
|
GuiControl, Move, Bar_#%m%_battery, % "w" textWidth " x" statusWidth
|
|
|
|
|
GuiControl, Move, Bar_#%m%_battery_event, % "w" textWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_battery_highlighted, % "w" textWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barIconSpacing
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
|
|
|
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_battery_icon_hwnd, Config_barIcon_#5)
|
|
|
|
|
statusWidth -= iconWidth
|
|
|
|
|
|
|
|
|
|
GuiControl,, Bar_#%m%_battery_icon, %Config_barIcon_#5%
|
|
|
|
|
GuiControl, Move, Bar_#%m%_battery_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
|
|
|
|
|
GuiControl, Move, Bar_#%m%_battery_icon_event, % "w" iconWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_battery_icon_highlighted, % "w" iconWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barItemSpacing
|
2022-02-15 21:38:14 +00:00
|
|
|
|
}
|
|
|
|
|
If Config_readinMusic {
|
|
|
|
|
text := MusicBee_GetNowPlaying()
|
|
|
|
|
textWidth := Bar_getTrueTextWidth(Bar_#%m%_music_hwnd, text)
|
|
|
|
|
statusWidth -= textWidth
|
|
|
|
|
|
|
|
|
|
GuiControl,, Bar_#%m%_music, % text
|
|
|
|
|
GuiControl, Move, Bar_#%m%_music, % "w" textWidth " x" statusWidth
|
|
|
|
|
GuiControl, Move, Bar_#%m%_music_event, % "w" textWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_music_highlighted, % "w" textWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barIconSpacing
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
|
|
|
|
if (text == "") {
|
|
|
|
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_music_icon_hwnd, "")
|
|
|
|
|
} else {
|
|
|
|
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_music_icon_hwnd, Config_barIcon_#7)
|
|
|
|
|
}
|
|
|
|
|
statusWidth -= iconWidth
|
|
|
|
|
|
|
|
|
|
GuiControl,, Bar_#%m%_music_icon, %Config_barIcon_#7%
|
|
|
|
|
GuiControl, Move, Bar_#%m%_music_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
|
|
|
|
|
GuiControl, Move, Bar_#%m%_music_icon_event, % "w" iconWidth " x" statusWidth
|
|
|
|
|
;GuiControl, Move, Bar_#%m%_music_icon_highlighted, % "w" iconWidth " x" statusWidth
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
statusWidth -= Config_barItemSpacing
|
2016-04-13 16:48:37 +00:00
|
|
|
|
}
|
2023-03-02 03:55:50 +00:00
|
|
|
|
|
|
|
|
|
If (Config_verticalBarPos = "tray" And Monitor_#%m%_taskBarClass) {
|
|
|
|
|
trayWndId := WinExist("ahk_class " Monitor_#%m%_taskBarClass)
|
|
|
|
|
WinSet, Style, -0x40000, ahk_id %trayWndId% ; WS_THICKFRAME
|
|
|
|
|
WinSet, Style, +0x80, ahk_id %trayWndId% ; DS_MODALFRAME
|
|
|
|
|
WinSet, Style, +0x0004, ahk_id %trayWndId% ; DS_3DLOOK
|
|
|
|
|
|
|
|
|
|
WinSet, ExStyle, +0x1, ahk_id %trayWndId% ; WS_EX_DLGMODALFRAME
|
|
|
|
|
WinSet, ExStyle, +0x20000, ahk_id %trayWndId% ; WS_EX_STATICEDGE
|
|
|
|
|
}
|
2012-09-27 20:32:27 +00:00
|
|
|
|
}
|
2011-07-27 17:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-01-30 19:13:10 +00:00
|
|
|
|
Bar_updateTitle() {
|
2022-02-15 21:38:14 +00:00
|
|
|
|
Local aWndId, aWndTitle, content, GuiN, i, title, titleWidth, barWidth, titleX
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2014-03-09 18:16:35 +00:00
|
|
|
|
WinGet, aWndId, ID, A
|
|
|
|
|
WinGetTitle, aWndTitle, ahk_id %aWndId%
|
|
|
|
|
If InStr(Bar_hideTitleWndIds, aWndId ";") Or (aWndTitle = "bug.n_BAR_0")
|
|
|
|
|
aWndTitle := ""
|
2016-02-12 17:58:58 +00:00
|
|
|
|
If aWndId And InStr(Manager_managedWndIds, aWndId . ";") And Window_#%aWndId%_isFloating
|
2014-03-09 18:16:35 +00:00
|
|
|
|
aWndTitle := "~ " aWndTitle
|
|
|
|
|
If (Manager_monitorCount > 1)
|
|
|
|
|
aWndTitle := "[" Manager_aMonitor "] " aWndTitle
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2022-02-15 21:38:14 +00:00
|
|
|
|
title := aWndTitle
|
|
|
|
|
|
2022-09-24 04:07:07 +00:00
|
|
|
|
if (StrLen(title) > 48) {
|
|
|
|
|
;; Shorten the window title if its length exceeds the width of the bar
|
|
|
|
|
title := SubStr(title, 1, 48) . "…"
|
|
|
|
|
}
|
2014-03-25 19:47:07 +00:00
|
|
|
|
StringReplace, title, title, &, &&, All ;; Special character '&', which would underline the next letter.
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2022-02-15 21:38:14 +00:00
|
|
|
|
|
2015-01-30 19:13:10 +00:00
|
|
|
|
Loop, % Manager_monitorCount {
|
2022-02-15 21:38:14 +00:00
|
|
|
|
barWidth := Monitor_#%A_Index%_barWidth
|
|
|
|
|
titleWidth := Bar_getTrueTextWidth(Bar_#%A_Index%_title_hwnd, title)
|
|
|
|
|
titleX := barWidth / 2 - titleWidth / 2
|
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
GuiN := (A_Index - 1) + 1
|
2023-03-02 03:55:50 +00:00
|
|
|
|
If (Config_readinTitle) {
|
|
|
|
|
Debug_logMessage("DEBUG[6] Bar_updateTitle(): Gui, " . GuiN . ": Default", 6)
|
|
|
|
|
Gui, %GuiN%: Default
|
|
|
|
|
GuiControlGet, content, , Bar_#%A_Index%_title
|
|
|
|
|
If (A_Index = Manager_aMonitor) {
|
|
|
|
|
If Not (content = title)
|
|
|
|
|
GuiControl,, Bar_#%A_Index%_title, % title
|
|
|
|
|
GuiControl, Move, Bar_#%A_Index%_title, % "w" titleWidth "x" titleX
|
|
|
|
|
GuiControl, Move, Bar_#%A_Index%_title_event, % "w" titleWidth "x" titleX
|
|
|
|
|
GuiControl, Move, Bar_#%A_Index%_title_highlighted, % "w" titleWidth "x" titleX
|
|
|
|
|
} Else If Not (content = "")
|
|
|
|
|
GuiControl, , Bar_#%A_Index%_title,
|
|
|
|
|
}
|
2012-09-27 20:32:27 +00:00
|
|
|
|
}
|
|
|
|
|
Bar_aWndId := aWndId
|
2011-07-27 17:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-01-30 19:13:10 +00:00
|
|
|
|
Bar_updateView(m, v) {
|
2012-09-30 20:36:42 +00:00
|
|
|
|
Local managedWndId0, wndId0, wndIds
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-27 20:32:27 +00:00
|
|
|
|
GuiN := (m - 1) + 1
|
|
|
|
|
Gui, %GuiN%: Default
|
2012-09-30 20:36:42 +00:00
|
|
|
|
Debug_logMessage("DEBUG[6] Bar_updateView(): m: " . m . "; Gui, " . GuiN . ": Default", 6)
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2012-09-30 20:36:42 +00:00
|
|
|
|
StringTrimRight, wndIds, Manager_managedWndIds, 1
|
|
|
|
|
StringSplit, managedWndId, wndIds, `;
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2015-01-30 19:13:10 +00:00
|
|
|
|
If (v = Monitor_#%m%_aView_#1) {
|
|
|
|
|
;; Set foreground/background colors if the view is the current view.
|
2022-02-15 21:38:14 +00:00
|
|
|
|
;GuiControl, +Background%Config_backColor_#2_#1% +c%Config_foreColor_#2_#1%, Bar_#%m%_view_#%v%_highlighted
|
2015-01-30 19:13:10 +00:00
|
|
|
|
GuiControl, +c%Config_fontColor_#2_#1%, Bar_#%m%_view_#%v%
|
|
|
|
|
} Else {
|
|
|
|
|
;; Set foreground/background colors.
|
2022-02-15 21:38:14 +00:00
|
|
|
|
;GuiControl, +Background%Config_backColor_#1_#1% +c%Config_foreColor_#1_#1%, Bar_#%m%_view_#%v%_highlighted
|
2015-01-30 19:13:10 +00:00
|
|
|
|
GuiControl, +c%Config_fontColor_#1_#1%, Bar_#%m%_view_#%v%
|
2012-09-27 20:32:27 +00:00
|
|
|
|
}
|
2012-12-05 12:39:51 +00:00
|
|
|
|
|
2015-02-01 13:39:46 +00:00
|
|
|
|
Loop, % Config_viewCount {
|
2012-09-30 20:36:42 +00:00
|
|
|
|
StringTrimRight, wndIds, View_#%m%_#%A_Index%_wndIds, 1
|
|
|
|
|
StringSplit, wndId, wndIds, `;
|
2022-09-24 04:07:07 +00:00
|
|
|
|
TagPercent := wndId0 / managedWndId0 * 100
|
|
|
|
|
If (TagPercent > 0 and v != A_Index) {
|
|
|
|
|
GuiControl, +c%Config_fontColor_#3_#1%, Bar_#%m%_view_#%A_Index%
|
|
|
|
|
}
|
2022-02-15 21:38:14 +00:00
|
|
|
|
;GuiControl, , Bar_#%m%_view_#%A_Index%_highlighted, % wndId0 / managedWndId0 * 100 ;; Update the percentage fill for the view.
|
2015-01-30 19:13:10 +00:00
|
|
|
|
GuiControl, , Bar_#%m%_view_#%A_Index%, % Config_viewNames_#%A_Index% ;; Refresh the number on the bar.
|
2012-09-27 20:32:27 +00:00
|
|
|
|
}
|
2011-07-27 17:43:34 +00:00
|
|
|
|
}
|