mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-24 15:38:12 +02:00
v0.5.4 : app macOS Jean.app (clic = UI web + icone barre de menus)
- Jean.app publie par la CI (zip par archi) : ouverture depuis le Finder -> mode application, comme le double-clic sur jean.exe sous Windows - icone dans la barre de menus macOS (systray/Cocoa) avec Ouvrir/Quitter, bundle marque LSUIElement (pas d'icone Dock) - builds darwin deplacees sur un runner macOS (CGO requis pour Cocoa) - signature ad-hoc du bundle + icone .icns
This commit is contained in:
1 parent
2f1f40c604
commit
ac171e5461
12 files changed
+261
-75
No files matched your search
@@ -0,0 +1,69 @@
|
||||
//go:build windows || darwin
|
||||
|
||||
package jean
|
||||
|
||||
// sys_tray_icon.go — icône de Jean pour la zone de notification (Windows) et la
|
||||
// barre de menus (macOS). RÉPLIQUE EXACTE du favicon de l'UI web : carré bleu
|
||||
// arrondi #1f6feb + « j » blanc (rects (6,3) (6,5) (4,7) sur une grille 12x12).
|
||||
// Générée à la volée — pas d'asset binaire à embarquer.
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"image"
|
||||
"image/color"
|
||||
"image/png"
|
||||
)
|
||||
|
||||
const trayIconSize = 32
|
||||
|
||||
// trayIconPNG rend l'icône en PNG 32x32 avec alpha (coins arrondis).
|
||||
func trayIconPNG() []byte {
|
||||
const n = 32
|
||||
blue := color.RGBA{0x1f, 0x6f, 0xeb, 0xff}
|
||||
white := color.RGBA{0xff, 0xff, 0xff, 0xff}
|
||||
clear := color.RGBA{0, 0, 0, 0}
|
||||
const r = 2.0 // rayon des coins, en unités de la grille 12
|
||||
// rects blancs du favicon (x, y, w, h en unités 12)
|
||||
rects := [][4]float64{{6, 3, 2, 2}, {6, 5, 2, 2}, {4, 7, 2, 2}}
|
||||
// hors du rectangle à coins arrondis (grille 12) → pixel transparent
|
||||
outside := func(gx, gy float64) bool {
|
||||
corner := func(cx, cy float64) bool {
|
||||
dx, dy := gx-cx, gy-cy
|
||||
return dx*dx+dy*dy > r*r
|
||||
}
|
||||
switch {
|
||||
case gx < r && gy < r:
|
||||
return corner(r, r)
|
||||
case gx > 12-r && gy < r:
|
||||
return corner(12-r, r)
|
||||
case gx < r && gy > 12-r:
|
||||
return corner(r, 12-r)
|
||||
case gx > 12-r && gy > 12-r:
|
||||
return corner(12-r, 12-r)
|
||||
}
|
||||
return false
|
||||
}
|
||||
img := image.NewRGBA(image.Rect(0, 0, n, n))
|
||||
scale := float64(n) / 12
|
||||
for y := 0; y < n; y++ {
|
||||
for x := 0; x < n; x++ {
|
||||
gx := (float64(x) + 0.5) / scale
|
||||
gy := (float64(y) + 0.5) / scale
|
||||
if outside(gx, gy) {
|
||||
img.Set(x, y, clear)
|
||||
continue
|
||||
}
|
||||
c := blue
|
||||
for _, rc := range rects {
|
||||
if gx >= rc[0] && gx < rc[0]+rc[2] && gy >= rc[1] && gy < rc[1]+rc[3] {
|
||||
c = white
|
||||
}
|
||||
}
|
||||
img.Set(x, y, c)
|
||||
}
|
||||
}
|
||||
|
||||
var pngBuf bytes.Buffer
|
||||
_ = png.Encode(&pngBuf, img)
|
||||
return pngBuf.Bytes()
|
||||
}
|
||||
Reference in new issue
Block a user