Compare commits

...

10 commits

Author SHA1 Message Date
c863a66fa0 in taskbar changes 2023-03-01 20:55:50 -07:00
60b361b7bd . 2022-09-23 22:07:07 -06:00
0f6580b372 initial fork commit 2022-02-15 14:38:14 -07:00
joten
914c47c506
Merge pull request #287 from ShaadiAlfred/master
Fix MaxHotkeysPerInterval
2021-09-12 18:49:58 +02:00
Shaadi Alfred
8a55344827
Merge pull request #1 from ShaadiAlfred/MaxHotkeysPerInterval-patch
Fix MaxHotkeysPerInterval when scrolling
2021-09-10 21:23:12 +02:00
Shaadi Alfred
db3cc3c08c
Fix MaxHotkeysPerInterval when scrolling 2021-09-10 21:22:46 +02:00
joten
0e912908e5
Added hul, a script for restoring hidden windows 2020-12-04 16:04:14 +01:00
joten
513adaa5f6
Deleted brank x.min 2020-06-11 22:46:28 +02:00
joten
364035b7cf
Update Configuring_rules.md 2020-04-23 19:55:57 +02:00
joten
6afb85c957
Update Configuring_rules.md 2020-04-23 19:54:55 +02:00
11 changed files with 836 additions and 115 deletions

28
CHANGES.md Normal file
View file

