From c863a66fa06e644522bdc7f4d901530218b97994 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Wed, 1 Mar 2023 20:55:50 -0700 Subject: [PATCH] in taskbar changes --- src/Bar.ahk | 60 +++++++++++++++++++++++++++++++++++++++----------- src/Config.ahk | 1 + src/Main.ahk | 7 ++++++ 3 files changed, 55 insertions(+), 13 deletions(-) diff --git a/src/Bar.ahk b/src/Bar.ahk index fc41067..a271671 100644 --- a/src/Bar.ahk +++ b/src/Bar.ahk @@ -119,7 +119,15 @@ Bar_init(m) { 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) + If (Config_verticalBarPos = "tray" And Monitor_#%m%_taskBarClass) { + trayWndId := WinExist("ahk_class " Monitor_#%m%_taskBarClass) + ControlGet, TrayRoot, Hwnd, , TrayNotifyWnd1, ahk_id %trayWndId% + + DllCall("SetParent", "UInt", HwndBar_#%m%_%elemId%_hwnd, "UInt", TrayRoot) + DllCall("SetParent", "UInt", HwndBar_#%m%_%iconId%_hwnd, "UInt", TrayRoot) + } GuiControl, -Center, Bar_#%m%_%elemId% + GuiControl, -Center, Bar_#%m%_%iconId% } ;; Window title (remaining space) @@ -129,7 +137,8 @@ Bar_init(m) { y1 += h1 y2 += h1 } - Bar_addElement(m, "title", "", x1, y1, titleWidth, Config_backColor_#1_#3, Config_foreColor_#1_#3, Config_fontColor_#1_#3) + If Config_readinTitle + Bar_addElement(m, "title", "", x1, y1, titleWidth, Config_backColor_#1_#3, Config_foreColor_#1_#3, Config_fontColor_#1_#3) If (Config_horizontalBarPos = "left") x1 := 0 @@ -158,7 +167,17 @@ Bar_init(m) { Bar_appBarData := "" If (Config_verticalBarPos = "tray" And Monitor_#%m%_taskBarClass) { trayWndId := WinExist("ahk_class " Monitor_#%m%_taskBarClass) - DllCall("SetParent", "UInt", wndId, "UInt", trayWndId) + ControlGet, ToolbarRoot, Hwnd, , ReBarWindow321, ahk_id %trayWndId% + ControlGet, Toolbar, Hwnd, , ToolbarWindow321, ahk_id %ToolbarRoot% + DllCall("SetParent", "UInt", wndId, "UInt", Toolbar) + ;Gui, Color, 000000, %wndTitle% + + WinSet, Style, -0x40000, ahk_id %trayWndId% ; WS_THICKFRAME + WinSet, Style, +0x80, ahk_id %trayWndId% ; DS_MODALFRAME + WinSet, Style, +0x0004, ahk_id %trayWndId% ; DS_3DLOOK + + WinSet, ExStyle, +0x1, ahk_id %trayWndId% ; WS_EX_DLGMODALFRAME + WinSet, ExStyle, +0x20000, ahk_id %trayWndId% ; WS_EX_STATICEDGE } Else { appBarMsg := DllCall("RegisterWindowMessage", Str, "AppBarMsg") @@ -285,6 +304,9 @@ Bar_getHeight() Bar_ctrlHeight := Bar_height If Not Config_singleRowBar Bar_ctrlHeight := Bar_height / 2 + + Bar_height := 22 + Bar_ctrlHeight := 22 } } @@ -702,6 +724,16 @@ Bar_updateStatus() { statusWidth -= Config_barItemSpacing } + + If (Config_verticalBarPos = "tray" And Monitor_#%m%_taskBarClass) { + trayWndId := WinExist("ahk_class " Monitor_#%m%_taskBarClass) + WinSet, Style, -0x40000, ahk_id %trayWndId% ; WS_THICKFRAME + WinSet, Style, +0x80, ahk_id %trayWndId% ; DS_MODALFRAME + WinSet, Style, +0x0004, ahk_id %trayWndId% ; DS_3DLOOK + + WinSet, ExStyle, +0x1, ahk_id %trayWndId% ; WS_EX_DLGMODALFRAME + WinSet, ExStyle, +0x20000, ahk_id %trayWndId% ; WS_EX_STATICEDGE + } } } @@ -732,17 +764,19 @@ Bar_updateTitle() { 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, 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, + If (Config_readinTitle) { + 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, 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, + } } Bar_aWndId := aWndId } diff --git a/src/Config.ahk b/src/Config.ahk index e785d4f..875e114 100644 --- a/src/Config.ahk +++ b/src/Config.ahk @@ -44,6 +44,7 @@ Config_init() { Config_readinTimeFormat := "HH:mm" Config_readinVolume := False Config_readinInterval := 30000 + Config_readinTitle := True Config_barItemSpacing := 8 Config_barIconSpacing := 4 Config_iconFontYOffset := 3 diff --git a/src/Main.ahk b/src/Main.ahk index 8034bc1..9ecc6bc 100644 --- a/src/Main.ahk +++ b/src/Main.ahk @@ -182,6 +182,13 @@ Main_toggleBar: Monitor_toggleBar() Return +Main_delevatedRun(Args) { + MsgBox %A_UserName% + RunAs, %A_UserName% + Run, %Args% + RunAs +} + #Include Bar.ahk #Include Config.ahk #Include Debug.ahk