mirror of
https://github.com/tailscale/tailscale.git
synced 2025-05-01 13:11:01 +00:00
cmd/systray: add extra padding around notification icon
Some notification managers crop the application icon to a circle, so ensure we have enough padding to account for that. Updates #1708 Change-Id: Ia101a4a3005adb9118051b3416f5a64a4a45987d Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
parent
00a4504cf1
commit
2d4edd80f1
@ -128,8 +128,14 @@ var (
|
|||||||
|
|
||||||
// render returns a PNG image of the logo.
|
// render returns a PNG image of the logo.
|
||||||
func (logo tsLogo) render() *bytes.Buffer {
|
func (logo tsLogo) render() *bytes.Buffer {
|
||||||
const radius = 25
|
|
||||||
const borderUnits = 1
|
const borderUnits = 1
|
||||||
|
return logo.renderWithBorder(borderUnits)
|
||||||
|
}
|
||||||
|
|
||||||
|
// renderWithBorder returns a PNG image of the logo with the specified border width.
|
||||||
|
// One border unit is equal to the radius of a tailscale logo dot.
|
||||||
|
func (logo tsLogo) renderWithBorder(borderUnits int) *bytes.Buffer {
|
||||||
|
const radius = 25
|
||||||
dim := radius * (8 + borderUnits*2)
|
dim := radius * (8 + borderUnits*2)
|
||||||
|
|
||||||
dc := gg.NewContext(dim, dim)
|
dc := gg.NewContext(dim, dim)
|
||||||
|
@ -62,7 +62,7 @@ func onReady() {
|
|||||||
|
|
||||||
// dbus wants a file path for notification icons, so copy to a temp file.
|
// dbus wants a file path for notification icons, so copy to a temp file.
|
||||||
appIcon, _ = os.CreateTemp("", "tailscale-systray.png")
|
appIcon, _ = os.CreateTemp("", "tailscale-systray.png")
|
||||||
io.Copy(appIcon, connected.render())
|
io.Copy(appIcon, connected.renderWithBorder(3))
|
||||||
|
|
||||||
chState = make(chan ipn.State, 1)
|
chState = make(chan ipn.State, 1)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user