.
This commit is contained in:
parent
0f6580b372
commit
60b361b7bd
4 changed files with 52 additions and 48 deletions
62
src/Bar.ahk
62
src/Bar.ahk
|
@ -31,7 +31,7 @@ Bar_init(m) {
|
||||||
Monitor_#%m%_barWidth := wndWidth
|
Monitor_#%m%_barWidth := wndWidth
|
||||||
titleWidth := wndWidth
|
titleWidth := wndWidth
|
||||||
h1 := Bar_ctrlHeight
|
h1 := Bar_ctrlHeight
|
||||||
x1 := 0
|
x1 := Config_barItemSpacing
|
||||||
x2 := wndWidth
|
x2 := wndWidth
|
||||||
y1 := 0
|
y1 := 0
|
||||||
y2 := (Bar_ctrlHeight - Bar_textHeight) / 2
|
y2 := (Bar_ctrlHeight - Bar_textHeight) / 2
|
||||||
|
@ -49,16 +49,16 @@ Bar_init(m) {
|
||||||
|
|
||||||
;; Views
|
;; Views
|
||||||
Loop, % Config_viewCount {
|
Loop, % Config_viewCount {
|
||||||
w := Bar_getTextWidth(" " Config_viewNames_#%A_Index% " ")
|
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)
|
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)
|
||||||
titleWidth -= w
|
titleWidth -= w
|
||||||
x1 += w
|
x1 += w + Config_barItemSpacing
|
||||||
}
|
}
|
||||||
;; Layout
|
;; Layout
|
||||||
w := Bar_getTextWidth(" ?????? ")
|
w := Bar_getTextWidth("??????")
|
||||||
Bar_addElement(m, "layout", " ?????? ", x1, y1, w, Config_backColor_#1_#2, Config_foreColor_#1_#2, Config_fontColor_#1_#2)
|
Bar_addElement(m, "layout", "??????", x1, y1, w, Config_backColor_#1_#2, Config_foreColor_#1_#2, Config_fontColor_#1_#2)
|
||||||
titleWidth -= w
|
titleWidth -= w
|
||||||
x1 += w
|
x1 += w + Config_barItemSpacing
|
||||||
|
|
||||||
;; 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.
|
||||||
;; <view>;<layout>;<title>;<shebang>;<time>;<date>;<anyText>;<battery>;<volumeLevel>
|
;; <view>;<layout>;<title>;<shebang>;<time>;<date>;<anyText>;<battery>;<volumeLevel>
|
||||||
|
@ -81,7 +81,7 @@ Bar_init(m) {
|
||||||
If Config_readinVolume {
|
If Config_readinVolume {
|
||||||
color .= ";9"
|
color .= ";9"
|
||||||
id .= ";volume"
|
id .= ";volume"
|
||||||
text .= ";VOL: ???%"
|
text .= ";???%"
|
||||||
}
|
}
|
||||||
If Config_readinRam {
|
If Config_readinRam {
|
||||||
color .= ";6"
|
color .= ";6"
|
||||||
|
@ -96,7 +96,7 @@ Bar_init(m) {
|
||||||
If Config_readinBat {
|
If Config_readinBat {
|
||||||
color .= ";8"
|
color .= ";8"
|
||||||
id .= ";battery"
|
id .= ";battery"
|
||||||
text .= ";BAT: ???%"
|
text .= ";???%"
|
||||||
}
|
}
|
||||||
If Config_readinMusic {
|
If Config_readinMusic {
|
||||||
color .= ";10"
|
color .= ";10"
|
||||||
|
@ -479,7 +479,7 @@ Bar_updateStatus() {
|
||||||
Gui, %GuiN%: Default
|
Gui, %GuiN%: Default
|
||||||
|
|
||||||
statusWidth := Monitor_#%m%_barWidth
|
statusWidth := Monitor_#%m%_barWidth
|
||||||
statusWidth -= %Config_barItemSpacing%
|
statusWidth -= Config_barItemSpacing
|
||||||
|
|
||||||
If Config_readinTime {
|
If Config_readinTime {
|
||||||
If Config_readinTimeBinary {
|
If Config_readinTimeBinary {
|
||||||
|
@ -514,7 +514,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_time_event, % "w" textWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_time_event, % "w" textWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_time_highlighted, % "w" textWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_time_highlighted, % "w" textWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barIconSpacing%
|
statusWidth -= Config_barIconSpacing
|
||||||
|
|
||||||
If (Config_combineDateAndTime) {
|
If (Config_combineDateAndTime) {
|
||||||
If (Bar_TimeDateState == 0) {
|
If (Bar_TimeDateState == 0) {
|
||||||
|
@ -540,7 +540,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_time_icon_event, % "w" iconWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_time_icon_event, % "w" iconWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_time_icon_highlighted, % "w" iconWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_time_icon_highlighted, % "w" iconWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barItemSpacing%
|
statusWidth -= Config_barItemSpacing
|
||||||
}
|
}
|
||||||
If Config_readinDate And !Config_combineDateAndTime {
|
If Config_readinDate And !Config_combineDateAndTime {
|
||||||
FormatTime, time, , % Config_readinDateFormat
|
FormatTime, time, , % Config_readinDateFormat
|
||||||
|
@ -552,7 +552,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_date_event, % "w" textWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_date_event, % "w" textWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_date_highlighted, % "w" textWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_date_highlighted, % "w" textWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barIconSpacing%
|
statusWidth -= Config_barIconSpacing
|
||||||
|
|
||||||
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_date_icon_hwnd, Config_barIcon_#2)
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_date_icon_hwnd, Config_barIcon_#2)
|
||||||
statusWidth -= iconWidth
|
statusWidth -= iconWidth
|
||||||
|
@ -562,7 +562,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_date_icon_event, % "w" iconWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_date_icon_event, % "w" iconWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_date_icon_highlighted, % "w" iconWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_date_icon_highlighted, % "w" iconWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barItemSpacing%
|
statusWidth -= Config_barItemSpacing
|
||||||
}
|
}
|
||||||
If Config_readinVolume {
|
If Config_readinVolume {
|
||||||
If (mute = "On") {
|
If (mute = "On") {
|
||||||
|
@ -585,7 +585,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_volume_event, % "w" textWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_volume_event, % "w" textWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_volume_highlighted, % "w" textWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_volume_highlighted, % "w" textWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barIconSpacing%
|
statusWidth -= Config_barIconSpacing
|
||||||
|
|
||||||
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_volume_icon_hwnd, Config_barIcon_#6)
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_volume_icon_hwnd, Config_barIcon_#6)
|
||||||
statusWidth -= iconWidth
|
statusWidth -= iconWidth
|
||||||
|
@ -595,7 +595,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_volume_icon_event, % "w" iconWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_volume_icon_event, % "w" iconWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_volume_icon_highlighted, % "w" iconWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_volume_icon_highlighted, % "w" iconWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barItemSpacing%
|
statusWidth -= Config_barItemSpacing
|
||||||
}
|
}
|
||||||
If Config_readinRam {
|
If Config_readinRam {
|
||||||
text := ResourceMonitor_getRamText()
|
text := ResourceMonitor_getRamText()
|
||||||
|
@ -607,7 +607,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_ram_event, % "w" textWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_ram_event, % "w" textWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_ram_highlighted, % "w" textWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_ram_highlighted, % "w" textWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barIconSpacing%
|
statusWidth -= Config_barIconSpacing
|
||||||
|
|
||||||
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_ram_icon_hwnd, Config_barIcon_#3)
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_ram_icon_hwnd, Config_barIcon_#3)
|
||||||
statusWidth -= iconWidth
|
statusWidth -= iconWidth
|
||||||
|
@ -617,7 +617,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_ram_icon_event, % "w" iconWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_ram_icon_event, % "w" iconWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_ram_icon_highlighted, % "w" iconWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_ram_icon_highlighted, % "w" iconWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barItemSpacing%
|
statusWidth -= Config_barItemSpacing
|
||||||
}
|
}
|
||||||
If Config_readinCpu {
|
If Config_readinCpu {
|
||||||
text := ResourceMonitor_getCpuText()
|
text := ResourceMonitor_getCpuText()
|
||||||
|
@ -629,7 +629,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_cpu_event, % "w" textWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_cpu_event, % "w" textWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_cpu_highlighted, % "w" textWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_cpu_highlighted, % "w" textWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barIconSpacing%
|
statusWidth -= Config_barIconSpacing
|
||||||
|
|
||||||
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_cpu_icon_hwnd, Config_barIcon_#4)
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_cpu_icon_hwnd, Config_barIcon_#4)
|
||||||
statusWidth -= iconWidth
|
statusWidth -= iconWidth
|
||||||
|
@ -639,7 +639,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_cpu_icon_event, % "w" iconWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_cpu_icon_event, % "w" iconWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_cpu_icon_highlighted, % "w" iconWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_cpu_icon_highlighted, % "w" iconWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barItemSpacing%
|
statusWidth -= Config_barItemSpacing
|
||||||
}
|
}
|
||||||
If Config_readinBat {
|
If Config_readinBat {
|
||||||
If (bat1 < 10) And (bat2 = "off") {
|
If (bat1 < 10) And (bat2 = "off") {
|
||||||
|
@ -664,7 +664,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_battery_event, % "w" textWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_battery_event, % "w" textWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_battery_highlighted, % "w" textWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_battery_highlighted, % "w" textWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barIconSpacing%
|
statusWidth -= Config_barIconSpacing
|
||||||
|
|
||||||
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_battery_icon_hwnd, Config_barIcon_#5)
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_battery_icon_hwnd, Config_barIcon_#5)
|
||||||
statusWidth -= iconWidth
|
statusWidth -= iconWidth
|
||||||
|
@ -674,7 +674,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_battery_icon_event, % "w" iconWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_battery_icon_event, % "w" iconWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_battery_icon_highlighted, % "w" iconWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_battery_icon_highlighted, % "w" iconWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barItemSpacing%
|
statusWidth -= Config_barItemSpacing
|
||||||
}
|
}
|
||||||
If Config_readinMusic {
|
If Config_readinMusic {
|
||||||
text := MusicBee_GetNowPlaying()
|
text := MusicBee_GetNowPlaying()
|
||||||
|
@ -686,7 +686,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_music_event, % "w" textWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_music_event, % "w" textWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_music_highlighted, % "w" textWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_music_highlighted, % "w" textWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barIconSpacing%
|
statusWidth -= Config_barIconSpacing
|
||||||
|
|
||||||
if (text == "") {
|
if (text == "") {
|
||||||
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_music_icon_hwnd, "")
|
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_music_icon_hwnd, "")
|
||||||
|
@ -700,7 +700,7 @@ Bar_updateStatus() {
|
||||||
GuiControl, Move, Bar_#%m%_music_icon_event, % "w" iconWidth " x" statusWidth
|
GuiControl, Move, Bar_#%m%_music_icon_event, % "w" iconWidth " x" statusWidth
|
||||||
;GuiControl, Move, Bar_#%m%_music_icon_highlighted, % "w" iconWidth " x" statusWidth
|
;GuiControl, Move, Bar_#%m%_music_icon_highlighted, % "w" iconWidth " x" statusWidth
|
||||||
|
|
||||||
statusWidth -= %Config_barItemSpacing%
|
statusWidth -= Config_barItemSpacing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -719,12 +719,10 @@ Bar_updateTitle() {
|
||||||
|
|
||||||
title := aWndTitle
|
title := aWndTitle
|
||||||
|
|
||||||
;If (Bar_getTextWidth(title) > 768) {
|
if (StrLen(title) > 48) {
|
||||||
; ;; Shorten the window title if its length exceeds the width of the bar
|
;; Shorten the window title if its length exceeds the width of the bar
|
||||||
; i := Bar_getTextWidth(Bar_#%Manager_aMonitor%_titleWidth, True) - 6
|
title := SubStr(title, 1, 48) . "…"
|
||||||
; StringLeft, title, aWndTitle, i
|
}
|
||||||
; title := " " . title . " ... "
|
|
||||||
;}
|
|
||||||
StringReplace, title, title, &, &&, All ;; Special character '&', which would underline the next letter.
|
StringReplace, title, title, &, &&, All ;; Special character '&', which would underline the next letter.
|
||||||
|
|
||||||
|
|
||||||
|
@ -772,6 +770,10 @@ Bar_updateView(m, v) {
|
||||||
Loop, % Config_viewCount {
|
Loop, % Config_viewCount {
|
||||||
StringTrimRight, wndIds, View_#%m%_#%A_Index%_wndIds, 1
|
StringTrimRight, wndIds, View_#%m%_#%A_Index%_wndIds, 1
|
||||||
StringSplit, wndId, wndIds, `;
|
StringSplit, wndId, wndIds, `;
|
||||||
|
TagPercent := wndId0 / managedWndId0 * 100
|
||||||
|
If (TagPercent > 0 and v != A_Index) {
|
||||||
|
GuiControl, +c%Config_fontColor_#3_#1%, Bar_#%m%_view_#%A_Index%
|
||||||
|
}
|
||||||
;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.
|
GuiControl, , Bar_#%m%_view_#%A_Index%, % Config_viewNames_#%A_Index% ;; Refresh the number on the bar.
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,7 @@ Config_init() {
|
||||||
Config_syncMonitorViews := 0
|
Config_syncMonitorViews := 0
|
||||||
Config_viewFollowsTagged := False
|
Config_viewFollowsTagged := False
|
||||||
Config_viewMargins := "0;0;0;0"
|
Config_viewMargins := "0;0;0;0"
|
||||||
|
Config_hideTitleBars := True
|
||||||
|
|
||||||
;; Config_rule_#<i> := "<class>;<title>;<function name>;<is managed>;<m>;<tags>;<is floating>;<is decorated>;<hide title>;<action>"
|
;; Config_rule_#<i> := "<class>;<title>;<function name>;<is managed>;<m>;<tags>;<is floating>;<is decorated>;<hide title>;<action>"
|
||||||
Config_rule_#1 := ".*;.*;;1;0;0;0;0;0;"
|
Config_rule_#1 := ".*;.*;;1;0;0;0;0;0;"
|
||||||
|
@ -111,12 +112,12 @@ Config_init() {
|
||||||
|
|
||||||
Config_hotkeyCount := 0
|
Config_hotkeyCount := 0
|
||||||
Config_restoreConfig(Config_filePath)
|
Config_restoreConfig(Config_filePath)
|
||||||
If (SubStr(A_OSVersion, 1, 3) = "10.") {
|
;If (SubStr(A_OSVersion, 1, 3) = "10.") {
|
||||||
Config_borderWidth := 0
|
; Config_borderWidth := 0
|
||||||
Config_borderPadding := -1
|
; Config_borderPadding := -1
|
||||||
Config_showBorder := True
|
; Config_showBorder := True
|
||||||
Config_selBorderColor := ""
|
; Config_selBorderColor := ""
|
||||||
}
|
;}
|
||||||
|
|
||||||
Config_getSystemSettings()
|
Config_getSystemSettings()
|
||||||
Config_initColors()
|
Config_initColors()
|
||||||
|
|
|
@ -191,5 +191,5 @@ Return
|
||||||
#Include Tiler.ahk
|
#Include Tiler.ahk
|
||||||
#Include View.ahk
|
#Include View.ahk
|
||||||
#Include Window.ahk
|
#Include Window.ahk
|
||||||
#Include %A_ScriptDir%\MonitorManager.ahk
|
#Include MonitorManager.ahk
|
||||||
#Include %A_ScriptDir%\MusicBee.ahk
|
#Include MusicBee.ahk
|
||||||
|
|
|
@ -327,8 +327,9 @@ Manager__setWinProperties(wndId, isManaged, m, tags, isDecorated, isFloating, hi
|
||||||
|
|
||||||
If Not Config_showBorder
|
If Not Config_showBorder
|
||||||
Window_set(wndId, "Style", "-0x40000")
|
Window_set(wndId, "Style", "-0x40000")
|
||||||
If Not Window_#%wndId%_isDecorated
|
if (not Window_#%wndId%_isDecorated and Config_hideTitleBars) {
|
||||||
Window_set(wndId, "Style", "-0xC00000")
|
Window_set(wndId, "Style", "-0xC00000")
|
||||||
|
}
|
||||||
|
|
||||||
a := Window_#%wndId%_tags & (1 << (Monitor_#%m%_aView_#1 - 1))
|
a := Window_#%wndId%_tags & (1 << (Monitor_#%m%_aView_#1 - 1))
|
||||||
If a {
|
If a {
|
||||||
|
|
Loading…
Reference in a new issue