This commit is contained in:
Cynthia Foxwell 2022-09-23 22:07:07 -06:00
parent 0f6580b372
commit 60b361b7bd
4 changed files with 52 additions and 48 deletions

View file

@ -31,7 +31,7 @@ Bar_init(m) {
Monitor_#%m%_barWidth := wndWidth
titleWidth := wndWidth
h1 := Bar_ctrlHeight
x1 := 0
x1 := Config_barItemSpacing
x2 := wndWidth
y1 := 0
y2 := (Bar_ctrlHeight - Bar_textHeight) / 2
@ -49,16 +49,16 @@ Bar_init(m) {
;; Views
Loop, % Config_viewCount {
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)
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)
titleWidth -= w
x1 += w
x1 += w + Config_barItemSpacing
}
;; Layout
w := Bar_getTextWidth(" ?????? ")
Bar_addElement(m, "layout", " ?????? ", x1, y1, w, Config_backColor_#1_#2, Config_foreColor_#1_#2, Config_fontColor_#1_#2)
w := Bar_getTextWidth("??????")
Bar_addElement(m, "layout", "??????", x1, y1, w, Config_backColor_#1_#2, Config_foreColor_#1_#2, Config_fontColor_#1_#2)
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.
;; <view>;<layout>;<title>;<shebang>;<time>;<date>;<anyText>;<battery>;<volumeLevel>
@ -81,7 +81,7 @@ Bar_init(m) {
If Config_readinVolume {
color .= ";9"
id .= ";volume"
text .= ";VOL: ???%"
text .= ";???%"
}
If Config_readinRam {
color .= ";6"
@ -96,7 +96,7 @@ Bar_init(m) {
If Config_readinBat {
color .= ";8"
id .= ";battery"
text .= ";BAT: ???%"
text .= ";???%"
}
If Config_readinMusic {
color .= ";10"
@ -479,7 +479,7 @@ Bar_updateStatus() {
Gui, %GuiN%: Default
statusWidth := Monitor_#%m%_barWidth
statusWidth -= %Config_barItemSpacing%
statusWidth -= Config_barItemSpacing
If Config_readinTime {
If Config_readinTimeBinary {
@ -514,7 +514,7 @@ Bar_updateStatus() {
GuiControl, Move, Bar_#%m%_time_event, % "w" textWidth " x" statusWidth
;GuiControl, Move, Bar_#%m%_time_highlighted, % "w" textWidth " x" statusWidth
statusWidth -= %Config_barIconSpacing%
statusWidth -= Config_barIconSpacing
If (Config_combineDateAndTime) {
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_highlighted, % "w" iconWidth " x" statusWidth
statusWidth -= %Config_barItemSpacing%
statusWidth -= Config_barItemSpacing
}
If Config_readinDate And !Config_combineDateAndTime {
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_highlighted, % "w" textWidth " x" statusWidth
statusWidth -= %Config_barIconSpacing%
statusWidth -= Config_barIconSpacing
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_date_icon_hwnd, Config_barIcon_#2)
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_highlighted, % "w" iconWidth " x" statusWidth
statusWidth -= %Config_barItemSpacing%
statusWidth -= Config_barItemSpacing
}
If Config_readinVolume {
If (mute = "On") {
@ -585,7 +585,7 @@ Bar_updateStatus() {
GuiControl, Move, Bar_#%m%_volume_event, % "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)
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_highlighted, % "w" iconWidth " x" statusWidth
statusWidth -= %Config_barItemSpacing%
statusWidth -= Config_barItemSpacing
}
If Config_readinRam {
text := ResourceMonitor_getRamText()
@ -607,7 +607,7 @@ Bar_updateStatus() {
GuiControl, Move, Bar_#%m%_ram_event, % "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)
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_highlighted, % "w" iconWidth " x" statusWidth
statusWidth -= %Config_barItemSpacing%
statusWidth -= Config_barItemSpacing
}
If Config_readinCpu {
text := ResourceMonitor_getCpuText()
@ -629,7 +629,7 @@ Bar_updateStatus() {
GuiControl, Move, Bar_#%m%_cpu_event, % "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)
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_highlighted, % "w" iconWidth " x" statusWidth
statusWidth -= %Config_barItemSpacing%
statusWidth -= Config_barItemSpacing
}
If Config_readinBat {
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_highlighted, % "w" textWidth " x" statusWidth
statusWidth -= %Config_barIconSpacing%
statusWidth -= Config_barIconSpacing
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_battery_icon_hwnd, Config_barIcon_#5)
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_highlighted, % "w" iconWidth " x" statusWidth
statusWidth -= %Config_barItemSpacing%
statusWidth -= Config_barItemSpacing
}
If Config_readinMusic {
text := MusicBee_GetNowPlaying()
@ -686,7 +686,7 @@ Bar_updateStatus() {
GuiControl, Move, Bar_#%m%_music_event, % "w" textWidth " x" statusWidth
;GuiControl, Move, Bar_#%m%_music_highlighted, % "w" textWidth " x" statusWidth
statusWidth -= %Config_barIconSpacing%
statusWidth -= Config_barIconSpacing
if (text == "") {
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_highlighted, % "w" iconWidth " x" statusWidth
statusWidth -= %Config_barItemSpacing%
statusWidth -= Config_barItemSpacing
}
}
}
@ -719,12 +719,10 @@ Bar_updateTitle() {
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 . " ... "
;}
if (StrLen(title) > 48) {
;; Shorten the window title if its length exceeds the width of the bar
title := SubStr(title, 1, 48) . ""
}
StringReplace, title, title, &, &&, All ;; Special character '&', which would underline the next letter.
@ -772,6 +770,10 @@ Bar_updateView(m, v) {
Loop, % Config_viewCount {
StringTrimRight, wndIds, View_#%m%_#%A_Index%_wndIds, 1
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%, % Config_viewNames_#%A_Index% ;; Refresh the number on the bar.
}

View file

@ -82,6 +82,7 @@ Config_init() {
Config_syncMonitorViews := 0
Config_viewFollowsTagged := False
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_#1 := ".*;.*;;1;0;0;0;0;0;"
@ -111,13 +112,13 @@ Config_init() {
Config_hotkeyCount := 0
Config_restoreConfig(Config_filePath)
If (SubStr(A_OSVersion, 1, 3) = "10.") {
Config_borderWidth := 0
Config_borderPadding := -1
Config_showBorder := True
Config_selBorderColor := ""
}
;If (SubStr(A_OSVersion, 1, 3) = "10.") {
; Config_borderWidth := 0
; Config_borderPadding := -1
; Config_showBorder := True
; Config_selBorderColor := ""
;}
Config_getSystemSettings()
Config_initColors()
Config_initBarIcons()
@ -173,7 +174,7 @@ Config_convertSystemColor(systemColor)
Config_edit() {
Global Config_filePath
If Not FileExist(Config_filePath)
Config_UI_saveSession()
Run, edit %Config_filePath%

View file

@ -191,5 +191,5 @@ Return
#Include Tiler.ahk
#Include View.ahk
#Include Window.ahk
#Include %A_ScriptDir%\MonitorManager.ahk
#Include %A_ScriptDir%\MusicBee.ahk
#Include MonitorManager.ahk
#Include MusicBee.ahk

View file

@ -248,7 +248,7 @@ Manager_getWindowList()
Manager_getWindowRule(wndId) {
Local rule, wndMinMax
rule := ""
WinGet, wndMinMax, MinMax, ahk_id %wndId%
If InStr(Manager_managedWndIds, wndId ";") {
@ -277,7 +277,7 @@ Manager_getWindowRule(wndId) {
rule .= "0;"
If (wndMinMax = 1)
rule .= "maximize"
Return, rule
}
@ -327,8 +327,9 @@ Manager__setWinProperties(wndId, isManaged, m, tags, isDecorated, isFloating, hi
If Not Config_showBorder
Window_set(wndId, "Style", "-0x40000")
If Not Window_#%wndId%_isDecorated
if (not Window_#%wndId%_isDecorated and Config_hideTitleBars) {
Window_set(wndId, "Style", "-0xC00000")
}
a := Window_#%wndId%_tags & (1 << (Monitor_#%m%_aView_#1 - 1))
If a {
@ -454,7 +455,7 @@ Manager_moveWindow() {
Manager_onDisplayChange(a, wParam, uMsg, lParam) {
Local doChange := (Config_monitorDisplayChangeMessages = "on")
Debug_logMessage("DEBUG[1] Manager_onDisplayChange( a: " . a . ", uMsg: " . uMsg . ", wParam: " . wParam . ", lParam: " . lParam . " )", 1)
If !(Config_monitorDisplayChangeMessages = "on" || Config_monitorDisplayChangeMessages = "off" || Config_monitorDisplayChangeMessages = 0) {
MsgBox, 291, , % "Would you like to reset the monitor configuration?`n'No' will only rearrange all active views.`n'Cancel' will result in no change."
@ -663,7 +664,7 @@ Manager_onShellMessage(wParam, lParam) {
Manager_override(rule = "") {
Local aWndId, aWndMinMax
WinGet, aWndId, ID, A
If (rule = "") {
rule := Manager_getWindowRule(aWndId)
@ -679,7 +680,7 @@ Manager_override(rule = "") {
Manager_registerShellHook() {
Global Config_monitorDisplayChangeMessages
WM_DISPLAYCHANGE := 126 ;; This message is sent when the display resolution has changed.
Gui, +LastFound
hWnd := WinExist()
@ -1220,7 +1221,7 @@ Manager_unmanage(wndId) {
Manager_winActivate(wndId) {
Global Manager_aMonitor
Manager_setCursor(wndId)
Debug_logMessage("DEBUG[1] Activating window: " wndId, 1)
If Not wndId {
@ -1248,4 +1249,4 @@ Manager_activateViewByMouse(d) {
if( InStr(windowTitle, "bug.n_BAR_") = 1 ) {
Monitor_activateView(0, d)
}
}
}