Smooth edges, logo/clock/tray colors, hidden icons fix
This commit is contained in:
@@ -145,13 +145,13 @@ func drawBattery(hdc uintptr, r rect) {
|
||||
t := px(1)
|
||||
left := cx - (bw+nubW)/2
|
||||
top := cy - bh/2
|
||||
white := rgb(245, 245, 245)
|
||||
white := iconColor()
|
||||
|
||||
fill(hdc, rect{left, top, left + bw, top + t}, white)
|
||||
fill(hdc, rect{left, top + bh - t, left + bw, top + bh}, white)
|
||||
fill(hdc, rect{left, top, left + t, top + bh}, white)
|
||||
fill(hdc, rect{left + bw - t, top, left + bw, top + bh}, white)
|
||||
fill(hdc, rect{left + bw, cy - nubH/2, left + bw + nubW, cy + nubH/2}, white)
|
||||
fillFg(hdc, rect{left, top, left + bw, top + t}, white)
|
||||
fillFg(hdc, rect{left, top + bh - t, left + bw, top + bh}, white)
|
||||
fillFg(hdc, rect{left, top, left + t, top + bh}, white)
|
||||
fillFg(hdc, rect{left + bw - t, top, left + bw, top + bh}, white)
|
||||
fillFg(hdc, rect{left + bw, cy - nubH/2, left + bw + nubW, cy + nubH/2}, white)
|
||||
|
||||
col := white
|
||||
switch {
|
||||
@@ -166,15 +166,15 @@ func drawBattery(hdc uintptr, r rect) {
|
||||
if battPct > 0 && fw < px(1) {
|
||||
fw = px(1)
|
||||
}
|
||||
fill(hdc, rect{left + gap, top + gap, left + gap + fw, top + bh - gap}, col)
|
||||
fillFg(hdc, rect{left + gap, top + gap, left + gap + fw, top + bh - gap}, col)
|
||||
}
|
||||
|
||||
func drawVolume(hdc uintptr, r rect) {
|
||||
cx, cy := center(r)
|
||||
white, dim := rgb(245, 245, 245), rgb(110, 110, 120)
|
||||
white, dim := iconColor(), iconDim()
|
||||
x0 := cx - px(9)
|
||||
|
||||
fill(hdc, rect{x0, cy - px(3), x0 + px(3), cy + px(3)}, white)
|
||||
fillFg(hdc, rect{x0, cy - px(3), x0 + px(3), cy + px(3)}, white)
|
||||
polygon(hdc, []point{
|
||||
{x0 + px(3), cy - px(3)},
|
||||
{x0 + px(7), cy - px(6)},
|
||||
@@ -200,7 +200,7 @@ func drawVolume(hdc uintptr, r rect) {
|
||||
if i < active {
|
||||
col = white
|
||||
}
|
||||
fill(hdc, rect{bx, cy - heights[i]/2, bx + px(2), cy + heights[i]/2}, col)
|
||||
fillFg(hdc, rect{bx, cy - heights[i]/2, bx + px(2), cy + heights[i]/2}, col)
|
||||
}
|
||||
if volMuted {
|
||||
polyline(hdc, []point{{x0 + px(10), cy - px(4)}, {x0 + px(17), cy + px(4)}}, px(1), white)
|
||||
@@ -210,18 +210,18 @@ func drawVolume(hdc uintptr, r rect) {
|
||||
|
||||
func drawNetwork(hdc uintptr, r rect) {
|
||||
cx, cy := center(r)
|
||||
white, dim := rgb(245, 245, 245), rgb(110, 110, 120)
|
||||
white, dim := iconColor(), iconDim()
|
||||
|
||||
if netKind == netWired {
|
||||
t := px(1)
|
||||
l, tp := cx-px(7), cy-px(6)
|
||||
w, h := px(14), px(9)
|
||||
fill(hdc, rect{l, tp, l + w, tp + t}, white)
|
||||
fill(hdc, rect{l, tp + h - t, l + w, tp + h}, white)
|
||||
fill(hdc, rect{l, tp, l + t, tp + h}, white)
|
||||
fill(hdc, rect{l + w - t, tp, l + w, tp + h}, white)
|
||||
fill(hdc, rect{cx - px(1), tp + h, cx + px(1), tp + h + px(3)}, white)
|
||||
fill(hdc, rect{cx - px(4), tp + h + px(3), cx + px(4), tp + h + px(4)}, white)
|
||||
fillFg(hdc, rect{l, tp, l + w, tp + t}, white)
|
||||
fillFg(hdc, rect{l, tp + h - t, l + w, tp + h}, white)
|
||||
fillFg(hdc, rect{l, tp, l + t, tp + h}, white)
|
||||
fillFg(hdc, rect{l + w - t, tp, l + w, tp + h}, white)
|
||||
fillFg(hdc, rect{cx - px(1), tp + h, cx + px(1), tp + h + px(3)}, white)
|
||||
fillFg(hdc, rect{cx - px(4), tp + h + px(3), cx + px(4), tp + h + px(4)}, white)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ func drawNetwork(hdc uintptr, r rect) {
|
||||
if i < bars {
|
||||
col = white
|
||||
}
|
||||
fill(hdc, rect{x, baseY - heights[i], x + px(2), baseY}, col)
|
||||
fillFg(hdc, rect{x, baseY - heights[i], x + px(2), baseY}, col)
|
||||
x += px(4)
|
||||
}
|
||||
if netKind == netNone {
|
||||
@@ -255,7 +255,7 @@ func drawNetwork(hdc uintptr, r rect) {
|
||||
func drawChevron(hdc uintptr, r rect) {
|
||||
cx, cy := center(r)
|
||||
polyline(hdc, []point{{cx - px(5), cy + px(2)}, {cx, cy - px(3)}, {cx + px(5), cy + px(2)}},
|
||||
px(1.5), rgb(245, 245, 245))
|
||||
px(1.5), iconColor())
|
||||
}
|
||||
|
||||
func drawTray(hdc uintptr, w, h int32) {
|
||||
@@ -263,7 +263,7 @@ func drawTray(hdc uintptr, w, h int32) {
|
||||
if it.kind == hoverTray {
|
||||
fill(hdc, rect{it.r.Left + px(1), it.r.Top + px(3), it.r.Right - px(1), it.r.Bottom - px(3)}, rgb(40, 40, 48))
|
||||
}
|
||||
if vertical && it.kind != trayClock {
|
||||
if !layerFg || (vertical && it.kind != trayClock) {
|
||||
continue // a vertical bar draws these upright, after turning
|
||||
}
|
||||
switch it.kind {
|
||||
@@ -534,6 +534,21 @@ func tapChord(mod, k uintptr) {
|
||||
}
|
||||
|
||||
// trayClick opens the matching Windows panel with its keyboard shortcut.
|
||||
const vkEscape = 0x1B
|
||||
|
||||
// overflowOpen reports whether the hidden icons flyout is on screen.
|
||||
func overflowOpen() bool {
|
||||
for _, class := range []string{"TopLevelWindowForOverflowXamlIsland", "NotifyIconOverflowWindow"} {
|
||||
h, _, _ := pFindWindow.Call(uintptr(unsafe.Pointer(u16(class))), 0)
|
||||
if h != 0 {
|
||||
if vis, _, _ := pIsWindowVisible.Call(h); vis != 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func trayClick(kind int) {
|
||||
switch kind {
|
||||
case trayClock:
|
||||
@@ -541,6 +556,12 @@ func trayClick(kind int) {
|
||||
case trayBattery, trayVolume, trayWifi:
|
||||
tapChord(vkLWin, 'A') // quick settings
|
||||
case trayChevron:
|
||||
// If the hidden icons are already showing, a second click closes them. Sending
|
||||
// Win+B and Enter again would instead press Enter on the highlighted icon.
|
||||
if overflowOpen() {
|
||||
tapKey(vkEscape)
|
||||
return
|
||||
}
|
||||
// Win+B moves focus to the notification area; Enter opens the hidden icons.
|
||||
tapChord(vkLWin, 'B')
|
||||
time.Sleep(150 * time.Millisecond)
|
||||
|
||||
Reference in New Issue
Block a user