Added Config_readinVolume

... and associated code
This commit is contained in:
joten 2014-10-01 23:20:32 +02:00
parent 1b6133b3fd
commit 804e28cb22
5 changed files with 32 additions and 5 deletions

Binary file not shown.

View file

@ -14,6 +14,7 @@ periodically so that it may be recovered after a restart.
3. `+` Manual tiling. 3. `+` Manual tiling.
4. `+` Increasing MFactor Resizing Over Time 4. `+` Increasing MFactor Resizing Over Time
5. `+` Bar transparency 5. `+` Bar transparency
6. `+` Reading in the sound volume and mute status and displaying it in the status bar.
| # | Configuration variables | Hotkeys | | # | Configuration variables | Hotkeys |
| ---:| --------------------------------- | ----------------------------------------------- | | ---:| --------------------------------- | ----------------------------------------------- |
@ -27,6 +28,7 @@ periodically so that it may be recovered after a restart.
| | | `!+y::View_traceAreas()` | | | | `!+y::View_traceAreas()` |
| 4. | `Config_mFactCallInterval=700` | `View_setMFactor(d, dFact=1)` | | 4. | `Config_mFactCallInterval=700` | `View_setMFactor(d, dFact=1)` |
| 5. | `Config_barTransparency=off` | | | 5. | `Config_barTransparency=off` | |
| 6. | `Config_readinVolume` | |
### 8.3.0 ### 8.3.0

View file

@ -110,6 +110,10 @@ and displayed in the status bar.
> If true (`=1`), the current time is read in (format: "HH:MM") and displayed in > If true (`=1`), the current time is read in (format: "HH:MM") and displayed in
the status bar. the status bar.
`Config_readinVolume=0`
> If true (`=1`), the current sound volume is read in
(format: "VOL: <mute> <volume percentage>") and displayed in the status bar.
`Config_readinInterval=30000` `Config_readinInterval=30000`
> Time in milliseconds after which the above status values are refreshed. > Time in milliseconds after which the above status values are refreshed.

View file

@ -45,6 +45,7 @@ Config_init()
Config_readinMemoryUsage := False Config_readinMemoryUsage := False
Config_readinNetworkLoad := False Config_readinNetworkLoad := False
Config_readinTime := True Config_readinTime := True
Config_readinVolume := False
Config_readinInterval := 30000 Config_readinInterval := 30000
;; Windows ui elements ;; Windows ui elements

View file

@ -37,32 +37,40 @@ ResourceMonitor_cleanup() {
ResourceMonitor_getText() ResourceMonitor_getText()
{ {
Global Config_readinCpu, Config_readinDate, 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_readinCpu Or Config_readinMemoryUsage Or Config_readinDiskLoad Or Config_readinNetworkLoad) If Config_readinDate And (Config_readinVolume Or Config_readinCpu Or Config_readinMemoryUsage Or Config_readinDiskLoad Or Config_readinNetworkLoad)
text .= "|" text .= "|"
Return, text Return, text
@ -114,6 +122,18 @@ 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() {
SoundGet, volume, MASTER, VOLUME
SoundGet, mute, MASTER, MUTE
text := ""
If mute = On
text .= "m"
Else
text .= " "
text .= SubStr(" " Round(volume), -2)
Return, text
}
ResourceMonitor_getSystemTimes() ResourceMonitor_getSystemTimes()
{ ;; Total CPU Load { ;; Total CPU Load
Static oldIdleTime, oldKrnlTime, oldUserTime Static oldIdleTime, oldKrnlTime, oldUserTime