Integrated bar into Shell_SecondaryTrayWnd
This commit is contained in:
parent
a8adf2e33f
commit
be8e4a68c3
4 changed files with 38 additions and 56 deletions
10
src/Bar.ahk
10
src/Bar.ahk
|
@ -23,7 +23,7 @@ Bar_init(m) {
|
|||
wndWidth := Config_barWidth
|
||||
|
||||
wndWidth := Round(wndWidth * Config_scalingFactor)
|
||||
If (Config_verticalBarPos = "tray" And m = Manager_taskBarMonitor) {
|
||||
If (Config_verticalBarPos = "tray" And Monitor_#%m%_taskBarClass) {
|
||||
Bar_ctrlHeight := Round(Bar_ctrlHeight * Config_scalingFactor)
|
||||
Bar_height := Round(Bar_height * Config_scalingFactor)
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ Bar_init(m) {
|
|||
x1 := Config_horizontalBarPos
|
||||
Else If (Config_horizontalBarPos < 0)
|
||||
x1 := Monitor_#%m%_width - wndWidth / Config_scalingFactor + Config_horizontalBarPos
|
||||
If Not (Config_verticalBarPos = "tray" And m = Manager_taskBarMonitor)
|
||||
If Not (Config_verticalBarPos = "tray" And Monitor_#%m%_taskBarClass)
|
||||
x1 += Monitor_#%m%_x
|
||||
x1 := Round(x1)
|
||||
|
||||
|
@ -137,8 +137,8 @@ Bar_init(m) {
|
|||
Gui, Show, NoActivate Hide x%x1% y%y1% w%wndWidth% h%Bar_height%, %wndTitle%
|
||||
WinSet, Transparent, %Config_barTransparency%, %wndTitle%
|
||||
wndId := WinExist(wndTitle)
|
||||
If (Config_verticalBarPos = "tray" And m = Manager_taskBarMonitor) {
|
||||
trayWndId := WinExist("ahk_class Shell_TrayWnd")
|
||||
If (Config_verticalBarPos = "tray" And Monitor_#%m%_taskBarClass) {
|
||||
trayWndId := WinExist("ahk_class " Monitor_#%m%_taskBarClass)
|
||||
DllCall("SetParent", "UInt", wndId, "UInt", trayWndId)
|
||||
} Else {
|
||||
appBarMsg := DllCall("RegisterWindowMessage", Str, "AppBarMsg")
|
||||
|
@ -343,7 +343,7 @@ Bar_toggleCommandGui()
|
|||
{
|
||||
Bar_cmdGuiIsVisible := True
|
||||
x := Monitor_#%Manager_aMonitor%_barX + Monitor_#%Manager_aMonitor%_barWidth - Bar_#0_#0W
|
||||
If (Config_verticalBarPos = "top") Or (Config_verticalBarPos = "tray" And (Manager_taskBarPos = "top" Or Not Manager_aMonitor = Manager_taskBarMonitor))
|
||||
If (Config_verticalBarPos = "top") Or (Config_verticalBarPos = "tray") And (Manager_taskBarPos = "top" Or Not Monitor_#%Manager_aMonitor%_taskBarClass)
|
||||
y := Monitor_#%Manager_aMonitor%_y
|
||||
Else
|
||||
y := Monitor_#%Manager_aMonitor%_y + Monitor_#%Manager_aMonitor%_height - Bar_#0_#0H
|
||||
|
|
|
@ -191,10 +191,10 @@ Main_reload()
|
|||
{
|
||||
Monitor_getWorkArea(A_Index)
|
||||
Bar_init(A_Index)
|
||||
If Monitor_%A_Index%_taskBarClass And Not (Monitor_%A_Index%_showTaskBar = Config_showTaskBar)
|
||||
Monitor_toggleTaskBar()
|
||||
}
|
||||
Bar_initCmdGui()
|
||||
If Not (Manager_showTaskBar = Config_showTaskBar)
|
||||
Monitor_toggleTaskBar()
|
||||
Bar_updateStatus()
|
||||
Bar_updateTitle()
|
||||
Loop, % Manager_monitorCount
|
||||
|
|
|
@ -24,8 +24,6 @@ Manager_init()
|
|||
; New/closed windows, active changed,
|
||||
Manager_windowsDirty := 0
|
||||
Manager_aMonitor := 1
|
||||
Manager_taskBarMonitor := ""
|
||||
Manager_showTaskBar := True
|
||||
|
||||
doRestore := 0
|
||||
If (Config_autoSaveSession = "ask")
|
||||
|
@ -164,11 +162,11 @@ Manager_cleanup()
|
|||
Manager_hideShow := False
|
||||
|
||||
;; Restore window positions and sizes.
|
||||
Manager_showTaskBar := True
|
||||
Loop, % Manager_monitorCount
|
||||
{
|
||||
m := A_Index
|
||||
Monitor_#%m%_showBar := False
|
||||
Monitor_#%m%_showTaskBar := True
|
||||
Monitor_getWorkArea(m)
|
||||
Loop, % Config_viewCount
|
||||
{
|
||||
|
|
|
@ -13,17 +13,16 @@
|
|||
@version 9.0.0
|
||||
*/
|
||||
|
||||
Monitor_init(m, doRestore)
|
||||
{
|
||||
Monitor_init(m, doRestore) {
|
||||
Global
|
||||
|
||||
Monitor_#%m%_aView_#1 := 1
|
||||
Monitor_#%m%_aView_#2 := 1
|
||||
Monitor_#%m%_showBar := Config_showBar
|
||||
Monitor_#%m%_showTaskBar := Config_showTaskBar
|
||||
Monitor_#%m%_taskBarClass := ""
|
||||
Loop, % Config_viewCount
|
||||
{
|
||||
View_init(m, A_Index)
|
||||
}
|
||||
If doRestore
|
||||
Config_restoreLayout(Main_autoLayout, m)
|
||||
Else
|
||||
|
@ -121,8 +120,7 @@ Monitor_get(x, y)
|
|||
Return, m
|
||||
}
|
||||
|
||||
Monitor_getWorkArea(m)
|
||||
{
|
||||
Monitor_getWorkArea(m) {
|
||||
Local bHeight, bTop, x, y
|
||||
Local monitor, monitorBottom, monitorLeft, monitorRight, monitorTop
|
||||
Local wndClasses, wndHeight, wndId, wndWidth, wndX, wndY
|
||||
|
@ -136,40 +134,35 @@ Monitor_getWorkArea(m)
|
|||
Loop, PARSE, wndClasses, `;
|
||||
{
|
||||
wndId := WinExist("ahk_class " A_LoopField)
|
||||
If wndId
|
||||
{
|
||||
If wndId {
|
||||
WinGetPos, wndX, wndY, wndWidth, wndHeight, ahk_id %wndId%
|
||||
x := wndX + wndWidth / 2
|
||||
y := wndY + wndHeight / 2
|
||||
If (x >= monitorLeft && x <= monitorRight && y >= monitorTop && y <= monitorBottom)
|
||||
{
|
||||
If (A_LoopField = "Shell_TrayWnd")
|
||||
Manager_taskBarMonitor := m
|
||||
If (x >= monitorLeft && x <= monitorRight && y >= monitorTop && y <= monitorBottom) {
|
||||
If (A_LoopField = "Shell_TrayWnd") Or (A_LoopField = "Shell_SecondaryTrayWnd")
|
||||
Monitor_#%m%_taskBarClass := A_LoopField
|
||||
|
||||
If (wndHeight < wndWidth)
|
||||
{ ;; Horizontal
|
||||
If (wndY <= monitorTop)
|
||||
{ ;; Top
|
||||
If (wndHeight < wndWidth) {
|
||||
;; Horizontal
|
||||
If (wndY <= monitorTop) {
|
||||
;; Top
|
||||
wndHeight += wndY - monitorTop
|
||||
monitorTop += wndHeight
|
||||
If (A_LoopField = "Shell_TrayWnd")
|
||||
Manager_taskBarPos := "top"
|
||||
}
|
||||
Else
|
||||
{ ;; Bottom
|
||||
} Else {
|
||||
;; Bottom
|
||||
wndHeight := monitorBottom - wndY
|
||||
monitorBottom -= wndHeight
|
||||
}
|
||||
}
|
||||
Else
|
||||
{ ;; Vertical
|
||||
If (wndX <= monitorLeft)
|
||||
{ ;; Left
|
||||
} Else {
|
||||
;; Vertical
|
||||
If (wndX <= monitorLeft) {
|
||||
;; Left
|
||||
wndWidth += wndX
|
||||
monitorLeft += wndWidth
|
||||
}
|
||||
Else
|
||||
{ ;; Right
|
||||
} Else {
|
||||
;; Right
|
||||
wndWidth := monitorRight - wndX
|
||||
monitorRight -= wndWidth
|
||||
}
|
||||
|
@ -179,15 +172,11 @@ Monitor_getWorkArea(m)
|
|||
}
|
||||
bHeight := Round(Bar_height / Config_scalingFactor)
|
||||
bTop := 0
|
||||
If Monitor_#%m%_showBar
|
||||
{
|
||||
If (Config_verticalBarPos = "top" Or (Config_verticalBarPos = "tray" And Not m = Manager_taskBarMonitor))
|
||||
{
|
||||
If Monitor_#%m%_showBar {
|
||||
If (Config_verticalBarPos = "top") Or (Config_verticalBarPos = "tray") And Not Monitor_#%m%_taskBarClass {
|
||||
bTop := monitorTop
|
||||
monitorTop += bHeight
|
||||
}
|
||||
Else If (Config_verticalBarPos = "bottom")
|
||||
{
|
||||
} Else If (Config_verticalBarPos = "bottom") {
|
||||
bTop := monitorBottom - bHeight
|
||||
monitorBottom -= bHeight
|
||||
}
|
||||
|
@ -291,24 +280,19 @@ Monitor_toggleNotifyIconOverflowWindow()
|
|||
}
|
||||
}
|
||||
|
||||
Monitor_toggleTaskBar()
|
||||
{
|
||||
Monitor_toggleTaskBar() {
|
||||
Local m
|
||||
|
||||
m := Manager_aMonitor
|
||||
If (m = Manager_taskBarMonitor)
|
||||
{
|
||||
Manager_showTaskBar := Not Manager_showTaskBar
|
||||
If Monitor_#%m%_taskBarClass {
|
||||
Monitor_#%m%_showTaskBar := Not Monitor_#%m%_showTaskBar
|
||||
Manager_hideShow := True
|
||||
If Not Manager_showTaskBar
|
||||
{
|
||||
If Not Monitor_#%m%_showTaskBar {
|
||||
WinHide, Start ahk_class Button
|
||||
WinHide, ahk_class Shell_TrayWnd
|
||||
}
|
||||
Else
|
||||
{
|
||||
WinHide, % "ahk_class " Monitor_#%m%_taskBarClass
|
||||
} Else {
|
||||
WinShow, Start ahk_class Button
|
||||
WinShow, ahk_class Shell_TrayWnd
|
||||
WinShow, % "ahk_class " Monitor_#%m%_taskBarClass
|
||||
}
|
||||
Manager_hideShow := False
|
||||
Monitor_getWorkArea(m)
|
||||
|
|
Loading…
Reference in a new issue