|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/*
|
|
|
|
|
/*
|
|
|
|
|
bug.n -- tiling window management
|
|
|
|
|
Copyright (c) 2010-2019 Joshua Fuhs, joten
|
|
|
|
|
|
|
|
|
@ -43,7 +43,7 @@ Bar_init(m) {
|
|
|
|
|
Debug_logMessage("DEBUG[6] Bar_init(): Gui, " . GuiN . ": Default", 6)
|
|
|
|
|
Gui, %GuiN%: Default
|
|
|
|
|
Gui, Destroy
|
|
|
|
|
Gui, +AlwaysOnTop -Caption +LabelBar_Gui +LastFound +ToolWindow
|
|
|
|
|
Gui, -Caption +LabelBar_Gui +LastFound +ToolWindow
|
|
|
|
|
Gui, Color, %Config_backColor_#1_#3%
|
|
|
|
|
Gui, Font, c%Config_fontColor_#1_#3% s%Config_fontSize%, %Config_fontName%
|
|
|
|
|
|
|
|
|
@ -61,47 +61,65 @@ Bar_init(m) {
|
|
|
|
|
x1 += w
|
|
|
|
|
|
|
|
|
|
;; The x-position and width of the sub-windows right of the window title are set from the right.
|
|
|
|
|
;; <view>;<layout>;<title>;<shebang>;<time>;<date>;<anyText>;<batteryStatus>;<volumeLevel>
|
|
|
|
|
color := "4"
|
|
|
|
|
id := "shebang"
|
|
|
|
|
text := " #! "
|
|
|
|
|
;; <view>;<layout>;<title>;<shebang>;<time>;<date>;<anyText>;<battery>;<volumeLevel>
|
|
|
|
|
;color := "4"
|
|
|
|
|
;id := "shebang"
|
|
|
|
|
;text := " #! "
|
|
|
|
|
color := ""
|
|
|
|
|
id := ""
|
|
|
|
|
text := ""
|
|
|
|
|
If Config_readinTime {
|
|
|
|
|
color .= ";5"
|
|
|
|
|
id .= ";time"
|
|
|
|
|
text .= "; " . Config_readinTimeFormat . " "
|
|
|
|
|
color .= "4"
|
|
|
|
|
id .= "time"
|
|
|
|
|
text .= "" . Config_readinTimeFormat
|
|
|
|
|
}
|
|
|
|
|
If Config_readinDate {
|
|
|
|
|
color .= ";6"
|
|
|
|
|
If (Config_readinDate And !Config_combineDateAndTime) {
|
|
|
|
|
color .= ";5"
|
|
|
|
|
id .= ";date"
|
|
|
|
|
text .= "; " . Config_readinDateFormat . " "
|
|
|
|
|
text .= ";" . Config_readinDateFormat
|
|
|
|
|
}
|
|
|
|
|
If Config_readinVolume {
|
|
|
|
|
color .= ";9"
|
|
|
|
|
id .= ";volume"
|
|
|
|
|
text .= "; VOL: ???% "
|
|
|
|
|
text .= ";VOL: ???%"
|
|
|
|
|
}
|
|
|
|
|
anyText := Config_readinAny()
|
|
|
|
|
If anyText {
|
|
|
|
|
If Config_readinRam {
|
|
|
|
|
color .= ";6"
|
|
|
|
|
id .= ";ram"
|
|
|
|
|
text .= ";" . ResourceMonitor_getRamText()
|
|
|
|
|
}
|
|
|
|
|
If Config_readinCpu {
|
|
|
|
|
color .= ";7"
|
|
|
|
|
id .= ";anyText"
|
|
|
|
|
text .= ";" anyText
|
|
|
|
|
id .= ";cpu"
|
|
|
|
|
text .= ";" . ResourceMonitor_getCpuText()
|
|
|
|
|
}
|
|
|
|
|
If Config_readinBat {
|
|
|
|
|
color .= ";8"
|
|
|
|
|
id .= ";batteryStatus"
|
|
|
|
|
text .= "; BAT: ???% "
|
|
|
|
|
id .= ";battery"
|
|
|
|
|
text .= ";BAT: ???%"
|
|
|
|
|
}
|
|
|
|
|
If Config_readinMusic {
|
|
|
|
|
color .= ";10"
|
|
|
|
|
id .= ";music"
|
|
|
|
|
text .= ";" . MusicBee_GetNowPlaying()
|
|
|
|
|
}
|
|
|
|
|
StringSplit, color, color, `;
|
|
|
|
|
StringSplit, id, id, `;
|
|
|
|
|
StringSplit, text, text, `;
|
|
|
|
|
Loop, % id0 {
|
|
|
|
|
If (id%A_Index% = "shebang")
|
|
|
|
|
elemId := id%A_Index%
|
|
|
|
|
If (elemId = "shebang")
|
|
|
|
|
Gui, -Disabled
|
|
|
|
|
w := Bar_getTextWidth(text%A_Index%)
|
|
|
|
|
x2 -= w
|
|
|
|
|
titleWidth -= w
|
|
|
|
|
i := color%A_Index%
|
|
|
|
|
Bar_addElement(m, id%A_Index%, text%A_Index%, x2, y1, w, Config_backColor_#1_#%i%, Config_foreColor_#1_#%i%, Config_fontColor_#1_#%i%)
|
|
|
|
|
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)
|
|
|
|
|
GuiControl, -Center, Bar_#%m%_%elemId%
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
;; Window title (remaining space)
|
|
|
|
@ -161,6 +179,9 @@ Bar_init(m) {
|
|
|
|
|
DllCall("Shell32.dll\SHAppBarMessage", "UInt", (ABM_SETPOS := 0x3) , "UInt", &Bar_appBarData)
|
|
|
|
|
;; SKAN: Crazy Scripting : Quick Launcher for Portable Apps (http://www.autohotkey.com/forum/topic22398.html)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Bar_BinaryClockChars := ["⠀","⠈","⠐","⠘","⠠","⠨","⠰","⠸","⢀","⢈","⠁","⠉","⠑","⠙","⠡","⠩","⠱","⠹","⢁","⢉","⠂","⠊","⠒","⠚","⠢","⠪","⠲","⠺","⢂","⢊","⠃","⠋","⠓","⠛","⠣","⠫","⠳","⠻","⢃","⢋","⠄","⠌","⠔","⠜","⠤","⠬","⠴","⠼","⢄","⢌","⠅","⠍","⠕","⠝","⠥","⠭","⠵","⠽","⢅","⢍"]
|
|
|
|
|
Bar_TimeDateState := 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Bar_initCmdGui()
|
|
|
|
@ -188,15 +209,23 @@ Bar_initCmdGui()
|
|
|
|
|
Gui, Show, Hide w%Bar_#0_#0W% h%Bar_#0_#0H%, %wndTitle%
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Bar_addElement(m, id, text, x, y1, width, backColor, foreColor, fontColor) {
|
|
|
|
|
Bar_addElement(m, id, text, x, y1, width, backColor, foreColor, fontColor, fontSize="", fontName="") {
|
|
|
|
|
Local y2
|
|
|
|
|
|
|
|
|
|
if (fontSize == "") {
|
|
|
|
|
fontSize = %Config_fontSize%
|
|
|
|
|
}
|
|
|
|
|
if (fontName == "") {
|
|
|
|
|
fontName = %Config_fontName%
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
y2 := y1 + (Bar_ctrlHeight - Bar_textHeight) / 2
|
|
|
|
|
|
|
|
|
|
Gui, Add, Text, x%x% y%y1% w%width% h%Bar_ctrlHeight% BackgroundTrans vBar_#%m%_%id%_event gBar_GuiClick,
|
|
|
|
|
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%
|
|
|
|
|
Gui, Add, Text, x%x% y%y2% w%width% h%Bar_textHeight% BackgroundTrans Center vBar_#%m%_%id%, %text%
|
|
|
|
|
;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%
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Bar_cmdGuiEnter:
|
|
|
|
@ -289,14 +318,46 @@ Bar_getTextWidth(x, reverse=False)
|
|
|
|
|
Return, textWidth
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Bar_GuiClick:
|
|
|
|
|
Manager_winActivate(Bar_aWndId)
|
|
|
|
|
If (A_GuiEvent = "Normal") {
|
|
|
|
|
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()
|
|
|
|
|
;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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} Else {
|
|
|
|
|
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))
|
|
|
|
@ -348,17 +409,17 @@ Bar_toggleCommandGui() {
|
|
|
|
|
Manager_winActivate(Bar_aWndId)
|
|
|
|
|
} Else {
|
|
|
|
|
Bar_cmdGuiIsVisible := True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If (Config_verticalBarPos = "top") Or (Config_verticalBarPos = "tray") And (Monitor_#%Manager_aMonitor%_taskBarPos = "top" Or Not Monitor_#%Manager_aMonitor%_taskBarClass)
|
|
|
|
|
y := Monitor_#%Manager_aMonitor%_y
|
|
|
|
|
Else
|
|
|
|
|
y := Monitor_#%Manager_aMonitor%_y + Monitor_#%Manager_aMonitor%_height - Bar_#0_#0H
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gui, Show
|
|
|
|
|
WinGet, wndId, ID, bug.n_BAR_0
|
|
|
|
|
WinMove, ahk_id %wndId%, , %x%, %y%
|
|
|
|
@ -397,12 +458,13 @@ Bar_updateStatic(m) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Bar_updateStatus() {
|
|
|
|
|
Local anyText, bat1, bat2, bat3, GuiN, m, mute, time, vol
|
|
|
|
|
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%
|
|
|
|
|
|
|
|
|
|
anyText := Config_readinAny()
|
|
|
|
|
If Config_readinBat {
|
|
|
|
|
ResourceMonitor_getBatteryStatus(bat1, bat2)
|
|
|
|
|
bat3 := SubStr(" " bat1, -2)
|
|
|
|
|
bat3 := bat1
|
|
|
|
|
}
|
|
|
|
|
If Config_readinVolume {
|
|
|
|
|
SoundGet, vol, MASTER, VOLUME
|
|
|
|
@ -415,49 +477,236 @@ Bar_updateStatus() {
|
|
|
|
|
GuiN := (m - 1) + 1
|
|
|
|
|
Debug_logMessage("DEBUG[6] Bar_updateStatus(): Gui, " . GuiN . ": Default", 6)
|
|
|
|
|
Gui, %GuiN%: Default
|
|
|
|
|
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%_batteryStatus_highlighted
|
|
|
|
|
GuiControl, +c%Config_fontColor_#3_#8%, Bar_#%m%_batteryStatus
|
|
|
|
|
} 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%_batteryStatus_highlighted
|
|
|
|
|
GuiControl, +c%Config_fontColor_#2_#8%, Bar_#%m%_batteryStatus
|
|
|
|
|
|
|
|
|
|
statusWidth := Monitor_#%m%_barWidth
|
|
|
|
|
statusWidth -= %Config_barItemSpacing%
|
|
|
|
|
|
|
|
|
|
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]
|
|
|
|
|
}
|
|
|
|
|
} Else {
|
|
|
|
|
GuiControl, +Background%Config_backColor_#1_#8% +c%Config_foreColor_#1_#8%, Bar_#%m%_batteryStatus_highlighted
|
|
|
|
|
GuiControl, +c%Config_fontColor_#1_#8%, Bar_#%m%_batteryStatus
|
|
|
|
|
If (Config_combineDateAndTime) {
|
|
|
|
|
If (Bar_TimeDateState == 0) {
|
|
|
|
|
FormatTime, time, , % Config_readinTimeFormat
|
|
|
|
|
} Else {
|
|
|
|
|
FormatTime, time, , % Config_readinDateFormat
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
FormatTime, time, , % Config_readinTimeFormat
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
GuiControl, , Bar_#%m%_batteryStatus_highlighted, %bat3%
|
|
|
|
|
GuiControl, , Bar_#%m%_batteryStatus, % " BAT: " bat3 "% "
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barIconSpacing%
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barItemSpacing%
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barIconSpacing%
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barItemSpacing%
|
|
|
|
|
}
|
|
|
|
|
If anyText
|
|
|
|
|
GuiControl, , Bar_#%m%_anyText, % anyText
|
|
|
|
|
If Config_readinVolume {
|
|
|
|
|
If (mute = "On") {
|
|
|
|
|
;; Change the color, if the mute is on
|
|
|
|
|
GuiControl, +Background%Config_backColor_#1_#9% +c%Config_foreColor_#1_#9%, Bar_#%m%_volume_highlighted
|
|
|
|
|
GuiControl, +c%Config_fontColor_#1_#9%, Bar_#%m%_volume
|
|
|
|
|
} Else {
|
|
|
|
|
GuiControl, +Background%Config_backColor_#2_#9% +c%Config_foreColor_#2_#9%, Bar_#%m%_volume_highlighted
|
|
|
|
|
;GuiControl, +Background%Config_backColor_#1_#9% +c%Config_foreColor_#1_#9%, Bar_#%m%_volume_highlighted
|
|
|
|
|
GuiControl, +c%Config_fontColor_#2_#9%, Bar_#%m%_volume
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
GuiControl, , Bar_#%m%_volume_highlighted, %vol%
|
|
|
|
|
GuiControl, , Bar_#%m%_volume, % " VOL: " SubStr(" " vol, -2) "% "
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barIconSpacing%
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barItemSpacing%
|
|
|
|
|
}
|
|
|
|
|
If Config_readinDate {
|
|
|
|
|
FormatTime, time, , % Config_readinDateFormat
|
|
|
|
|
GuiControl, , Bar_#%m%_date, % time
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barIconSpacing%
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barItemSpacing%
|
|
|
|
|
}
|
|
|
|
|
If Config_readinTime {
|
|
|
|
|
FormatTime, time, , % Config_readinTimeFormat
|
|
|
|
|
GuiControl, , Bar_#%m%_time, % time
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barIconSpacing%
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barItemSpacing%
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barIconSpacing%
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barItemSpacing%
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barIconSpacing%
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
statusWidth -= %Config_barItemSpacing%
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Bar_updateTitle() {
|
|
|
|
|
Local aWndId, aWndTitle, content, GuiN, i, title
|
|
|
|
|
Local aWndId, aWndTitle, content, GuiN, i, title, titleWidth, barWidth, titleX
|
|
|
|
|
|
|
|
|
|
WinGet, aWndId, ID, A
|
|
|
|
|
WinGetTitle, aWndTitle, ahk_id %aWndId%
|
|
|
|
@ -467,24 +716,33 @@ Bar_updateTitle() {
|
|
|
|
|
aWndTitle := "~ " aWndTitle
|
|
|
|
|
If (Manager_monitorCount > 1)
|
|
|
|
|
aWndTitle := "[" Manager_aMonitor "] " aWndTitle
|
|
|
|
|
title := " " . aWndTitle . " "
|
|
|
|
|
|
|
|
|
|
If (Bar_getTextWidth(title) > Bar_#%Manager_aMonitor%_titleWidth) {
|
|
|
|
|
;; Shorten the window title if its length exceeds the width of the bar
|
|
|
|
|
i := Bar_getTextWidth(Bar_#%Manager_aMonitor%_titleWidth, True) - 6
|
|
|
|
|
StringLeft, title, aWndTitle, i
|
|
|
|
|
title := " " . title . " ... "
|
|
|
|
|
}
|
|
|
|
|
title := aWndTitle
|
|
|
|
|
|
|
|
|
|
;If (Bar_getTextWidth(title) > 768) {
|
|
|
|
|
; ;; Shorten the window title if its length exceeds the width of the bar
|
|
|
|
|
; i := Bar_getTextWidth(Bar_#%Manager_aMonitor%_titleWidth, True) - 6
|
|
|
|
|
; StringLeft, title, aWndTitle, i
|
|
|
|
|
; title := " " . title . " ... "
|
|
|
|
|
;}
|
|
|
|
|
StringReplace, title, title, &, &&, All ;; Special character '&', which would underline the next letter.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Loop, % Manager_monitorCount {
|
|
|
|
|
barWidth := Monitor_#%A_Index%_barWidth
|
|
|
|
|
titleWidth := Bar_getTrueTextWidth(Bar_#%A_Index%_title_hwnd, title)
|
|
|
|
|
titleX := barWidth / 2 - titleWidth / 2
|
|
|
|
|
|
|
|
|
|
GuiN := (A_Index - 1) + 1
|
|
|
|
|
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,, 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,
|
|
|
|
|
}
|
|
|
|
@ -503,18 +761,18 @@ Bar_updateView(m, v) {
|
|
|
|
|
|
|
|
|
|
If (v = Monitor_#%m%_aView_#1) {
|
|
|
|
|
;; Set foreground/background colors if the view is the current view.
|
|
|
|
|
GuiControl, +Background%Config_backColor_#2_#1% +c%Config_foreColor_#2_#1%, Bar_#%m%_view_#%v%_highlighted
|
|
|
|
|
;GuiControl, +Background%Config_backColor_#2_#1% +c%Config_foreColor_#2_#1%, Bar_#%m%_view_#%v%_highlighted
|
|
|
|
|
GuiControl, +c%Config_fontColor_#2_#1%, Bar_#%m%_view_#%v%
|
|
|
|
|
} Else {
|
|
|
|
|
;; Set foreground/background colors.
|
|
|
|
|
GuiControl, +Background%Config_backColor_#1_#1% +c%Config_foreColor_#1_#1%, Bar_#%m%_view_#%v%_highlighted
|
|
|
|
|
;GuiControl, +Background%Config_backColor_#1_#1% +c%Config_foreColor_#1_#1%, Bar_#%m%_view_#%v%_highlighted
|
|
|
|
|
GuiControl, +c%Config_fontColor_#1_#1%, Bar_#%m%_view_#%v%
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Loop, % Config_viewCount {
|
|
|
|
|
StringTrimRight, wndIds, View_#%m%_#%A_Index%_wndIds, 1
|
|
|
|
|
StringSplit, wndId, wndIds, `;
|
|
|
|
|
GuiControl, , Bar_#%m%_view_#%A_Index%_highlighted, % wndId0 / managedWndId0 * 100 ;; Update the percentage fill for the view.
|
|
|
|
|
;GuiControl, , Bar_#%m%_view_#%A_Index%_highlighted, % wndId0 / managedWndId0 * 100 ;; Update the percentage fill for the view.
|
|
|
|
|
GuiControl, , Bar_#%m%_view_#%A_Index%, % Config_viewNames_#%A_Index% ;; Refresh the number on the bar.
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|