Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu width not restored when making text narrower #66

Open
kokororin opened this issue Nov 22, 2023 · 3 comments
Open

Menu width not restored when making text narrower #66

kokororin opened this issue Nov 22, 2023 · 3 comments

Comments

@kokororin
Copy link

Set the title of a menu to a longer character, then restore it. The width of the menu will not be restored.

image
image
image

minimal reproducible example:

package main

import (
	"fmt"
	"time"

	"fyne.io/systray"
	"fyne.io/systray/example/icon"
)

func main() {
	onExit := func() {
		now := time.Now()
		fmt.Println("Exit at", now.String())
	}

	systray.Run(onReady, onExit)
}

func addQuitItem() {
	mQuit := systray.AddMenuItem("Quit", "Quit the whole app")
	mQuit.Enable()
	go func() {
		<-mQuit.ClickedCh
		fmt.Println("Requesting quit")
		systray.Quit()
		fmt.Println("Finished quitting")
	}()
	systray.AddSeparator()
}

func onReady() {
	systray.SetTemplateIcon(icon.Data, icon.Data)
	systray.SetTitle("Awesome App")
	systray.SetTooltip("Lantern")
	addQuitItem()

	// We can manipulate the systray in other goroutines
	go func() {
		systray.SetTitle("Awesome App")
		systray.SetTooltip("Pretty awesome棒棒嗒")
		mChange := systray.AddMenuItem("Change Me", "Change Me")
		mRestore := systray.AddMenuItem("Restore Me", "Restore Me")

		systray.AddMenuItem("Ignored", "Ignored")

		for {
			select {
			case <-mChange.ClickedCh:
				mChange.SetTitle("I've Changed, hahahahahaha")
			case <-mRestore.ClickedCh:
				mChange.SetTitle("Change Me")
			}
		}
	}()
}
@Jacalz Jacalz changed the title Menu with not restore Menu width not restored when making text narrower Nov 22, 2023
@Jacalz
Copy link
Member

Jacalz commented Nov 22, 2023

On what operating system (and potentially desktop environment if on Linux/BSD) are you experiencing this?

@Jacalz
Copy link
Member

Jacalz commented Nov 22, 2023

I can't seem to replicate on Gnome. The menu is just as wide with both the narrow and wide texts (before and after).

@kokororin
Copy link
Author

Windows 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants