Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ffd3c5e22 | ||
|
|
eab5a47495 | ||
|
|
93f6b94d98 | ||
|
|
6ac9164755 |
@@ -20,9 +20,10 @@ Drag the app icons and the Windows logo along the left row to reorder them. Mirr
|
||||
- Rest the mouse on an app icon for a moment and a live preview of that window pops up beside the bar (minimized windows show their icon instead). Click the preview to switch to that window.
|
||||
- Right-click an app icon and choose "Pin to MirrorBar" to keep it on the bar. A pinned app that isn't running shows as a launcher: click it to start the program, and when its window opens it takes that spot. Pinning works for normal programs; Store apps can't be pinned.
|
||||
- "Open notification center" is in the right-click menu.
|
||||
- Click the little smiley, or right-click and choose "Open emoji panel", and the Windows emoji panel opens (the same as pressing Win+.). Pick an emoji and it is typed into the window you were just in. Tick or untick "Emoji panel button" under "Show on the bar" in the settings window to put the smiley on the bar or take it off; it can be dragged along the right row like the other icons.
|
||||
- Drag files from Explorer onto an app icon and that program opens them, running or pinned.
|
||||
- "MirrorBar settings..." in the right-click menu opens one window for background opacity, the three colors, icon style, the ZIP code, tickboxes to show or hide the weather, the local news and the system stats, vertical mode, start with Windows, and resetting the position and width. Changes apply as you make them.
|
||||
- In "MirrorBar settings..." you can also change how the bar looks. "Bar color" turns the pill dark (the default), black, white, red, dark green, navy, purple or gray. "Windows logo shape" swaps the four squares for rounded squares, four dots, squares tilted right or left, diamonds or a waving flag. "Clock text size" makes the time and date Normal, Large, Larger or Largest, and "Bold clock text" makes them heavier; the bar grows to fit. Under "Show on the bar" you can take the battery, volume and wifi icons off the bar and bring them back. The logo, clock and tray icon colors now have sixteen choices, including dark green, teal, navy, maroon, gray and lime. A light bar needs a dark clock and icon color to be readable.
|
||||
- In "MirrorBar settings..." you can also change how the bar looks. "Bar color" turns the pill dark (the default), black, white, red, dark green, navy, purple, gray, charcoal, slate, burgundy, forest, brown, teal, olive or midnight. "Windows logo shape" swaps the four squares for rounded squares, four dots, squares tilted right or left, diamonds, a waving flag, a single circle, a hexagon, a plus sign, three bars, pills or a triangle. "Clock text size" makes the time and date Normal, Large, Larger or Largest, and "Bold clock text" makes them heavier; the bar grows to fit. Under "Show on the bar" you can take the battery, volume and wifi icons off the bar and bring them back. The logo, clock and tray icon colors have twenty-four choices, including dark green, teal, navy, maroon, gray, lime, brown, mint, lavender, gold, coral, silver, slate and olive. A light bar needs a dark clock and icon color to be readable. "Clock font" picks the typeface for the time and date from sixteen fonts that come with Windows or Office (a font that is not installed on your PC shows as a default one). "Battery charging color" changes the color of the filled part of the battery while it charges or is plugged in: the old bright green is the default, and there are softer, muted ones and one that simply matches the icon color.
|
||||
|
||||
Smooth, outline-free icons and text, even when the pill is see-through.
|
||||
- Click the storm cloud and a weather panel opens above the bar: the temperature in Fahrenheit, what it feels like, the high and low, humidity, wind, chance of rain, sunrise, sunset, UV index, the moon phase, a looping radar picture of the last hour or so centered on your ZIP code, and the next five days. Click the cloud again, or click anywhere else, and it closes. It needs a ZIP code: type it in "MirrorBar settings..." (a 5 digit US ZIP code) and the weather turns on at once. The forecast comes from Open-Meteo (open-meteo.com, free, no account), the radar map comes from RainViewer and Esri and is only downloaded when you open the panel, and MirrorBar only goes to the internet when a ZIP code is set. The cloud can be dragged along the right row like the other icons.
|
||||
|
||||
+14
-3
@@ -65,7 +65,18 @@ func saveLeftPref() {
|
||||
// halfLimit is the longest either half may be.
|
||||
func halfLimit() int32 {
|
||||
sw, _ := screenSize()
|
||||
return sw/2 - px(4)
|
||||
return sw*layerMul()/2 - px(4)
|
||||
}
|
||||
|
||||
// layerMul is how much bigger the layer being drawn is than the real bar (2
|
||||
// while the icons are drawn at double size, otherwise 1). Lengths kept in real
|
||||
// pixels, like the chosen bar width and the screen size, are scaled by it so
|
||||
// the icons land on the same spots the mouse tests.
|
||||
func layerMul() int32 {
|
||||
if realScale <= 0 {
|
||||
return 1
|
||||
}
|
||||
return int32(scale/realScale + 0.5)
|
||||
}
|
||||
|
||||
// rightHalf is the length of the right half: the tray items plus a little padding.
|
||||
@@ -87,7 +98,7 @@ func leftHalf() int32 {
|
||||
case leftPref < 0:
|
||||
h = lc
|
||||
case leftPref > 0:
|
||||
h = max(lc, leftPref)
|
||||
h = max(lc, leftPref*layerMul())
|
||||
default:
|
||||
h = max(lc, rightHalf())
|
||||
}
|
||||
@@ -128,7 +139,7 @@ func overEdge(hwnd uintptr) bool {
|
||||
func beginResize(hwnd uintptr) {
|
||||
resizing = true
|
||||
resizeFrom = cursorAlong()
|
||||
resizeLen = leftHalf()
|
||||
resizeLen = leftHalf() // always measured at real size here
|
||||
pSetCapture.Call(hwnd)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package main
|
||||
|
||||
// The little smiley on the bar. Clicking it presses Win+. which opens the
|
||||
// Windows emoji panel (emoji, GIFs, symbols and the clipboard history), so
|
||||
// whatever you pick is pasted into the window you were just typing in.
|
||||
|
||||
import "math"
|
||||
|
||||
func drawEmojiIcon(hdc uintptr, r rect) {
|
||||
if !layerFg {
|
||||
return
|
||||
}
|
||||
cx, cy := center(r)
|
||||
col := iconColor()
|
||||
rad := float64(px(7.5))
|
||||
|
||||
// the face
|
||||
face := make([]point, 0, 33)
|
||||
for k := 0; k <= 32; k++ {
|
||||
a := float64(k) * 2 * math.Pi / 32
|
||||
face = append(face, point{cx + int32(math.Round(rad*math.Cos(a))), cy + int32(math.Round(rad*math.Sin(a)))})
|
||||
}
|
||||
polyline(hdc, face, px(1.3), col)
|
||||
|
||||
// the eyes
|
||||
eye := px(1.1)
|
||||
circleRaw(hdc, cx-px(2.7), cy-px(2), eye, col)
|
||||
circleRaw(hdc, cx+px(2.7), cy-px(2), eye, col)
|
||||
|
||||
// the smile
|
||||
smile := make([]point, 0, 9)
|
||||
sr := float64(px(4.2))
|
||||
for k := 0; k <= 8; k++ {
|
||||
a := (25 + float64(k)*130/8) * math.Pi / 180
|
||||
smile = append(smile, point{cx + int32(math.Round(sr*math.Cos(a))), cy + int32(math.Round(sr*math.Sin(a))) - px(0.5)})
|
||||
}
|
||||
polyline(hdc, smile, px(1.2), col)
|
||||
}
|
||||
+4
-1
@@ -19,6 +19,7 @@ var (
|
||||
showBattery = true
|
||||
showVolume = true
|
||||
showWifi = true
|
||||
showEmoji = true // the emoji panel button
|
||||
)
|
||||
|
||||
func featuresFile() string { return filepath.Join(dataDir(), "features.txt") }
|
||||
@@ -55,12 +56,14 @@ func loadFeatures() {
|
||||
showVolume = on
|
||||
case "wifi":
|
||||
showWifi = on
|
||||
case "emoji":
|
||||
showEmoji = on
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func saveFeatures() {
|
||||
s := "weather=" + b01(showWeather) + "\nnews=" + b01(showNews) + "\nsys=" + b01(showSys) + "\nmessages=" + b01(showGM) + "\npanelfade=" + b01(flyMatchBar) + "\ngroup=" + b01(groupWins) + "\nautohide=" + b01(autoHide) + "\nbattery=" + b01(showBattery) + "\nvolume=" + b01(showVolume) + "\nwifi=" + b01(showWifi) + "\n"
|
||||
s := "weather=" + b01(showWeather) + "\nnews=" + b01(showNews) + "\nsys=" + b01(showSys) + "\nmessages=" + b01(showGM) + "\npanelfade=" + b01(flyMatchBar) + "\ngroup=" + b01(groupWins) + "\nautohide=" + b01(autoHide) + "\nbattery=" + b01(showBattery) + "\nvolume=" + b01(showVolume) + "\nwifi=" + b01(showWifi) + "\nemoji=" + b01(showEmoji) + "\n"
|
||||
_ = os.MkdirAll(dataDir(), 0o755)
|
||||
_ = os.WriteFile(featuresFile(), []byte(s), 0o644)
|
||||
}
|
||||
|
||||
@@ -10,9 +10,13 @@ import (
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var pRoundRect = gdi32.NewProc("RoundRect")
|
||||
var (
|
||||
pRoundRect = gdi32.NewProc("RoundRect")
|
||||
pGetTextExtentW = gdi32.NewProc("GetTextExtentPoint32W")
|
||||
)
|
||||
|
||||
// ---------- the color of the bar ----------
|
||||
|
||||
@@ -31,6 +35,14 @@ var barPalette = []barColor{
|
||||
{"Navy", 16, 36, 92},
|
||||
{"Purple", 72, 38, 112},
|
||||
{"Gray", 92, 92, 100},
|
||||
{"Charcoal", 44, 44, 50},
|
||||
{"Slate", 52, 64, 80},
|
||||
{"Burgundy", 92, 24, 40},
|
||||
{"Forest", 30, 56, 30},
|
||||
{"Brown", 84, 52, 30},
|
||||
{"Teal", 16, 82, 86},
|
||||
{"Olive", 74, 80, 32},
|
||||
{"Midnight", 10, 14, 40},
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -38,6 +50,10 @@ var (
|
||||
logoStyle = 0
|
||||
clockSizeIx = 0
|
||||
clockBold = false
|
||||
clockFontIx = 0
|
||||
chargeIx = 0
|
||||
|
||||
clockMeasured float64 // the width the time and date need in a font other than Segoe UI, at 96 dpi so it scales with the bar
|
||||
)
|
||||
|
||||
var logoStyleNames = []string{
|
||||
@@ -48,6 +64,63 @@ var logoStyleNames = []string{
|
||||
"Tilted left",
|
||||
"Diamonds",
|
||||
"Waving flag",
|
||||
"Single circle",
|
||||
"Hexagon",
|
||||
"Plus sign",
|
||||
"Three bars",
|
||||
"Pills",
|
||||
"Triangle",
|
||||
}
|
||||
|
||||
// The clock fonts. New ones go on the end so a saved choice keeps meaning the same font.
|
||||
// A font that is not installed on this PC quietly shows as a default font.
|
||||
var clockFonts = []string{
|
||||
"Segoe UI",
|
||||
"Tahoma",
|
||||
"Verdana",
|
||||
"Arial",
|
||||
"Calibri",
|
||||
"Cambria",
|
||||
"Consolas",
|
||||
"Cascadia Mono",
|
||||
"Courier New",
|
||||
"Georgia",
|
||||
"Trebuchet MS",
|
||||
"Bahnschrift",
|
||||
"Tw Cen MT",
|
||||
"Segoe Script",
|
||||
"Impact",
|
||||
"Comic Sans MS",
|
||||
}
|
||||
|
||||
// The color of the filled part of the battery icon while it charges. New ones go on the end.
|
||||
type chargeChoice struct {
|
||||
name string
|
||||
r, g, b int
|
||||
}
|
||||
|
||||
var chargeColors = []chargeChoice{
|
||||
{"Bright green (default)", 90, 205, 120},
|
||||
{"Soft green", 105, 165, 120},
|
||||
{"Dark green", 40, 115, 70},
|
||||
{"Muted teal", 80, 145, 150},
|
||||
{"Slate blue", 110, 135, 170},
|
||||
{"Dim gold", 190, 160, 80},
|
||||
{"Gray", 150, 150, 158},
|
||||
{"Same as the icon color", -1, -1, -1},
|
||||
}
|
||||
|
||||
// chargeColor is the fill color of the battery icon while it is charging or plugged in.
|
||||
func chargeColor() uintptr {
|
||||
i := chargeIx
|
||||
if i < 0 || i >= len(chargeColors) {
|
||||
i = 0
|
||||
}
|
||||
c := chargeColors[i]
|
||||
if c.r < 0 {
|
||||
return iconColor()
|
||||
}
|
||||
return rgb(c.r, c.g, c.b)
|
||||
}
|
||||
|
||||
type clockSizeChoice struct {
|
||||
@@ -102,6 +175,9 @@ func clockPx() int {
|
||||
|
||||
// clockWidth is the room the time and date need, which grows with the text.
|
||||
func clockWidth() int32 {
|
||||
if clockFontIx > 0 && clockMeasured > 0 {
|
||||
return px(clockMeasured + 24)
|
||||
}
|
||||
w := 140.0 * float64(clockPx()) / 13.0
|
||||
if clockBold {
|
||||
w *= 1.08
|
||||
@@ -116,11 +192,16 @@ func rebuildClockFonts() {
|
||||
if clockBold {
|
||||
weight = 700
|
||||
}
|
||||
face := clockFonts[0]
|
||||
if clockFontIx > 0 && clockFontIx < len(clockFonts) {
|
||||
face = clockFonts[clockFontIx]
|
||||
}
|
||||
oldA, oldB := fontTime, fontTime2
|
||||
fontTime = makeFont(px(float64(clockPx())), weight)
|
||||
fontTime = makeFontFace(face, px(float64(clockPx())), weight)
|
||||
scale *= superSample
|
||||
fontTime2 = makeFont(px(float64(clockPx())), weight)
|
||||
fontTime2 = makeFontFace(face, px(float64(clockPx())), weight)
|
||||
scale /= superSample
|
||||
clockMeasured = float64(measureClockText()) / scale
|
||||
if oldA != 0 {
|
||||
pDeleteObject.Call(oldA)
|
||||
}
|
||||
@@ -129,6 +210,21 @@ func rebuildClockFonts() {
|
||||
}
|
||||
}
|
||||
|
||||
// measureClockText is how wide the longest time and date are in the clock font, in real pixels.
|
||||
func measureClockText() int32 {
|
||||
hdc, _, _ := pGetDC.Call(0)
|
||||
if hdc == 0 {
|
||||
return 0
|
||||
}
|
||||
old, _, _ := pSelectObject.Call(hdc, fontTime)
|
||||
var sz struct{ cx, cy int32 }
|
||||
sample := "12:59 PM 12/30/2026"
|
||||
pGetTextExtentW.Call(hdc, uintptr(unsafe.Pointer(u16(sample))), uintptr(len(sample)), uintptr(unsafe.Pointer(&sz)))
|
||||
pSelectObject.Call(hdc, old)
|
||||
pReleaseDC.Call(0, hdc)
|
||||
return sz.cx
|
||||
}
|
||||
|
||||
// ---------- remembering the choices ----------
|
||||
|
||||
func lookFile() string { return filepath.Join(dataDir(), "look.txt") }
|
||||
@@ -162,6 +258,14 @@ func loadLook() {
|
||||
}
|
||||
case "clockbold":
|
||||
clockBold = n != 0
|
||||
case "clockfont":
|
||||
if n >= 0 && n < len(clockFonts) {
|
||||
clockFontIx = n
|
||||
}
|
||||
case "chargecolor":
|
||||
if n >= 0 && n < len(chargeColors) {
|
||||
chargeIx = n
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,7 +274,9 @@ func saveLook() {
|
||||
s := "barcolor=" + strconv.Itoa(barIdx) +
|
||||
"\nlogostyle=" + strconv.Itoa(logoStyle) +
|
||||
"\nclocksize=" + strconv.Itoa(clockSizeIx) +
|
||||
"\nclockbold=" + b01(clockBold) + "\n"
|
||||
"\nclockbold=" + b01(clockBold) +
|
||||
"\nclockfont=" + strconv.Itoa(clockFontIx) +
|
||||
"\nchargecolor=" + strconv.Itoa(chargeIx) + "\n"
|
||||
_ = os.MkdirAll(dataDir(), 0o755)
|
||||
_ = os.WriteFile(lookFile(), []byte(s), 0o644)
|
||||
}
|
||||
@@ -215,6 +321,34 @@ func setClockBold(on bool) {
|
||||
positionBar(hwndMain)
|
||||
}
|
||||
|
||||
func setClockFont(i int) {
|
||||
if i < 0 || i >= len(clockFonts) || i == clockFontIx {
|
||||
return
|
||||
}
|
||||
clockFontIx = i
|
||||
rebuildClockFonts()
|
||||
saveLook()
|
||||
positionBar(hwndMain)
|
||||
}
|
||||
|
||||
func setChargeColor(i int) {
|
||||
if i < 0 || i >= len(chargeColors) || i == chargeIx {
|
||||
return
|
||||
}
|
||||
chargeIx = i
|
||||
saveLook()
|
||||
redraw(hwndMain)
|
||||
}
|
||||
|
||||
func setShowEmoji(on bool) {
|
||||
if showEmoji == on {
|
||||
return
|
||||
}
|
||||
showEmoji = on
|
||||
saveFeatures()
|
||||
positionBar(hwndMain)
|
||||
}
|
||||
|
||||
func setShowBattery(on bool) {
|
||||
if showBattery == on {
|
||||
return
|
||||
@@ -321,5 +455,30 @@ func drawLogoStyle(hdc uintptr, r rect) {
|
||||
for _, f := range offs {
|
||||
polygon(hdc, pane(f[0], f[1], wave), c)
|
||||
}
|
||||
case 7: // single circle
|
||||
circleRaw(hdc, cx, cy, px(9), c)
|
||||
case 8: // hexagon
|
||||
pts := make([]point, 6)
|
||||
for k := range pts {
|
||||
a := (float64(k)*60 - 30) * math.Pi / 180
|
||||
pts[k] = point{cx + int32(math.Round(float64(px(10))*math.Cos(a))), cy + int32(math.Round(float64(px(10))*math.Sin(a)))}
|
||||
}
|
||||
polygon(hdc, pts, c)
|
||||
case 9: // plus sign
|
||||
l, t := px(10), px(3)
|
||||
fillRaw(hdc, rect{cx - l, cy - t, cx + l, cy + t}, c)
|
||||
fillRaw(hdc, rect{cx - t, cy - l, cx + t, cy + l}, c)
|
||||
case 10: // three bars
|
||||
for _, dy := range []int32{-px(6), 0, px(6)} {
|
||||
fillRaw(hdc, rect{cx - px(9), cy + dy - px(1.5), cx + px(9), cy + dy + px(1.5)}, c)
|
||||
}
|
||||
case 11: // pills, two by two
|
||||
for _, ox := range []int32{-px(10), px(1)} {
|
||||
for _, oy := range []int32{-px(7), px(1)} {
|
||||
roundRectRaw(hdc, cx+ox, cy+oy, cx+ox+px(9), cy+oy+px(6), px(3), c)
|
||||
}
|
||||
}
|
||||
case 12: // triangle
|
||||
polygon(hdc, []point{{cx, cy - px(9)}, {cx + px(10), cy + px(8)}, {cx - px(10), cy + px(8)}}, c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,6 +331,7 @@ var (
|
||||
hoverApp = -1
|
||||
trackingMouse bool
|
||||
scale float64 = 1
|
||||
realScale float64 = 1 // scale as the screen really is; scale itself is doubled while the icon layers are drawn
|
||||
barHeight int32
|
||||
fontTime uintptr
|
||||
fontDate uintptr
|
||||
@@ -681,9 +682,15 @@ func drawText(hdc uintptr, s string, r rect) {
|
||||
// makeFont uses plain antialiasing (not ClearType) because ClearType's colored
|
||||
// edges look wrong on a transparent window.
|
||||
func makeFont(height int32, weight int) uintptr {
|
||||
return makeFontFace("Segoe UI", height, weight)
|
||||
}
|
||||
|
||||
// makeFontFace is makeFont for any installed font. A font that is not installed
|
||||
// quietly falls back to a default one.
|
||||
func makeFontFace(face string, height int32, weight int) uintptr {
|
||||
f, _, _ := pCreateFont.Call(
|
||||
uintptr(-height), 0, 0, 0, uintptr(weight), 0, 0, 0,
|
||||
1, 0, 0, 4, 0, uintptr(unsafe.Pointer(u16("Segoe UI"))))
|
||||
1, 0, 0, 4, 0, uintptr(unsafe.Pointer(u16(face))))
|
||||
return f
|
||||
}
|
||||
|
||||
@@ -895,6 +902,7 @@ func showMenu(hwnd uintptr, appIdx int, trayKind int) {
|
||||
|
||||
add(0, menuSettingsID, "MirrorBar settings...")
|
||||
add(0, menuNotifyID, "Open notification center")
|
||||
add(0, menuEmojiID, "Open emoji panel")
|
||||
sep()
|
||||
for i, l := range alphaLevels {
|
||||
var flags uintptr
|
||||
@@ -1309,6 +1317,7 @@ func main() {
|
||||
if dpi > 0 {
|
||||
scale = float64(dpi) / 96.0
|
||||
}
|
||||
realScale = scale
|
||||
barHeight = px(36)
|
||||
fontTime = makeFont(px(13), 400)
|
||||
fontDate = makeFont(px(11), 400)
|
||||
|
||||
@@ -22,9 +22,9 @@ const (
|
||||
superSample = 2
|
||||
mfPopup = 0x0010
|
||||
|
||||
menuLogoColorBase = 100
|
||||
menuClockColorBase = 120
|
||||
menuIconColorBase = 140
|
||||
menuLogoColorBase = 300 // 40 apart so the color menus can grow past 20 colors
|
||||
menuClockColorBase = 340
|
||||
menuIconColorBase = 380
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -64,6 +64,14 @@ var palette = []namedColor{
|
||||
{"Maroon", 140, 30, 50},
|
||||
{"Gray", 140, 140, 150},
|
||||
{"Lime", 150, 220, 40},
|
||||
{"Brown", 150, 100, 60},
|
||||
{"Mint", 150, 230, 200},
|
||||
{"Lavender", 190, 170, 240},
|
||||
{"Gold", 210, 170, 50},
|
||||
{"Coral", 255, 120, 100},
|
||||
{"Silver", 200, 200, 210},
|
||||
{"Slate", 90, 105, 125},
|
||||
{"Olive", 130, 140, 50},
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -248,6 +256,8 @@ func renderLayer(screen uintptr, w, h int32, fills, fg bool, base uintptr) []uin
|
||||
drawSysIcon(memV, r)
|
||||
case trayGM:
|
||||
drawGMIcon(memV, r)
|
||||
case trayEmoji:
|
||||
drawEmojiIcon(memV, r)
|
||||
}
|
||||
}
|
||||
pGdiFlush.Call()
|
||||
|
||||
+36
-8
@@ -83,6 +83,9 @@ const (
|
||||
idShowBattery = 224
|
||||
idShowVolume = 225
|
||||
idShowWifi = 226
|
||||
idShowEmoji = 227
|
||||
idClockFont = 228
|
||||
idChargeColor = 229
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -97,6 +100,7 @@ var (
|
||||
ctlGroup, ctlAutoHide uintptr
|
||||
ctlBarColor, ctlLogoStyle, ctlClockSize, ctlClockBold uintptr
|
||||
ctlShowBattery, ctlShowVolume, ctlShowWifi uintptr
|
||||
ctlShowEmoji, ctlClockFont, ctlChargeColor uintptr
|
||||
zipSyncing bool // true while the program itself is filling in the ZIP box
|
||||
)
|
||||
|
||||
@@ -217,13 +221,18 @@ func openSettings() {
|
||||
ctlBarColor = combo2(16, idBarColor)
|
||||
label2("Windows logo shape", 52)
|
||||
ctlLogoStyle = combo2(52, idLogoStyle)
|
||||
label2("Clock text size", 88)
|
||||
ctlClockSize = combo2(88, idClockSize)
|
||||
ctlClockBold = makeControl(hw, inst, "BUTTON", "Bold clock text", bsAutoCheckBox|wsTabStop, 416, 124, 368, 22, idClockBold)
|
||||
makeControl(hw, inst, "STATIC", "Show on the bar:", 0, 416, 172, 368, 20, 0)
|
||||
ctlShowBattery = makeControl(hw, inst, "BUTTON", "Battery", bsAutoCheckBox|wsTabStop, 416, 198, 368, 22, idShowBattery)
|
||||
ctlShowVolume = makeControl(hw, inst, "BUTTON", "Volume", bsAutoCheckBox|wsTabStop, 416, 226, 368, 22, idShowVolume)
|
||||
ctlShowWifi = makeControl(hw, inst, "BUTTON", "Wifi", bsAutoCheckBox|wsTabStop, 416, 254, 368, 22, idShowWifi)
|
||||
label2("Clock font", 88)
|
||||
ctlClockFont = combo2(88, idClockFont)
|
||||
label2("Clock text size", 124)
|
||||
ctlClockSize = combo2(124, idClockSize)
|
||||
ctlClockBold = makeControl(hw, inst, "BUTTON", "Bold clock text", bsAutoCheckBox|wsTabStop, 416, 160, 368, 22, idClockBold)
|
||||
label2("Battery charging color", 196)
|
||||
ctlChargeColor = combo2(196, idChargeColor)
|
||||
makeControl(hw, inst, "STATIC", "Show on the bar:", 0, 416, 244, 368, 20, 0)
|
||||
ctlShowBattery = makeControl(hw, inst, "BUTTON", "Battery", bsAutoCheckBox|wsTabStop, 416, 270, 368, 22, idShowBattery)
|
||||
ctlShowVolume = makeControl(hw, inst, "BUTTON", "Volume", bsAutoCheckBox|wsTabStop, 416, 298, 368, 22, idShowVolume)
|
||||
ctlShowWifi = makeControl(hw, inst, "BUTTON", "Wifi", bsAutoCheckBox|wsTabStop, 416, 326, 368, 22, idShowWifi)
|
||||
ctlShowEmoji = makeControl(hw, inst, "BUTTON", "Emoji panel button", bsAutoCheckBox|wsTabStop, 416, 354, 368, 22, idShowEmoji)
|
||||
for _, b := range barPalette {
|
||||
pSendMessage.Call(ctlBarColor, cbAddString, 0, uintptr(unsafe.Pointer(u16(b.name))))
|
||||
}
|
||||
@@ -233,6 +242,16 @@ func openSettings() {
|
||||
for _, c := range clockSizes {
|
||||
pSendMessage.Call(ctlClockSize, cbAddString, 0, uintptr(unsafe.Pointer(u16(c.name))))
|
||||
}
|
||||
for i, f := range clockFonts {
|
||||
name := f
|
||||
if i == 0 {
|
||||
name = f + " (default)"
|
||||
}
|
||||
pSendMessage.Call(ctlClockFont, cbAddString, 0, uintptr(unsafe.Pointer(u16(name))))
|
||||
}
|
||||
for _, c := range chargeColors {
|
||||
pSendMessage.Call(ctlChargeColor, cbAddString, 0, uintptr(unsafe.Pointer(u16(c.name))))
|
||||
}
|
||||
|
||||
makeControl(hw, inst, "BUTTON", "Reset position", bsPushButton|wsTabStop, 16, 526, 116, 28, idResetPos)
|
||||
makeControl(hw, inst, "BUTTON", "Reset bar width", bsPushButton|wsTabStop, 140, 526, 116, 28, idResetWidth)
|
||||
@@ -268,6 +287,9 @@ func settingsSync() {
|
||||
pSendMessage.Call(ctlLogoStyle, cbSetCurSel, uintptr(logoStyle), 0)
|
||||
pSendMessage.Call(ctlClockSize, cbSetCurSel, uintptr(clockSizeIx), 0)
|
||||
pSendMessage.Call(ctlClockBold, bmSetCheck, boolWP(clockBold), 0)
|
||||
pSendMessage.Call(ctlClockFont, cbSetCurSel, uintptr(clockFontIx), 0)
|
||||
pSendMessage.Call(ctlChargeColor, cbSetCurSel, uintptr(chargeIx), 0)
|
||||
pSendMessage.Call(ctlShowEmoji, bmSetCheck, boolWP(showEmoji), 0)
|
||||
pSendMessage.Call(ctlShowBattery, bmSetCheck, boolWP(showBattery), 0)
|
||||
pSendMessage.Call(ctlShowVolume, bmSetCheck, boolWP(showVolume), 0)
|
||||
pSendMessage.Call(ctlShowWifi, bmSetCheck, boolWP(showWifi), 0)
|
||||
@@ -381,7 +403,7 @@ func settingsCommand(id, note uintptr) {
|
||||
setGroupWins(checked(ctlGroup))
|
||||
case idAutoHide:
|
||||
setAutoHide(checked(ctlAutoHide))
|
||||
case idBarColor, idLogoStyle, idClockSize:
|
||||
case idBarColor, idLogoStyle, idClockSize, idClockFont, idChargeColor:
|
||||
if note != cbnSelChange {
|
||||
return
|
||||
}
|
||||
@@ -392,6 +414,10 @@ func settingsCommand(id, note uintptr) {
|
||||
setLogoStyle(comboChoice(ctlLogoStyle))
|
||||
case idClockSize:
|
||||
setClockSize(comboChoice(ctlClockSize))
|
||||
case idClockFont:
|
||||
setClockFont(comboChoice(ctlClockFont))
|
||||
case idChargeColor:
|
||||
setChargeColor(comboChoice(ctlChargeColor))
|
||||
}
|
||||
case idClockBold:
|
||||
setClockBold(checked(ctlClockBold))
|
||||
@@ -401,6 +427,8 @@ func settingsCommand(id, note uintptr) {
|
||||
setShowVolume(checked(ctlShowVolume))
|
||||
case idShowWifi:
|
||||
setShowWifi(checked(ctlShowWifi))
|
||||
case idShowEmoji:
|
||||
setShowEmoji(checked(ctlShowEmoji))
|
||||
case idAutostart:
|
||||
setAutostart(checked(ctlAutostart))
|
||||
settingsSync()
|
||||
|
||||
@@ -24,6 +24,7 @@ const (
|
||||
trayNews
|
||||
traySys
|
||||
trayGM // Google Messages
|
||||
trayEmoji // the emoji panel button
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -54,6 +55,7 @@ const (
|
||||
menuSysCopyID = 35
|
||||
menuGMID = 36
|
||||
menuGMCloseID = 37
|
||||
menuEmojiID = 38
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -144,6 +146,11 @@ func trayItemsAt(x, clientH int32) []trayItem {
|
||||
continue
|
||||
}
|
||||
w = px(36)
|
||||
case trayEmoji:
|
||||
if !showEmoji {
|
||||
continue
|
||||
}
|
||||
w = px(36)
|
||||
case trayChevron:
|
||||
w = px(28)
|
||||
}
|
||||
@@ -210,7 +217,7 @@ func drawBattery(hdc uintptr, r rect) {
|
||||
col := white
|
||||
switch {
|
||||
case battCharging || battAC:
|
||||
col = rgb(90, 205, 120)
|
||||
col = chargeColor()
|
||||
case battPct <= 15:
|
||||
col = rgb(235, 80, 80)
|
||||
}
|
||||
@@ -339,6 +346,8 @@ func drawTray(hdc uintptr, w, h int32) {
|
||||
drawSysIcon(hdc, it.r)
|
||||
case trayGM:
|
||||
drawGMIcon(hdc, it.r)
|
||||
case trayEmoji:
|
||||
drawEmojiIcon(hdc, it.r)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -598,6 +607,9 @@ func tapChord(mod, k uintptr) {
|
||||
// trayClick opens the matching Windows panel with its keyboard shortcut.
|
||||
const vkEscape = 0x1B
|
||||
|
||||
// vkPeriod is the . key; Win+. opens the Windows emoji panel.
|
||||
const vkPeriod = 0xBE
|
||||
|
||||
// overflowOpen reports whether the hidden icons flyout is on screen.
|
||||
func overflowOpen() bool {
|
||||
for _, class := range []string{"TopLevelWindowForOverflowXamlIsland", "NotifyIconOverflowWindow"} {
|
||||
@@ -625,6 +637,8 @@ func trayClick(kind int) {
|
||||
sysToggle()
|
||||
case trayGM:
|
||||
gmToggle()
|
||||
case trayEmoji:
|
||||
tapChord(vkLWin, vkPeriod) // Win+. opens the emoji panel
|
||||
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.
|
||||
@@ -756,6 +770,8 @@ func handleTrayCommand(cmd uintptr) bool {
|
||||
case menuGMCloseID:
|
||||
gmClose()
|
||||
redraw(hwndMain)
|
||||
case menuEmojiID:
|
||||
tapChord(vkLWin, vkPeriod)
|
||||
case menuSysCopyID:
|
||||
if clipboardSet(sysText(sysGather())) {
|
||||
sysCopied = "Copied everything"
|
||||
@@ -778,7 +794,7 @@ func handleTrayCommand(cmd uintptr) bool {
|
||||
// ---------- the right row can be rearranged too ----------
|
||||
|
||||
// trayOrder is the left to right order of the items to the right of center.
|
||||
var trayOrder = []int{trayClock, trayWeather, trayNews, traySys, trayGM, trayBattery, trayVolume, trayWifi, trayChevron}
|
||||
var trayOrder = []int{trayClock, trayWeather, trayNews, traySys, trayGM, trayEmoji, trayBattery, trayVolume, trayWifi, trayChevron}
|
||||
|
||||
var (
|
||||
dragTray int // the tray item the mouse went down on, 0 for none
|
||||
@@ -797,7 +813,7 @@ func loadTrayOrder() {
|
||||
seen := map[int]bool{}
|
||||
for _, p := range strings.Split(strings.TrimSpace(string(b)), ",") {
|
||||
n, err := strconv.Atoi(strings.TrimSpace(p))
|
||||
if err != nil || n < trayClock || n > trayGM || seen[n] {
|
||||
if err != nil || n < trayClock || n > trayEmoji || seen[n] {
|
||||
return
|
||||
}
|
||||
seen[n] = true
|
||||
@@ -828,6 +844,9 @@ func loadTrayOrder() {
|
||||
if !seen[trayGM] {
|
||||
insertAfter(traySys, trayGM)
|
||||
}
|
||||
if !seen[trayEmoji] {
|
||||
insertAfter(trayGM, trayEmoji)
|
||||
}
|
||||
if len(order) == len(trayOrder) {
|
||||
trayOrder = order
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user