@ -0,0 +1,28 @@
# Changes
Required by license to disclose changes.
## Bar
* Disabled shebang
* Icon support
* Time and date can be combined and clicked on to change between states
* MusicBee integration via MusicBeeIPC plugin
* Proper text resizing
* Clicking items no longer repositions mouse cursor
* Bar elements no longer have progress element
* Time has optional binary clock mode
## Config
* Renamed `Config_readinMemoryUsage` to `Config_readinRam`
* Added `Config_readinMusic`, only supports MusicBee currently
* Added `Config_readinTimeBinary` for enabling binary clock
* Removed `Config_readinDiskLoad` and `Config_readinNetworkLoad`
* Added `Config_barItemSpacing`, `Config_barIconSpacing` and `Config_iconFontYOffset`
* Added `Config_barIcons`: `<time>;<date>;<ram>;<cpu>;<battery>;<volume>;<music>`
* Added `Config_combineDateAndTime`
## ResourceMonitor
* RAM is now in MB
* Different CPU load getting functions
## Window
* Implement [#283](https://github.com/fuhsjr00/bug.n/pull/283)

View file

@ -90,8 +90,7 @@ the [LICENSE file](./LICENSE.md) for the full license text.
### Development
Currently, there are three development branches:
Currently, there are two branches:
* master, the current stable version (v9), which is no longer actively developed or maintained
* X, a development version (v10), which is a rewrite of bug.n and in alpha stage, but development is dormant
* x.min, a minimal version of X with less features and currently in alpha stage
* `master`, the current stable version (v9), which is no longer actively developed or maintained;
* `X`, a development version (v10), which is a rewrite of bug.n and in alpha stage, but development is dormant.

View file

@ -127,3 +127,7 @@ not practical for all of them to be tiled by bug.n. Those applications, which
should be tiled, have to be listed specifically, e.g. Edge:
`Config_rule=ApplicationFrameWindow;.*Edge;;1;0;0;0;1;0;`
#### Windows background apps
`Config_rule=NarratorHelperWindow;.*;;0;`

View file

@ -1,4 +1,4 @@
/*
/*
bug.n -- tiling window management
Copyright (c) 2010-2019 Joshua Fuhs, joten
@ -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
@ -43,65 +43,91 @@ Bar_init(m) {
Debug_logMessage("DEBUG[6] Bar_init(): Gui, " . GuiN . ": Default", 6)
Gui, %GuiN%: Default
Gui, Destroy
Gui, +AlwaysOnTop -Caption +LabelBar_Gui +LastFound +ToolWindow
Gui, -Caption +LabelBar_Gui +LastFound +ToolWindow
Gui, Color, %Config_backColor_#1_#3%
Gui, Font, c%Config_fontColor_#1_#3% s%Config_fontSize%, %Config_fontName%
;; 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)
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>;<batteryStatus>;<volumeLevel>
color := "4"
id := "shebang"
text := " #! "
;; <view>;<layout>;<title>;<shebang>;<time>;<date>;<anyText>;<battery>;<volumeLevel>
;color := "4"
;id := "shebang"
;text := " #! "
color := ""
id := ""
text := ""
If Config_readinTime {
color .= ";5"
id .= ";time"
text .= "; " . Config_readinTimeFormat . " "
color .= "4"
id .= "time"
text .= "" . Config_readinTimeFormat
}
If Config_readinDate {
color .= ";6"
If (Config_readinDate And !Config_combineDateAndTime) {
color .= ";5"
id .= ";date"
text .= "; " . Config_readinDateFormat . " "
text .= ";" . Config_readinDateFormat
}
If Config_readinVolume {
color .= ";9"
id .= ";volume"
text .= "; VOL: ???% "
text .= ";???%"
}
anyText := Config_readinAny()
If anyText {
If Config_readinRam {
color .= ";6"
id .= ";ram"
text .= ";" . ResourceMonitor_getRamText()
}
If Config_readinCpu {
color .= ";7"
id .= ";anyText"
text .= ";" anyText
id .= ";cpu"
text .= ";" . ResourceMonitor_getCpuText()
}
If Config_readinBat {
color .= ";8"
id .= ";batteryStatus"
text .= "; BAT: ???% "
id .= ";battery"
text .= ";???%"
}
If Config_readinMusic {
color .= ";10"
id .= ";music"
text .= ";" . MusicBee_GetNowPlaying()
}
StringSplit, color, color, `;
StringSplit, id, id, `;
StringSplit, text, text, `;
Loop, % id0 {
If (id%A_Index% = "shebang")
elemId := id%A_Index%
If (elemId = "shebang")
Gui, -Disabled
w := Bar_getTextWidth(text%A_Index%)
x2 -= w
titleWidth -= w
i := color%A_Index%
Bar_addElement(m, id%A_Index%, text%A_Index%, x2, y1, w, Config_backColor_#1_#%i%, Config_foreColor_#1_#%i%, Config_fontColor_#1_#%i%)
iconIndex := i - 3
icon := Config_barIcon_#%iconIndex%
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)
@ -111,6 +137,7 @@ Bar_init(m) {
y1 += h1
y2 += h1
}
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")
@ -140,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")
@ -161,6 +198,9 @@ Bar_init(m) {
DllCall("Shell32.dll\SHAppBarMessage", "UInt", (ABM_SETPOS := 0x3) , "UInt", &Bar_appBarData)
;; SKAN: Crazy Scripting : Quick Launcher for Portable Apps (http://www.autohotkey.com/forum/topic22398.html)
}
Bar_BinaryClockChars := ["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]
Bar_TimeDateState := 0
}
Bar_initCmdGui()
@ -188,15 +228,23 @@ Bar_initCmdGui()
Gui, Show, Hide w%Bar_#0_#0W% h%Bar_#0_#0H%, %wndTitle%
}
Bar_addElement(m, id, text, x, y1, width, backColor, foreColor, fontColor) {
Bar_addElement(m, id, text, x, y1, width, backColor, foreColor, fontColor, fontSize="", fontName="") {
Local y2
if (fontSize == "") {
fontSize = %Config_fontSize%
}
if (fontName == "") {
fontName = %Config_fontName%
}
y2 := y1 + (Bar_ctrlHeight - Bar_textHeight) / 2
Gui, Add, Text, x%x% y%y1% w%width% h%Bar_ctrlHeight% BackgroundTrans vBar_#%m%_%id%_event gBar_GuiClick,
Gui, Add, Progress, x%x% y%y1% w%width% h%Bar_ctrlHeight% Background%backColor% c%foreColor% vBar_#%m%_%id%_highlighted
GuiControl, , Bar_#%m%_%id%_highlighted, 100
Gui, Font, c%fontColor%
Gui, Add, Text, x%x% y%y2% w%width% h%Bar_textHeight% BackgroundTrans Center vBar_#%m%_%id%, %text%
;Gui, Add, Progress, x%x% y%y1% w%width% h%Bar_ctrlHeight% Background%backColor% c%foreColor% vBar_#%m%_%id%_highlighted
;GuiControl, , Bar_#%m%_%id%_highlighted, 100
Gui, Font, c%fontColor% s%fontSize%, %fontName%
Gui, Add, Text, x%x% y%y2% w%width% h%Bar_textHeight% BackgroundTrans Center vBar_#%m%_%id% HwndBar_#%m%_%id%_hwnd, %text%
}
Bar_cmdGuiEnter:
@ -256,6 +304,9 @@ Bar_getHeight()
Bar_ctrlHeight := Bar_height
If Not Config_singleRowBar
Bar_ctrlHeight := Bar_height / 2
Bar_height := 22
Bar_ctrlHeight := 22
}
}
@ -289,14 +340,46 @@ Bar_getTextWidth(x, reverse=False)
Return, textWidth
}
Bar_getTrueTextWidth(controlHwnd, newText) {
dc := DllCall("GetDC", "Ptr", controlHwnd)
; 0x31 = WM_GETFONT
SendMessage 0x31,,,, ahk_id %controlHwnd%
hFont := ErrorLevel
oldFont := 0
if (hFont != "FAIL")
oldFont := DllCall("SelectObject", "Ptr", dc, "Ptr", hFont)
VarSetCapacity(rect, 16, 0)
; 0x440 = DT_CALCRECT | DT_EXPANDTABS
h := DllCall("DrawText", "Ptr", dc, "Ptr", &newText, "Int", -1, "Ptr", &rect, "UInt", 0x440)
; width = rect.right - rect.left
w := NumGet(rect, 8, "Int") - NumGet(rect, 0, "Int")
if oldFont
DllCall("SelectObject", "Ptr", dc, "Ptr", oldFont)
DllCall("ReleaseDC", "Ptr", controlHwnd, "Ptr", dc)
return w
}
Bar_GuiClick:
Manager_winActivate(Bar_aWndId)
If (A_GuiEvent = "Normal") {
If (SubStr(A_GuiControl, -13) = "_shebang_event") {
If Not Bar_cmdGuiIsVisible
If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
Bar_toggleCommandGui()
;If (SubStr(A_GuiControl, -13) = "_shebang_event") {
; If Not Bar_cmdGuiIsVisible
; If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
; Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
; Bar_toggleCommandGui()
;} Else
If (SubStr(A_GuiControl, -10) = "_time_event") {
If (Config_combineDateAndTime) {
If (Bar_TimeDateState == 0) {
Bar_TimeDateState := 1
} Else {
Bar_TimeDateState := 0
}
}
} Else {
If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
@ -397,12 +480,13 @@ Bar_updateStatic(m) {
}
Bar_updateStatus() {
Local anyText, bat1, bat2, bat3, GuiN, m, mute, time, vol
Local bat1, bat2, bat3, GuiN, m, mute, time, vol, hours, minutes, seconds, text, textWidth, statusWidth, iconWidth, iconY
iconY := (Bar_ctrlHeight - Bar_textHeight) / 2 - %Config_iconFontYOffset%
anyText := Config_readinAny()
If Config_readinBat {
ResourceMonitor_getBatteryStatus(bat1, bat2)
bat3 := SubStr(" " bat1, -2)
bat3 := bat1
}
If Config_readinVolume {
SoundGet, vol, MASTER, VOLUME
@ -415,49 +499,246 @@ Bar_updateStatus() {
GuiN := (m - 1) + 1
Debug_logMessage("DEBUG[6] Bar_updateStatus(): Gui, " . GuiN . ": Default", 6)
Gui, %GuiN%: Default
If Config_readinBat {
If (bat1 < 10) And (bat2 = "off") {
;; Change the color, if the battery level is below 10%
GuiControl, +Background%Config_backColor_#3_#8% +c%Config_foreColor_#3_#8%, Bar_#%m%_batteryStatus_highlighted
GuiControl, +c%Config_fontColor_#3_#8%, Bar_#%m%_batteryStatus
} Else If (bat2 = "off") {
;; Change the color, if the pc is not plugged in
GuiControl, +Background%Config_backColor_#2_#8% +c%Config_foreColor_#2_#8%, Bar_#%m%_batteryStatus_highlighted
GuiControl, +c%Config_fontColor_#2_#8%, Bar_#%m%_batteryStatus
statusWidth := Monitor_#%m%_barWidth
statusWidth -= Config_barItemSpacing
If Config_readinTime {
If Config_readinTimeBinary {
FormatTime, hours,, H
FormatTime, minutes,, m
FormatTime, seconds,, s
If (Config_combineDateAndTime) {
If (Bar_TimeDateState == 0) {
time := % Bar_BinaryClockChars[hours + 1] " " Bar_BinaryClockChars[minutes + 1] " " Bar_BinaryClockChars[seconds + 1]
} Else {
GuiControl, +Background%Config_backColor_#1_#8% +c%Config_foreColor_#1_#8%, Bar_#%m%_batteryStatus_highlighted
GuiControl, +c%Config_fontColor_#1_#8%, Bar_#%m%_batteryStatus
FormatTime, time, , % Config_readinDateFormat
}
GuiControl, , Bar_#%m%_batteryStatus_highlighted, %bat3%
GuiControl, , Bar_#%m%_batteryStatus, % " BAT: " bat3 "% "
} else {
time := % Bar_BinaryClockChars[hours + 1] " " Bar_BinaryClockChars[minutes + 1] " " Bar_BinaryClockChars[seconds + 1]
}
} Else {
If (Config_combineDateAndTime) {
If (Bar_TimeDateState == 0) {
FormatTime, time, , % Config_readinTimeFormat
} Else {
FormatTime, time, , % Config_readinDateFormat
}
} else {
FormatTime, time, , % Config_readinTimeFormat
}
}
textWidth := Bar_getTrueTextWidth(Bar_#%m%_time_hwnd, time)
statusWidth -= textWidth
GuiControl,, Bar_#%m%_time, % time
GuiControl, Move, Bar_#%m%_time, % "w" textWidth " x" statusWidth
GuiControl, Move, Bar_#%m%_time_event, % "w" textWidth " x" statusWidth
;GuiControl, Move, Bar_#%m%_time_highlighted, % "w" textWidth " x" statusWidth
statusWidth -= Config_barIconSpacing
If (Config_combineDateAndTime) {
If (Bar_TimeDateState == 0) {
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_time_icon_hwnd, Config_barIcon_#1)
} Else {
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_time_icon_hwnd, Config_barIcon_#2)
}
} Else {
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_time_icon_hwnd, Config_barIcon_#1)
}
statusWidth -= iconWidth
If (Config_combineDateAndTime) {
If (Bar_TimeDateState == 0) {
GuiControl,, Bar_#%m%_time_icon, %Config_barIcon_#1%
} Else {
GuiControl,, Bar_#%m%_time_icon, %Config_barIcon_#2%
}
} Else {
GuiControl,, Bar_#%m%_time_icon, %Config_barIcon_#1%
}
GuiControl, Move, Bar_#%m%_time_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
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
}
If Config_readinDate And !Config_combineDateAndTime {
FormatTime, time, , % Config_readinDateFormat
textWidth := Bar_getTrueTextWidth(Bar_#%m%_date_hwnd, time)
statusWidth -= textWidth
GuiControl,, Bar_#%m%_date, % time
GuiControl, Move, Bar_#%m%_date, % "w" textWidth " x" statusWidth
GuiControl, Move, Bar_#%m%_date_event, % "w" textWidth " x" statusWidth
;GuiControl, Move, Bar_#%m%_date_highlighted, % "w" textWidth " x" statusWidth
statusWidth -= Config_barIconSpacing
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_date_icon_hwnd, Config_barIcon_#2)
statusWidth -= iconWidth
GuiControl,, Bar_#%m%_date_icon, %Config_barIcon_#2%
GuiControl, Move, Bar_#%m%_date_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
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
}
If anyText
GuiControl, , Bar_#%m%_anyText, % anyText
If Config_readinVolume {
If (mute = "On") {
;; Change the color, if the mute is on
GuiControl, +Background%Config_backColor_#1_#9% +c%Config_foreColor_#1_#9%, Bar_#%m%_volume_highlighted
GuiControl, +c%Config_fontColor_#1_#9%, Bar_#%m%_volume
} Else {
GuiControl, +Background%Config_backColor_#2_#9% +c%Config_foreColor_#2_#9%, Bar_#%m%_volume_highlighted
;GuiControl, +Background%Config_backColor_#1_#9% +c%Config_foreColor_#1_#9%, Bar_#%m%_volume_highlighted
GuiControl, +c%Config_fontColor_#2_#9%, Bar_#%m%_volume
GuiControl, +c%Config_fontColor_#2_#9%, Bar_#%m%_volume_icon
} Else {
;GuiControl, +Background%Config_backColor_#2_#9% +c%Config_foreColor_#2_#9%, Bar_#%m%_volume_highlighted
GuiControl, +c%Config_fontColor_#1_#9%, Bar_#%m%_volume
GuiControl, +c%Config_fontColor_#1_#9%, Bar_#%m%_volume_icon
}
GuiControl, , Bar_#%m%_volume_highlighted, %vol%
GuiControl, , Bar_#%m%_volume, % " VOL: " SubStr(" " vol, -2) "% "
text := % vol "%"
textWidth := Bar_getTrueTextWidth(Bar_#%m%_volume_hwnd, text)
statusWidth -= textWidth
GuiControl,, Bar_#%m%_volume, % text
GuiControl, Move, Bar_#%m%_volume, % "w" textWidth " x" statusWidth
GuiControl, Move, Bar_#%m%_volume_event, % "w" textWidth " x" statusWidth
;GuiControl, Move, Bar_#%m%_volume_highlighted, % "w" textWidth " x" statusWidth
statusWidth -= Config_barIconSpacing
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_volume_icon_hwnd, Config_barIcon_#6)
statusWidth -= iconWidth
GuiControl,, Bar_#%m%_volume_icon, %Config_barIcon_#6%
GuiControl, Move, Bar_#%m%_volume_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
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
}
If Config_readinDate {
FormatTime, time, , % Config_readinDateFormat
GuiControl, , Bar_#%m%_date, % time
If Config_readinRam {
text := ResourceMonitor_getRamText()
textWidth := Bar_getTrueTextWidth(Bar_#%m%_ram_hwnd, text)
statusWidth -= textWidth
GuiControl,, Bar_#%m%_ram, % text
GuiControl, Move, Bar_#%m%_ram, % "w" textWidth " x" statusWidth
GuiControl, Move, Bar_#%m%_ram_event, % "w" textWidth " x" statusWidth
;GuiControl, Move, Bar_#%m%_ram_highlighted, % "w" textWidth " x" statusWidth
statusWidth -= Config_barIconSpacing
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_ram_icon_hwnd, Config_barIcon_#3)
statusWidth -= iconWidth
GuiControl,, Bar_#%m%_ram_icon, %Config_barIcon_#3%
GuiControl, Move, Bar_#%m%_ram_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
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
}
If Config_readinTime {
FormatTime, time, , % Config_readinTimeFormat
GuiControl, , Bar_#%m%_time, % time
If Config_readinCpu {
text := ResourceMonitor_getCpuText()
textWidth := Bar_getTrueTextWidth(Bar_#%m%_cpu_hwnd, text)
statusWidth -= textWidth
GuiControl,, Bar_#%m%_cpu, % text
GuiControl, Move, Bar_#%m%_cpu, % "w" textWidth " x" statusWidth
GuiControl, Move, Bar_#%m%_cpu_event, % "w" textWidth " x" statusWidth
;GuiControl, Move, Bar_#%m%_cpu_highlighted, % "w" textWidth " x" statusWidth
statusWidth -= Config_barIconSpacing
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_cpu_icon_hwnd, Config_barIcon_#4)
statusWidth -= iconWidth
GuiControl,, Bar_#%m%_cpu_icon, %Config_barIcon_#4%
GuiControl, Move, Bar_#%m%_cpu_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
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
}
If Config_readinBat {
If (bat1 < 10) And (bat2 = "off") {
;; Change the color, if the battery level is below 10%
;GuiControl, +Background%Config_backColor_#3_#8% +c%Config_foreColor_#3_#8%, Bar_#%m%_battery_highlighted
GuiControl, +c%Config_fontColor_#3_#8%, Bar_#%m%_battery
} Else If (bat2 = "off") {
;; Change the color, if the pc is not plugged in
;GuiControl, +Background%Config_backColor_#2_#8% +c%Config_foreColor_#2_#8%, Bar_#%m%_battery_highlighted
GuiControl, +c%Config_fontColor_#2_#8%, Bar_#%m%_battery
} Else {
;GuiControl, +Background%Config_backColor_#1_#8% +c%Config_foreColor_#1_#8%, Bar_#%m%_battery_highlighted
GuiControl, +c%Config_fontColor_#1_#8%, Bar_#%m%_battery
}
text := % bat3 "%"
textWidth := Bar_getTrueTextWidth(Bar_#%m%_battery_hwnd, text)
statusWidth -= textWidth
GuiControl,, Bar_#%m%_battery, % text
GuiControl, Move, Bar_#%m%_battery, % "w" textWidth " x" statusWidth
GuiControl, Move, Bar_#%m%_battery_event, % "w" textWidth " x" statusWidth
;GuiControl, Move, Bar_#%m%_battery_highlighted, % "w" textWidth " x" statusWidth
statusWidth -= Config_barIconSpacing
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_battery_icon_hwnd, Config_barIcon_#5)
statusWidth -= iconWidth
GuiControl,, Bar_#%m%_battery_icon, %Config_barIcon_#5%
GuiControl, Move, Bar_#%m%_battery_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
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
}
If Config_readinMusic {
text := MusicBee_GetNowPlaying()
textWidth := Bar_getTrueTextWidth(Bar_#%m%_music_hwnd, text)
statusWidth -= textWidth
GuiControl,, Bar_#%m%_music, % text
GuiControl, Move, Bar_#%m%_music, % "w" textWidth " x" statusWidth
GuiControl, Move, Bar_#%m%_music_event, % "w" textWidth " x" statusWidth
;GuiControl, Move, Bar_#%m%_music_highlighted, % "w" textWidth " x" statusWidth
statusWidth -= Config_barIconSpacing
if (text == "") {
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_music_icon_hwnd, "")
} else {
iconWidth := Bar_getTrueTextWidth(Bar_#%m%_music_icon_hwnd, Config_barIcon_#7)
}
statusWidth -= iconWidth
GuiControl,, Bar_#%m%_music_icon, %Config_barIcon_#7%
GuiControl, Move, Bar_#%m%_music_icon, % "w" iconWidth " x" statusWidth " h" Bar_ctrlHeight " y" iconY
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
}
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
}
}
}
Bar_updateTitle() {
Local aWndId, aWndTitle, content, GuiN, i, title
Local aWndId, aWndTitle, content, GuiN, i, title, titleWidth, barWidth, titleX
WinGet, aWndId, ID, A
WinGetTitle, aWndTitle, ahk_id %aWndId%
@ -467,27 +748,36 @@ Bar_updateTitle() {
aWndTitle := "~ " aWndTitle
If (Manager_monitorCount > 1)
aWndTitle := "[" Manager_aMonitor "] " aWndTitle
title := " " . aWndTitle . " "
If (Bar_getTextWidth(title) > Bar_#%Manager_aMonitor%_titleWidth) {
title := aWndTitle
if (StrLen(title) > 48) {
;; 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 . " ... "
title := SubStr(title, 1, 48) . ""
}
StringReplace, title, title, &, &&, All ;; Special character '&', which would underline the next letter.
Loop, % Manager_monitorCount {
barWidth := Monitor_#%A_Index%_barWidth
titleWidth := Bar_getTrueTextWidth(Bar_#%A_Index%_title_hwnd, title)
titleX := barWidth / 2 - titleWidth / 2
GuiN := (A_Index - 1) + 1
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
}
@ -503,18 +793,22 @@ Bar_updateView(m, v) {
If (v = Monitor_#%m%_aView_#1) {
;; Set foreground/background colors if the view is the current view.
GuiControl, +Background%Config_backColor_#2_#1% +c%Config_foreColor_#2_#1%, Bar_#%m%_view_#%v%_highlighted
;GuiControl, +Background%Config_backColor_#2_#1% +c%Config_foreColor_#2_#1%, Bar_#%m%_view_#%v%_highlighted
GuiControl, +c%Config_fontColor_#2_#1%, Bar_#%m%_view_#%v%
} Else {
;; Set foreground/background colors.
GuiControl, +Background%Config_backColor_#1_#1% +c%Config_foreColor_#1_#1%, Bar_#%m%_view_#%v%_highlighted
;GuiControl, +Background%Config_backColor_#1_#1% +c%Config_foreColor_#1_#1%, Bar_#%m%_view_#%v%_highlighted
GuiControl, +c%Config_fontColor_#1_#1%, Bar_#%m%_view_#%v%
}
Loop, % Config_viewCount {
StringTrimRight, wndIds, View_#%m%_#%A_Index%_wndIds, 1
StringSplit, wndId, wndIds, `;
GuiControl, , Bar_#%m%_view_#%A_Index%_highlighted, % wndId0 / managedWndId0 * 100 ;; Update the percentage fill for the view.
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

@ -37,13 +37,17 @@ Config_init() {
Config_readinCpu := False
Config_readinDate := True
Config_readinDateFormat := "ddd, dd. MMM. yyyy"
Config_readinDiskLoad := False
Config_readinMemoryUsage := False
Config_readinNetworkLoad := False
Config_readinRam := False
Config_readinMusic := False
Config_readinTime := True
Config_readinTimeBinary := False
Config_readinTimeFormat := "HH:mm"
Config_readinVolume := False
Config_readinInterval := 30000
Config_readinTitle := True
Config_barItemSpacing := 8
Config_barIconSpacing := 4
Config_iconFontYOffset := 3
;; Windows ui elements
Config_bbCompatibility := False
@ -79,6 +83,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;"
@ -108,15 +113,16 @@ 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()
Loop, % Config_layoutCount {
StringSplit, layout, Config_layout_#%A_Index%, `;
Config_layoutFunction_#%A_Index% := layout2
@ -152,6 +158,12 @@ Config_initColors() {
}
}
Config_initBarIcons() {
Global
StringSplit, Config_barIcon_#, Config_barIcons, `;
}
Config_convertSystemColor(systemColor)
{ ;; systemColor format: 0xBBGGRR
rr := SubStr(systemColor, 7, 2)
@ -410,6 +422,8 @@ Config_UI_saveSession() {
Config_saveSession(Config_filePath, Config_filePath)
}
#MaxHotkeysPerInterval 200
;; Key definitions
;; Window management
#Down::View_activateWindow(0, +1)

View file

@ -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
@ -191,4 +198,5 @@ Return
#Include Tiler.ahk
#Include View.ahk
#Include Window.ahk
#Include %A_ScriptDir%\MonitorManager.ahk
#Include MonitorManager.ahk
#Include MusicBee.ahk

View file

@ -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 {

153
src/MusicBee.ahk Normal file
View file

@ -0,0 +1,153 @@
MusicBee_FormatTime(time) {
seconds := time / 1000
hours := Floor(seconds / 3600)
seconds := Mod(seconds, 3600)
minutes := Floor(seconds / 60)
seconds := Mod(seconds, 60)
seconds := Floor(seconds)
if (seconds < 10) {
seconds := % "0" seconds
}
if (minutes < 10) {
minutes := % "0" minutes
}
if (hours != 0) {
return % hours ":" minutes ":" seconds
} else {
return % minutes ":" seconds
}
}
MusicBee_GetNowPlaying() {
detectHidden := A_DetectHiddenWindows
DetectHiddenWindows, On
ipcId := WinExist("MusicBee IPC Interface")
SendMessage, 0x0400, 999, 0,, ahk_id %ipcId%
probeState := ErrorLevel
SendMessage, 0x0400, 109, 0,, ahk_id %ipcId%
playState := ErrorLevel
SendMessage, 0x0400, 110, 0,, ahk_id %ipcId%
position := ErrorLevel
SendMessage, 0x0400, 141, 16,, ahk_id %ipcId%
durationData := ErrorLevel
MBIPC_Unpack_s(MBIPC_GetLResult(durationData), displayDuration)
SendMessage, 0x0400, 900, %durationData%,, ahk_id %ipcId%
SendMessage, 0x0400, 142, 32,, ahk_id %ipcId%
artistData := ErrorLevel
MBIPC_Unpack_s(MBIPC_GetLResult(artistData), artist)
SendMessage, 0x0400, 900, %artistData%,, ahk_id %ipcId%
SendMessage, 0x0400, 142, 31,, ahk_id %ipcId%
albumArtistData := ErrorLevel
MBIPC_Unpack_s(MBIPC_GetLResult(albumArtistData), albumArtist)
SendMessage, 0x0400, 900, %albumArtistData%,, ahk_id %ipcId%
SendMessage, 0x0400, 142, 65,, ahk_id %ipcId%
titleData := ErrorLevel
MBIPC_Unpack_s(MBIPC_GetLResult(titleData), title)
SendMessage, 0x0400, 900, %titleData%,, ahk_id %ipcId%
displayArtist := artist
if (StrLen(artist) > 64) {
displayArtist := albumArtist
}
state := ""
if (playState = 6) {
state := " [paused]"
}
duration := 0
splitDuration := StrSplit(displayDuration, ":")
duration += splitDuration[1] * 60
duration += splitDuration[2]
duration *= 1000
DetectHiddenWindows, %detectHidden%
StringReplace, displayArtist, displayArtist, &, &&, All
StringReplace, title, title, &, &&, All
if (probeState = 1) {
return % displayArtist " - " title " [" MusicBee_FormatTime(position) "/" MusicBee_FormatTime(duration) "]" state
} else {
return ""
}
}
;;;;
MBIPC_Unpack_s(Byref lr, ByRef string_1)
{
string_1 := ""
mmf := MBIPC_OpenMmf(lr)
if !mmf
return 0
view := MBIPC_MapMmfView(mmf, lr, ptr)
if !view
{
MBIPC_CloseMmf(mmf)
return 0
}
byteCount := NumGet(ptr+0, 0, "Int")
ptr += 4
if byteCount > 0
string_1 := StrGet(ptr, byteCount // 2, "UTF-16")
MBIPC_UnmapMmfView(view)
MBIPC_CloseMmf(mmf)
return 1
}
MBIPC_OpenMmf(ByRef lr)
{
if !lr
return 0
; FILE_MAP_READ = 0x0004 = 4
; FALSE = 0
return DllCall("OpenFileMapping", UInt, 4, Int, 0, Str, "mbipc_mmf_" . NumGet(lr, 0, "UShort"), UInt)
}
MBIPC_CloseMmf(mmf)
{
DllCall("CloseHandle", UInt, mmf)
}
MBIPC_MapMmfView(mmf, ByRef lr, ByRef ptr)
{
; FILE_MAP_READ = 0x0004 = 4
view := DllCall("MapViewOfFile", UInt, mmf, UInt, 4, UInt, 0, UInt, 0, UInt, 0, UInt)
ptr := view + NumGet(lr, 2, "UShort") + 8
return view
}
MBIPC_UnmapMmfView(view)
{
DllCall("UnmapViewOfFile", UInt, view)
}
MBIPC_GetLResult(el)
{
if el = FAIL
return 0
VarSetCapacity(lr, 4)
NumPut(el, lr, 0, "Int")
return lr
}

View file

@ -126,7 +126,7 @@ ResourceMonitor_getSystemTimes() {
oldUserTime := newUserTime
DllCall("GetSystemTimes", "Int64P", newIdleTime, "Int64P", newKrnlTime, "Int64P", newUserTime)
sysTime := SubStr(" " . Round((1 - (newIdleTime - oldIdleTime) / (newKrnlTime - oldKrnlTime+newUserTime - oldUserTime)) * 100), -2)
sysTime := Round((1 - (newIdleTime - oldIdleTime) / (newKrnlTime - oldKrnlTime+newUserTime - oldUserTime)) * 100)
Return, sysTime ;; system time in percent
}
;; Sean: CPU LoadTimes (http://www.autohotkey.com/forum/topic18913.html)
@ -157,3 +157,35 @@ ResourceMonitor_getText() {
Return, text
}
ResourceMonitor_getSystemTimes2(ByRef IdleTime) {
DllCall("GetSystemTimes", "Int64P", IdleTime, "Int64P", KernelTime, "Int64P", UserTime)
Return KernelTime + UserTime
}
ResourceMonitor_getCpuLoad(period := 500) {
total := ResourceMonitor_getSystemTimes2(idle)
Sleep, % period
total2 := ResourceMonitor_getSystemTimes2(idle2)
Return 100*(1 - (idle2 - idle)/(total2 - total))
}
ResourceMonitor_getCpuText() {
Return, Floor(ResourceMonitor_getCpuLoad()) . "%"
}
ResourceMonitor_GlobalMemoryStatusEx()
{
static MSEX, init := NumPut(VarSetCapacity(MSEX, 64, 0), MSEX, "uint")
if !(DllCall("GlobalMemoryStatusEx", "ptr", &MSEX))
throw Exception("Call to GlobalMemoryStatusEx failed: " A_LastError, -1)
return { MemoryLoad: NumGet(MSEX, 4, "uint"), TotalPhys: NumGet(MSEX, 8, "uint64"), AvailPhys: NumGet(MSEX, 16, "uint64") }
}
ResourceMonitor_getRamText() {
GMSEx := ResourceMonitor_GlobalMemoryStatusEx()
TotalMem := GMSEx.TotalPhys
AvailMem := GMSEx.AvailPhys
mem := RegExReplace(Floor((TotalMem - AvailMem) / 1048576), "(\d)(?=(?:\d{3})+(?:\.|$))", "$1,")
Return, mem . " MB"
}

View file

@ -18,6 +18,7 @@ Window_activate(wndId) {
Debug_logMessage("DEBUG[2] Window_activate: Potentially hung window " . wndId, 2)
Return, 1
} Else {
WinActivate, ahk_class Progman
WinActivate, ahk_id %wndId%
WinGet, aWndId, ID, A
If (wndId != aWndId)

187
tools/hul.ahk Normal file
View file

@ -0,0 +1,187 @@
/**
* hul! - Find and restore (hidden) windows
* Copyright (c) 2011 joten
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @version 0.1.0.01 (02.10.2011)
*/
NAME := "hul!"
VERSION := "0.1.0"
HELP :=
(Join
"USAGE`n
`n
Specify one, two or all of the following search criteria:`n
- Type a regular expression in the field next to 'Partial title'.`n
- Type a class name (exact match) in the field next to 'Class name'.`n
- Type a process name (e. g. the name of an exeutable, exact match) in the field next to 'Process name'.`n
`n
The search will be done on typing the search criteria.`n
`n
You may navigate between the input fields by pressing Tab (forward) or Shift+Tab (back).`n
Press Enter to go to the list box, which contains the search results.`n
Select an entry and press Enter again to restore the selected window.`n
`n
Press the Escape (Esc) key to clear all fields and go back to entering the search criteria.`n"
)
/**
* Script settings
*/
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#NoTrayIcon
#SingleInstance force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; DetectHiddenWindows, On
; SetFormat, Integer, h
/**
* Pseudo main function
*/
WinGet, Main_aWndId, ID, A
; BEGIN: Init GUI
IfWinExist, %NAME%
Gui, Destroy
Gui, +LastFound +0xCF0000 -0x80000000
Gui, Add, Text, yp+11, Partial Title:
Gui, Add, Edit, xp+82 yp-3 w700 gButtonSearch vGui_title,
Gui, Add, Text, xm, Class Name:
Gui, Add, Edit, xp+82 yp-3 w700 gButtonSearch vGui_class,
Gui, Add, Text, xm, Process Name:
Gui, Add, Edit, xp+82 yp-3 w700 gButtonSearch vGui_pName,
; Gui, Add, Button, xm w800 vGui_search, Search
Gui, Add, ListBox, +0x100 t36 xm w800 vGui_wnds,
Gui, Add, Button, Default Hidden w800 vGui_restore, Restore
Gui, Show, AutoSize, %NAME%
Gui_wndId := WinExist()
Main_resize()
; END: Init GUI
Return ; end of the auto-execute section
/**
* Hotkeys, function & label definitions
*/
#IfWinActive hul! ahk_class AutoHotkeyGUI
{
^h::MsgBox %HELP%
}
ButtonRestore:
Main_restore()
Return
ButtonSearch:
Main_search()
Return
GuiClose:
ExitApp
Return
GuiEscape:
GuiControl, , Gui_title,
GuiControl, , Gui_class,
GuiControl, , Gui_pName,
GuiControl, , Gui_wnds, |
GuiControl, Focus, Gui_title
Return
GuiSize:
Main_resize(A_GuiWidth, A_GuiHeight)
Return
Main_resize(w = 0, h = 0) {
Global Gui_wndId
If (w = 0 Or h = 0) {
Sleep, 250
WinGetPos, x, y, w, h, ahk_id %Gui_wndId%
h += 1
WinMove, ahk_id %Gui_wndId%, , x, y, w, h
} Else {
w -= 2 * 10
w1 := w - (72 + 10)
h -= 3 * 30
; y := 8 + (3 * 30) + h + 8
GuiControl, Move, Gui_title, w%w1%
GuiControl, Move, Gui_class, w%w1%
GuiControl, Move, Gui_pName, w%w1%
; GuiControl, Move, Gui_search, w%w%
GuiControl, Move, Gui_wnds, w%w% h%h%
; GuiControl, Move, Gui_restore, y%y% w%w%
}
}
Main_restore() {
Global Gui_wnds
GuiControlGet, wnd, , Gui_wnds
If wnd {
wndId := SubStr(wnd, 1, InStr(wnd, ": ") - 1)
WinShow, ahk_id %wndId%
WinRestore, ahk_id %wndId%
WinSet, AlwaysOnTop, On, ahk_id %wndId%
WinSet, AlwaysOnTop, Off, ahk_id %wndId%
WinMove, ahk_id %wndId%, , 0, 0, 800, 600
} Else
GuiControl, Focus, Gui_wnds
}
Main_search() {
Global Gui_class, Gui_pName, Gui_title, Gui_wndId, Gui_wnds
GuiControl, , Gui_wnds, |
GuiControlGet, title, , Gui_title
GuiControlGet, class, , Gui_class
If class
criteria .= " ahk_class " class
GuiControlGet, pName, , Gui_pName
If pName {
Process, Exist, %pName%
If ErrorLevel
criteria .= " ahk_pid " ErrorLevel
}
If Not (criteria Or title)
criteria := "A"
wndListString := ""
DetectHiddenWindows, On
WinGet, wndId, List, % criteria
Loop, % wndId {
WinGetTitle, wndTitle, % "ahk_id " wndId%A_Index%
If Not (wndId%A_Index% = Gui_wndId) And (Not title Or RegExmatch(wndTitle, title)) {
WinGetClass, wndClass, % "ahk_id " wndId%A_Index%
WinGet, wndPName, ProcessName, % "ahk_id " wndId%A_Index%
WinGet, wndStyle, Style, % "ahk_id " wndId%A_Index%
WinGetPos, wndPosX, wndPosY, wndPosW, wndPosH, % "ahk_id " wndId%A_Index%
wndListString .= "|" wndId%A_Index% ": `t" wndTitle " (" wndClass ", " wndPName ", " wndStyle ", " wndPosX ", " wndPosY ", " wndPosW ", " wndPosH ")"
}
}
DetectHiddenWindows, Off
GuiControl, , Gui_wnds, % wndListString
}