Revised color scheme and status bar

... extracting the volume from anyText.
This commit is contained in:
joten 2015-01-30 23:38:40 +01:00
parent ae54669dd8
commit a8adf2e33f
4 changed files with 117 additions and 125 deletions

View file

@ -37,7 +37,7 @@ Appearance" settings for the "Active Title Bar".
`Config_largeFontSize=24` `Config_largeFontSize=24`
> Font size in pixel, i. a. for the numbering of areas in the area trace. > Font size in pixel, i. a. for the numbering of areas in the area trace.
`Config_backColor_#1=<COLOR_MENU>;<COLOR_INACTIVECAPTION>;<COLOR_MENU>;<COLOR_INACTIVECAPTION>;<COLOR_MENU>;<COLOR_INACTIVECAPTION>;<COLOR_GRADIENTINACTIVECAPTION>;<COLOR_INACTIVECAPTION>;<COLOR_INACTIVECAPTION>;<COLOR_INACTIVECAPTION>;<COLOR_INACTIVECAPTION>;<COLOR_INACTIVECAPTION>` `Config_backColor_#1=<COLOR_GRADIENTINACTIVECAPTION>;<COLOR_ACTIVECAPTION>;<COLOR_MENU>;<COLOR_ACTIVECAPTION>;<COLOR_MENU>;<COLOR_ACTIVECAPTION>;<COLOR_GRADIENTINACTIVECAPTION>;<COLOR_GRADIENTACTIVECAPTION>;<COLOR_GRADIENTACTIVECAPTION>`
> The default background color for bar elements. The value for this and the > The default background color for bar elements. The value for this and the
other (following) color related configuration variables is a semicolon other (following) color related configuration variables is a semicolon
separated list, which contains the following items: separated list, which contains the following items:
@ -47,43 +47,40 @@ separated list, which contains the following items:
* title * title
* shebang * shebang
* time * time
* "any text", i. a. date * date
* "any text"
* battery status * battery status
* cpu load
* disk load
* memory usage
* network load
* volume level * volume level
`Config_backColor_#2=<COLOR_GRADIENTACTIVECAPTION>;;;;;;<COLOR_GRADIENTINACTIVECAPTION>;;;;;<COLOR_GRADIENTINACTIVECAPTION>` `Config_backColor_#2=<COLOR_GRADIENTACTIVECAPTION>;;;;;;;<COLOR_MENU>;<COLOR_MENU>`
> The background color of bar elements, which are highlighted depending on the > The background color of bar elements, which are highlighted depending on the
status, i. a. the active view, a discharging battery and the sound volume. status, i. a. the active view, a discharging battery and the sound volume.
`Config_backColor_#3=;;;;;;ff8040;;;;;` `Config_backColor_#3=;;;;;;;ff8040;`
> The background color of bar elements, which are highlighted depending on the > The background color of bar elements, which are highlighted depending on the
status, i. a. a discharging battery with a battery level lower than 10%. status, i. a. a discharging battery with a battery level lower than 10%.
`Config_foreColor_#1=<COLOR_INACTIVECAPTION>;<COLOR_INACTIVECAPTION>;<COLOR_MENU>;<COLOR_INACTIVECAPTION>;<COLOR_MENU>;<COLOR_INACTIVECAPTION>;<COLOR_INACTIVECAPTION>;<COLOR_INACTIVECAPTION>;<COLOR_INACTIVECAPTION>;<COLOR_INACTIVECAPTION>;<COLOR_INACTIVECAPTION>;<COLOR_INACTIVECAPTION>` `Config_foreColor_#1=<COLOR_INACTIVECAPTION>;<COLOR_ACTIVECAPTION>;<COLOR_MENU>;<COLOR_ACTIVECAPTION>;<COLOR_MENU>;<COLOR_ACTIVECAPTION>;<COLOR_INACTIVECAPTION>;<COLOR_ACTIVECAPTION>;<COLOR_GRADIENTINACTIVECAPTION>`
> The default forground color of bar elements. Every bar element consists of a > The default forground color of bar elements. Every bar element consists of a
progress bar with a background and a foreground; the visible part of the progress bar with a background and a foreground; the visible part of the
foreground depends on the value of the progress bar. foreground depends on the value of the progress bar.
`Config_foreColor_#2=<COLOR_ACTIVECAPTION>;;;;;;<COLOR_HIGHLIGHT>;;;;;<COLOR_HIGHLIGHT>` `Config_foreColor_#2=<COLOR_ACTIVECAPTION>;;;;;;;<COLOR_HIGHLIGHT>;<COLOR_HIGHLIGHT>`
> The foreground color of bar elements, which are highlighted depending on the > The foreground color of bar elements, which are highlighted depending on the
status, i. a. the active view, a discharging battery and the sound volume. status, i. a. the active view, a discharging battery and the sound volume.
`Config_foreColor_#3=;;;;;;<COLOR_INACTIVECAPTION>;;;;;` `Config_foreColor_#3=;;;;;;;<COLOR_INACTIVECAPTION>;`
> The foreground color of bar elements, which are highlighted depending on the > The foreground color of bar elements, which are highlighted depending on the
status, i. a. a discharging battery with a battery level lower than 10%. status, i. a. a discharging battery with a battery level lower than 10%.
`Config_fontColor_#1=<COLOR_MENUTEXT>;Default;<COLOR_MENUTEXT>;Default;<COLOR_MENUTEXT>;Default;Default;Default;Default;Default;Default;Default` `Config_fontColor_#1=<COLOR_INACTIVECAPTIONTEXT>;<COLOR_CAPTIONTEXT>;<COLOR_MENUTEXT>;<COLOR_CAPTIONTEXT>;<COLOR_MENUTEXT>;<COLOR_CAPTIONTEXT>;<COLOR_INACTIVECAPTIONTEXT>;<COLOR_CAPTIONTEXT>;<COLOR_INACTIVECAPTIONTEXT>`
> The default font color for the text of bar elements. > The default font color for the text of bar elements.
`Config_fontColor_#2=<COLOR_CAPTIONTEXT>;;;;;;<COLOR_INACTIVECAPTIONTEXT>;;;;;<COLOR_INACTIVECAPTIONTEXT>` `Config_fontColor_#2=<COLOR_CAPTIONTEXT>;;;;;;;<COLOR_MENUTEXT>;<COLOR_MENUTEXT>`
> The font color of bar elements, which are highlighted depending on the > The font color of bar elements, which are highlighted depending on the
status, i. a. the active view, a discharging battery and the sound volume. status, i. a. the active view, a discharging battery and the sound volume.
`Config_fontColor_#3=;;;;;;Default;;;;;` `Config_fontColor_#3=;;;;;;;<COLOR_INACTIVECAPTIONTEXT>;`
> The fontground color of bar elements, which are highlighted depending on the > The fontground color of bar elements, which are highlighted depending on the
status, i. a. a discharging battery with a battery level lower than 10%. status, i. a. a discharging battery with a battery level lower than 10%.

