dawenxi-tech / 2fa

A 2FA desktop application.
MIT License
1 stars 1 forks source link

windows support: SysTray and Installer, and possibly Service too #10

Open gedw99 opened 8 months ago

gedw99 commented 8 months ago

Would like to try to get this working on Windows.

There is another dev that is on windows and working on sys tray so will add him.

@DawenxiTech FYI

Couple of questions:

https://github.com/dawenxi-tech/gio/blob/4848fecd5bb43bb5e7ed21c85f1b5452a6fd41d1/app/os_windows.go looks like the one to work on ?

Shall we try to eventually get a PR into gio main ?

heramerom commented 8 months ago

Thank you for help. I was add tray_windows.go on my local repository try to add tray on windows last night, but there are some problem, it don't display icon and menu on my windows 11. I don't know why and I will try resolve it.

I will push a PR to make windows works but without tray tonight.

gedw99 commented 8 months ago

hey @heramerom thats great. no rush btw - take it slow and steady :)

When you have something, I will try it on my windows arm64 and feedback.

gedw99 commented 8 months ago

In case it helps..

gogio -target windows -arch amd64 -appid tech.someone.2fa -icon ./assets-backup/something.png -o ./dist/release/windows/exe/amd64/2FA.exe .
gogio: go build -ldflags=-H=windowsgui -X gioui.org/app/internal/log.appID=tech.someone.2fa -tags= -o ./dist/release/windows/exe/amd64/2FA.exe . failed: # github.com/dawenxi-tech/2fa/tray
Error: tray\tray.go:19:2: undefined: show_tray
Error: tray\tray.go:23:2: undefined: dismiss_tray
Error: tray\tray.go:31:2: undefined: bring_window_to_front
Error: tray\tray.go:35:2: undefined: change_application_activation_policy

https://github.com/gedw99/2fa/actions/runs/7034294593/job/19142004038 has full log.

heramerom commented 8 months ago

Is this still error? I have pushed some code yet.

gedw99 commented 8 months ago

Hey @heramerom and @DawenxiTech

I just ed wants to summarise this. There are 2 elements:

  1. The Windows SysTray.
  2. The installer for a MSI. The current one only does MacOS.

as far as I know @DawenxiTech is a Windows dev, so maybe this helps..

gedw99 commented 8 months ago

Also I noticed that the GIO GUI allows setting a preference for if the Clients SysTray is long running @heramerom ?

I did not have a chance to see where it stores that state, but the intent seems to be that its about if the Sys Tray starts up when the GUI starts up ?

I can't help but think that we might need a OS Service startup then, so that it starts up when the OS starts up. Then if the GUI preferences says to show the SysTray it shows it.

I also can't help but to think that we then need a Client Service, and the Client GUI talks to the Client Service to save codes.json. I know this is NOT how its designed currently, as there is no RPC I the system currently.

There is an excellent golang module for this we can use that is cross platform BTW.

Also, GIO has a Preferences Component that might work well for storing this GUI state.

So, hopefully you can see that we need to decide if we need a Client Service. This will make Sync work much better, because even if the GUI and Systray is not running, the Sync system will be able to run !!! Let me know what you think ...