View file

@ -14,7 +14,7 @@
*/ */
Bar_init(m) { Bar_init(m) {
Local appBarMsg, GuiN, h1, h2, i, text, titleWidth, trayWndId, w, wndId, wndTitle, wndWidth, x1, x2, y1, y2 Local appBarMsg, anyText, color, color0, GuiN, h1, h2, i, id, id0, text, text0, titleWidth, trayWndId, w, wndId, wndTitle, wndWidth, x1, x2, y1, y2
If (SubStr(Config_barWidth, 0) = "%") { If (SubStr(Config_barWidth, 0) = "%") {
StringTrimRight, wndWidth, Config_barWidth, 1 StringTrimRight, wndWidth, Config_barWidth, 1
@ -61,37 +61,47 @@ Bar_init(m) {
x1 += w x1 += w
;; The x-position and width of the sub-windows right of the window title are set from the right. ;; The x-position and width of the sub-windows right of the window title are set from the right.
;; @TODO [v9] Maybe add a field (including a progress bar) for sound volume information. ;; <view>;<layout>;<title>;<shebang>;<time>;<date>;<anyText>;<batteryStatus>;<volumeLevel>
Loop, 4 { color := "4"
i := Config_viewCount + 7 - A_Index id := "shebang"
w := 0 text := " #! "
If (i = Config_viewCount + 6) { If Config_readinTime {
;; Command gui color .= ";5"
id .= ";time"
text .= "; ??:?? "
}
If Config_readinDate {
color .= ";6"
id .= ";date"
text .= "; ??, ??. ???. ???? "
}
If Config_readinVolume {
color .= ";9"
id .= ";volume"
text .= "; VOL: ???% "
}
anyText := Config_readinAny()
If anyText {
color .= ";7"
id .= ";anyText"
text .= ";" anyText
}
If Config_readinBat {
color .= ";8"
id .= ";batteryStatus"
text .= "; BAT: ???% "
}
StringSplit, color, color, `;
StringSplit, id, id, `;
StringSplit, text, text, `;
Loop, % id0 {
If (id%A_Index% = "shebang")
Gui, -Disabled Gui, -Disabled
w := Bar_getTextWidth(" #! ") w := Bar_getTextWidth(text%A_Index%)
x2 -= w x2 -= w
titleWidth -= w titleWidth -= w
Bar_addElement(m, "shebang", " #! ", x2, y1, w, Config_backColor_#1_#4, Config_foreColor_#1_#4, Config_fontColor_#1_#4) i := color%A_Index%
} Else If (i = Config_viewCount + 5) And Config_readinTime { Bar_addElement(m, id%A_Index%, text%A_Index%, x2, y1, w, Config_backColor_#1_#%i%, Config_foreColor_#1_#%i%, Config_fontColor_#1_#%i%)
;; Time
w := Bar_getTextWidth(" ??:?? ")
x2 -= w
titleWidth -= w
Bar_addElement(m, "time", " ??:?? ", x2, y1, w, Config_backColor_#1_#5, Config_foreColor_#1_#5, Config_fontColor_#1_#5)
} Else If (i = Config_viewCount + 4) And Config_readinAny() {
;; Any
text := Config_readinAny()
w := Bar_getTextWidth(text)
x2 -= w
titleWidth -= w
Bar_addElement(m, "anyText", text, x2, y1, w, Config_backColor_#1_#6, Config_foreColor_#1_#6, Config_fontColor_#1_#6)
} Else If (i = Config_viewCount + 3) And Config_readinBat {
;; Battery level
w := Bar_getTextWidth(" BAT: ???% ")
x2 -= w
titleWidth -= w
Bar_addElement(m, "batteryStatus", " BAT: ???% ", x2, y1, w, Config_backColor_#1_#7, Config_foreColor_#1_#7, Config_fontColor_#1_#7)
}
} }
;; Window title (remaining space) ;; Window title (remaining space)
@ -366,7 +376,7 @@ Bar_updateLayout(m) {
} }
Bar_updateStatus() { Bar_updateStatus() {
Local anyContent, anyText, b1, b2, b3, GuiN, m Local anyContent, anyText, bat1, bat2, bat3, GuiN, m, mute, vol
Loop, % Manager_monitorCount { Loop, % Manager_monitorCount {
m := A_Index m := A_Index
@ -374,22 +384,22 @@ Bar_updateStatus() {
Debug_logMessage("DEBUG[6] Bar_updateStatus(): Gui, " . GuiN . ": Default", 6) Debug_logMessage("DEBUG[6] Bar_updateStatus(): Gui, " . GuiN . ": Default", 6)
Gui, %GuiN%: Default Gui, %GuiN%: Default
If Config_readinBat { If Config_readinBat {
ResourceMonitor_getBatteryStatus(b1, b2) ResourceMonitor_getBatteryStatus(bat1, bat2)
b3 := SubStr(" " b1, -2) bat3 := SubStr(" " bat1, -2)
If (b1 < 10) And (b2 = "off") { If (bat1 < 10) And (bat2 = "off") {
;; Change the color, if the battery level is below 10% ;; Change the color, if the battery level is below 10%
GuiControl, +Background%Config_backColor_#3_#7% +c%Config_foreColor_#3_#7%, Bar_#%m%_batteryStatus_highlighted GuiControl, +Background%Config_backColor_#3_#8% +c%Config_foreColor_#3_#8%, Bar_#%m%_batteryStatus_highlighted
GuiControl, +c%Config_fontColor_#3_#7%, Bar_#%m%_batteryStatus GuiControl, +c%Config_fontColor_#3_#8%, Bar_#%m%_batteryStatus
} Else If (b2 = "off") { } Else If (bat2 = "off") {
;; Change the color, if the pc is not plugged in ;; Change the color, if the pc is not plugged in
GuiControl, +Background%Config_backColor_#2_#7% +c%Config_foreColor_#2_#7%, Bar_#%m%_batteryStatus_highlighted GuiControl, +Background%Config_backColor_#2_#8% +c%Config_foreColor_#2_#8%, Bar_#%m%_batteryStatus_highlighted
GuiControl, +c%Config_fontColor_#2_#7%, Bar_#%m%_batteryStatus GuiControl, +c%Config_fontColor_#2_#8%, Bar_#%m%_batteryStatus
} Else { } Else {
GuiControl, +Background%Config_backColor_#1_#7% +c%Config_foreColor_#1_#7%, Bar_#%m%_batteryStatus_highlighted GuiControl, +Background%Config_backColor_#1_#8% +c%Config_foreColor_#1_#8%, Bar_#%m%_batteryStatus_highlighted
GuiControl, +c%Config_fontColor_#1_#7%, Bar_#%m%_batteryStatus GuiControl, +c%Config_fontColor_#1_#8%, Bar_#%m%_batteryStatus
} }
GuiControl, , Bar_#%m%_batteryStatus_highlighted, %b3% GuiControl, , Bar_#%m%_batteryStatus_highlighted, %bat3%
GuiControl, , Bar_#%m%_batteryStatus, % " BAT: " b3 "% " GuiControl, , Bar_#%m%_batteryStatus, % " BAT: " bat3 "% "
} }
anyText := Config_readinAny() anyText := Config_readinAny()
If anyText { If anyText {
@ -397,6 +407,23 @@ Bar_updateStatus() {
If Not (anyText = anyContent) If Not (anyText = anyContent)
GuiControl, , Bar_#%m%_anyText, % anyText GuiControl, , Bar_#%m%_anyText, % anyText
} }
If Config_readinVolume {
SoundGet, vol, MASTER, VOLUME
SoundGet, mute, MASTER, MUTE
vol := Round(vol)
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, +c%Config_fontColor_#2_#9%, Bar_#%m%_volume
}
GuiControl, , Bar_#%m%_volume_highlighted, %vol%
GuiControl, , Bar_#%m%_volume, % " VOL: " SubStr(" " vol, -2) "% "
}
If Config_readinDate
GuiControl, , Bar_#%m%_date, % " " A_DDD ", " A_DD ". " A_MMM ". " A_YYYY " "
If Config_readinTime If Config_readinTime
GuiControl, , Bar_#%m%_time, % " " A_Hour ":" A_Min " " GuiControl, , Bar_#%m%_time, % " " A_Hour ":" A_Min " "
} }

View file

@ -13,8 +13,7 @@
@version 9.0.0 @version 9.0.0
*/ */
Config_init() Config_init() {
{
Local i, key, layout0, layout1, layout2, vNames0, vNames1, vNames2, vNames3, vNames4, vNames5, vNames6, vNames7, vNames8, vNames9 Local i, key, layout0, layout1, layout2, vNames0, vNames1, vNames2, vNames3, vNames4, vNames5, vNames6, vNames7, vNames8, vNames9
;; Status bar ;; Status bar
@ -102,8 +101,7 @@ Config_init()
Config_restoreConfig(Config_filePath) Config_restoreConfig(Config_filePath)
Config_getSystemSettings() Config_getSystemSettings()
Config_initColors() Config_initColors()
Loop, % Config_layoutCount Loop, % Config_layoutCount {
{
StringSplit, layout, Config_layout_#%A_Index%, `; StringSplit, layout, Config_layout_#%A_Index%, `;
Config_layoutFunction_#%A_Index% := layout2 Config_layoutFunction_#%A_Index% := layout2
Config_layoutSymbol_#%A_Index% := layout1 Config_layoutSymbol_#%A_Index% := layout1
@ -114,9 +112,7 @@ Config_init()
Else Else
Config_viewCount := vNames0 Config_viewCount := vNames0
Loop, % Config_viewCount Loop, % Config_viewCount
{
Config_viewNames_#%A_Index% := vNames%A_Index% Config_viewNames_#%A_Index% := vNames%A_Index%
}
} }
Config_initColors() { Config_initColors() {
@ -196,31 +192,33 @@ Config_getSystemSettings() {
COLOR_INACTIVECAPTIONTEXT := Config_convertSystemColor(DllCall("GetSysColor", "Int", 19)) COLOR_INACTIVECAPTIONTEXT := Config_convertSystemColor(DllCall("GetSysColor", "Int", 19))
COLOR_MENU := Config_convertSystemColor(DllCall("GetSysColor", "Int", 4)) COLOR_MENU := Config_convertSystemColor(DllCall("GetSysColor", "Int", 4))
COLOR_MENUTEXT := Config_convertSystemColor(DllCall("GetSysColor", "Int", 7)) COLOR_MENUTEXT := Config_convertSystemColor(DllCall("GetSysColor", "Int", 7))
;; <view>;<layout>;<title>;<shebang>;<time>;<anyText, i. a. date>;<batteryStatus>;<cpuLoad>;<diskLoad>;<memoryUsage>;<networkLoad>;<volumeLevel> ;; <view>;<layout>;<title>;<shebang>;<time>;<date>;<anyText>;<batteryStatus>;<volumeLevel>
If Not Config_backColor_#1 { If Not Config_backColor_#1 {
Config_backColor_#1 := COLOR_MENU ";" COLOR_INACTIVECAPTION ";" COLOR_MENU ";" COLOR_INACTIVECAPTION ";" COLOR_MENU ";" COLOR_INACTIVECAPTION ";" Config_backColor_#1 := COLOR_GRADIENTINACTIVECAPTION ";" COLOR_ACTIVECAPTION ";" COLOR_MENU ";" COLOR_ACTIVECAPTION ";" COLOR_MENU ";" COLOR_ACTIVECAPTION ";"
Config_backColor_#1 .= COLOR_GRADIENTINACTIVECAPTION ";" COLOR_INACTIVECAPTION ";" COLOR_INACTIVECAPTION ";" COLOR_INACTIVECAPTION ";" COLOR_INACTIVECAPTION ";" COLOR_INACTIVECAPTION Config_backColor_#1 .= COLOR_GRADIENTINACTIVECAPTION ";" COLOR_GRADIENTACTIVECAPTION ";" COLOR_GRADIENTACTIVECAPTION
} }
If Not Config_backColor_#2 If Not Config_backColor_#2
Config_backColor_#2 := COLOR_GRADIENTACTIVECAPTION ";;;;;;" COLOR_GRADIENTINACTIVECAPTION ";;;;;" COLOR_GRADIENTINACTIVECAPTION Config_backColor_#2 := COLOR_GRADIENTACTIVECAPTION ";;;;;;;" COLOR_MENU ";" COLOR_MENU
If Not Config_backColor_#3 If Not Config_backColor_#3
Config_backColor_#3 := ";;;;;;ff8040;;;;;" Config_backColor_#3 := ";;;;;;;ff8040;"
If Not Config_foreColor_#1 { If Not Config_foreColor_#1 {
Config_foreColor_#1 := COLOR_INACTIVECAPTION ";" COLOR_INACTIVECAPTION ";" COLOR_MENU ";" COLOR_INACTIVECAPTION ";" COLOR_MENU ";" COLOR_INACTIVECAPTION ";" Config_foreColor_#1 := COLOR_INACTIVECAPTION ";" COLOR_ACTIVECAPTION ";" COLOR_MENU ";" COLOR_ACTIVECAPTION ";" COLOR_MENU ";" COLOR_ACTIVECAPTION ";"
Config_foreColor_#1 .= COLOR_INACTIVECAPTION ";" COLOR_INACTIVECAPTION ";" COLOR_INACTIVECAPTION ";" COLOR_INACTIVECAPTION ";" COLOR_INACTIVECAPTION ";" COLOR_INACTIVECAPTION Config_foreColor_#1 .= COLOR_INACTIVECAPTION ";" COLOR_ACTIVECAPTION ";" COLOR_GRADIENTINACTIVECAPTION
} }
If Not Config_foreColor_#2 If Not Config_foreColor_#2
Config_foreColor_#2 := COLOR_ACTIVECAPTION ";;;;;;" COLOR_HIGHLIGHT ";;;;;" COLOR_HIGHLIGHT Config_foreColor_#2 := COLOR_ACTIVECAPTION ";;;;;;;" COLOR_HIGHLIGHT ";" COLOR_HIGHLIGHT
If Not Config_foreColor_#3 If Not Config_foreColor_#3
Config_foreColor_#3 := ";;;;;;" COLOR_INACTIVECAPTION ";;;;;" Config_foreColor_#3 := ";;;;;;;" COLOR_INACTIVECAPTION ";"
If Not Config_fontColor_#1 If Not Config_fontColor_#1 {
Config_fontColor_#1 := COLOR_MENUTEXT ";Default;" COLOR_MENUTEXT ";Default;" COLOR_MENUTEXT ";Default;Default;Default;Default;Default;Default;Default" Config_fontColor_#1 := COLOR_INACTIVECAPTIONTEXT ";" COLOR_CAPTIONTEXT ";" COLOR_MENUTEXT ";" COLOR_CAPTIONTEXT ";" COLOR_MENUTEXT ";" COLOR_CAPTIONTEXT ";"
Config_fontColor_#1 .= COLOR_INACTIVECAPTIONTEXT ";" COLOR_CAPTIONTEXT ";" COLOR_INACTIVECAPTIONTEXT
}
If Not Config_fontColor_#2 If Not Config_fontColor_#2
Config_fontColor_#2 := COLOR_CAPTIONTEXT ";;;;;;" COLOR_INACTIVECAPTIONTEXT ";;;;;" COLOR_INACTIVECAPTIONTEXT Config_fontColor_#2 := COLOR_CAPTIONTEXT ";;;;;;;" COLOR_MENUTEXT ";" COLOR_MENUTEXT
If Not Config_fontColor_#3 If Not Config_fontColor_#3
Config_fontColor_#3 := ";;;;;;Default;;;;;" Config_fontColor_#3 := ";;;;;;;" COLOR_INACTIVECAPTIONTEXT ";"
} }
SetFormat, Integer, d SetFormat, Integer, d
@ -233,14 +231,13 @@ Config_hotkeyLabel:
Config_redirectHotkey(A_ThisHotkey) Config_redirectHotkey(A_ThisHotkey)
Return Return
Config_readinAny() Config_readinAny() {
{ ;; Add information to the variable 'text' in this function to display it in the status bar. ;; Add information to the variable 'text' in this function to display it in the status bar.
Global Config_readinDate Global Config_readinCpu, Config_readinDiskLoad, Config_readinMemoryUsage, Config_readinNetworkLoad
text := "" text := ""
text .= ResourceMonitor_getText() If (Config_readinCpu Or Config_readinDiskLoad Or Config_readinMemoryUsage Or Config_readinNetworkLoad)
If Config_readinDate text .= ResourceMonitor_getText()
text .= " " A_DDD ", " A_DD ". " A_MMM ". " A_YYYY " "
Return, text Return, text
} }

View file

@ -30,43 +30,29 @@ ResourceMonitor_cleanup() {
DllCall("CloseHandle", "UInt", ResourceMonitor_hDrive) ;; used in ResourceMonitor_getDiskLoad DllCall("CloseHandle", "UInt", ResourceMonitor_hDrive) ;; used in ResourceMonitor_getDiskLoad
} }
ResourceMonitor_getText() ResourceMonitor_getText() {
{ Global Config_readinCpu, Config_readinDiskLoad, Config_readinMemoryUsage, Config_readinNetworkLoad
Global Config_readinCpu, Config_readinDate, Config_readinDiskLoad, Config_readinMemoryUsage, Config_readinNetworkLoad, Config_readinVolume
text := "" text := ""
If Config_readinVolume
{
text .= " VOL: " ResourceMonitor_getSoundVolume() "% "
}
If Config_readinCpu If Config_readinCpu
{
If Config_readinVolume
text .= "|"
text .= " CPU: " ResourceMonitor_getSystemTimes() "% " text .= " CPU: " ResourceMonitor_getSystemTimes() "% "
} If Config_readinMemoryUsage {
If Config_readinMemoryUsage If (Config_readinCpu)
{
If (Config_readinVolume Or Config_readinCpu)
text .= "|" text .= "|"
text .= " RAM: " ResourceMonitor_getMemoryUsage() "% " text .= " RAM: " ResourceMonitor_getMemoryUsage() "% "
} }
If Config_readinDiskLoad If Config_readinDiskLoad {
{ If (Config_readinCpu Or Config_readinMemoryUsage)
If (Config_readinVolume Or Config_readinCpu Or Config_readinMemoryUsage)
text .= "|" text .= "|"
ResourceMonitor_getDiskLoad(rLoad, wLoad) ResourceMonitor_getDiskLoad(rLoad, wLoad)
text .= " Dr: " rLoad "% | Dw: " wLoad "% " text .= " Dr: " rLoad "% | Dw: " wLoad "% "
} }
If Config_readinNetworkLoad If Config_readinNetworkLoad {
{ If (Config_readinCpu Or Config_readinMemoryUsage Or Config_readinDiskLoad)
If (Config_readinVolume Or Config_readinCpu Or Config_readinMemoryUsage Or Config_readinDiskLoad)
text .= "|" text .= "|"
ResourceMonitor_getNetworkLoad(upLoad, dnLoad) ResourceMonitor_getNetworkLoad(upLoad, dnLoad)
text .= " UP: " upLoad " KB/s | dn: " dnLoad " KB/s " text .= " UP: " upLoad " KB/s | dn: " dnLoad " KB/s "
} }
If Config_readinDate And (Config_readinVolume Or Config_readinCpu Or Config_readinMemoryUsage Or Config_readinDiskLoad Or Config_readinNetworkLoad)
text .= "|"
Return, text Return, text
} }
@ -93,8 +79,7 @@ ResourceMonitor_getBatteryStatus(ByRef batteryLifePercent, ByRef acLineStatus) {
} }
;; PhiLho: AC/Battery status (http://www.autohotkey.com/forum/topic7633.html) ;; PhiLho: AC/Battery status (http://www.autohotkey.com/forum/topic7633.html)
ResourceMonitor_getDiskLoad(ByRef readLoad, ByRef writeLoad) ResourceMonitor_getDiskLoad(ByRef readLoad, ByRef writeLoad) {
{
Global ResourceMonitor_hDrive Global ResourceMonitor_hDrive
Static oldReadCount, oldWriteCount Static oldReadCount, oldWriteCount
@ -112,8 +97,7 @@ ResourceMonitor_getDiskLoad(ByRef readLoad, ByRef writeLoad)
;; fures: System + Network monitor - with net history graph (http://www.autohotkey.com/community/viewtopic.php?p=260329) ;; fures: System + Network monitor - with net history graph (http://www.autohotkey.com/community/viewtopic.php?p=260329)
;; SKAN: HDD Activity Monitoring LED (http://www.autohotkey.com/community/viewtopic.php?p=113890&sid=64d9824fdf252697ff4d5026faba91f8#p113890) ;; SKAN: HDD Activity Monitoring LED (http://www.autohotkey.com/community/viewtopic.php?p=113890&sid=64d9824fdf252697ff4d5026faba91f8#p113890)
ResourceMonitor_getMemoryUsage() ResourceMonitor_getMemoryUsage() {
{
VarSetCapacity(memoryStatus, 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4) VarSetCapacity(memoryStatus, 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4)
DllCall("kernel32.dll\GlobalMemoryStatus", "UInt", &memoryStatus) DllCall("kernel32.dll\GlobalMemoryStatus", "UInt", &memoryStatus)
Return, SubStr(" " Round(*(&memoryStatus + 4)), -2) ;; LS byte is enough, 0..100 Return, SubStr(" " Round(*(&memoryStatus + 4)), -2) ;; LS byte is enough, 0..100
@ -129,8 +113,7 @@ ResourceMonitor_getNetworkInterface() {
} }
;; Pillus: System monitor (HDD/Wired/Wireless) using keyboard LEDs (http://www.autohotkey.com/board/topic/65308-system-monitor-hddwiredwireless-using-keyboard-leds/) ;; Pillus: System monitor (HDD/Wired/Wireless) using keyboard LEDs (http://www.autohotkey.com/board/topic/65308-system-monitor-hddwiredwireless-using-keyboard-leds/)
ResourceMonitor_getNetworkLoad(ByRef upLoad, ByRef dnLoad) ResourceMonitor_getNetworkLoad(ByRef upLoad, ByRef dnLoad) {
{
Global ResourceMonitor_networkInterface Global ResourceMonitor_networkInterface
ResourceMonitor_networkInterface.Refresh_ ResourceMonitor_networkInterface.Refresh_
@ -139,20 +122,8 @@ ResourceMonitor_getNetworkLoad(ByRef upLoad, ByRef dnLoad)
} }
;; Pillus: System monitor (HDD/Wired/Wireless) using keyboard LEDs (http://www.autohotkey.com/board/topic/65308-system-monitor-hddwiredwireless-using-keyboard-leds/) ;; Pillus: System monitor (HDD/Wired/Wireless) using keyboard LEDs (http://www.autohotkey.com/board/topic/65308-system-monitor-hddwiredwireless-using-keyboard-leds/)
ResourceMonitor_getSoundVolume() { ResourceMonitor_getSystemTimes() {
SoundGet, volume, MASTER, VOLUME ;; Total CPU Load
SoundGet, mute, MASTER, MUTE
text := ""
If mute = On
text .= "m"
Else
text .= " "
text .= SubStr(" " Round(volume), -2)
Return, text
}
ResourceMonitor_getSystemTimes()
{ ;; Total CPU Load
Static oldIdleTime, oldKrnlTime, oldUserTime Static oldIdleTime, oldKrnlTime, oldUserTime
Static newIdleTime, newKrnlTime, newUserTime Static newIdleTime, newKrnlTime, newUserTime