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

dexc in system tray #1828

Merged
merged 6 commits into from
Sep 27, 2022
Merged

dexc in system tray #1828

merged 6 commits into from
Sep 27, 2022

Conversation

chappjc
Copy link
Member

@chappjc chappjc commented Aug 28, 2022

image

Works in Linux, Windows, Mac OS/X (supposedly). Only tested on Linux and Window so far. No cgo required in Linux.

On Windows, it can be build with -ldflags "-H=windowsgui" to not even open a terminal window when run.

Now that we have site resources embedded, this means that a Windows user can just download and extract "dexc.exe" and just double click it without any terminal interactions required.

Requires #1829

windows-tray.mp4

dex-tray-w11

TODO:

  • get rid of the ugly icon on the "Launch browser" menu item because it does not respect alpha/transparency like the tray icon itself
  • when clicking "Open config file" it needs logic to create it if it does not exist. Also rename to "Edit config file"

@chappjc chappjc marked this pull request as ready for review August 29, 2022 13:07
@chappjc
Copy link
Member Author

chappjc commented Aug 29, 2022

The icon for the menu item (not the tray icon itself) is a little wonky on windows 7 but otherwise this is working fine. Just need #1829 to go first.

@chappjc
Copy link
Member Author

chappjc commented Aug 29, 2022

Works alright on Windows 11 too:

dex-tray-w11

TODO:

  • get rid of the ugly icon on the "Launch browser" menu item because it does not respect alpha/transparency like the tray icon itself
  • when clicking "Open config file" it needs logic to create it if it does not exist. Also rename to "Edit config file"

@chappjc chappjc force-pushed the tray branch 2 times, most recently from 54c56da to 6817b63 Compare August 30, 2022 00:57
@JoeGruffins
Copy link
Member

JoeGruffins commented Aug 30, 2022

It's been a while, but can't seem to build correctly on Windows 10. I don't see any errors. attempting to run the executable does nothing. Ill try building on linux and sending the bin to windows. Any flags I need besides the -ldflags "H=windowsgui"?

@chappjc
Copy link
Member Author

chappjc commented Aug 30, 2022

It's been a while, but can't seem to build correctly on Windows 10. I don't see any errors. attempting to run the executable does nothing. Ill try building on linux and sending the bin to windows. Any flags I need besides the -ldflags "H=windowsgui"?

Could you be missing the site dir before build?

@JoeGruffins
Copy link
Member

Actually it is running! I can go to http://127.0.0.1:5758 and see the site. I however do not see it in the system tray.

@chappjc
Copy link
Member Author

chappjc commented Aug 31, 2022

Is it in the tray as one of the disabled/hidden icons that you have to whitelist?
That's what I saw on Windows 11. I had to click the little "^" icon to see all the hidden tray icons

image

@JoeGruffins
Copy link
Member

No, I do not see it there. Sorry for slow response. Where is my task manager...

@JoeGruffins
Copy link
Member

image

@chappjc chappjc force-pushed the tray branch 2 times, most recently from 0172867 to 08a017e Compare August 31, 2022 13:37
@chappjc
Copy link
Member Author

chappjc commented Aug 31, 2022

Sadly I only have Linux, Windows 7 and Windows 11, but not Windows 10.

My only guess is that there's a W10 bug, which does seem to be common:
https://answers.microsoft.com/en-us/windows/forum/all/icons-from-deleted-programs-apppeared-in-task-bar/9fa65ff1-ee90-4935-8073-abc301eceeb5
https://winaero.com/fix-notification-area-system-tray-icons-are-messed-up-in-windows-10/

If it is really super common, that could be a showstopper though.

@JoeGruffins
Copy link
Member

Sorry, I goofed up. It is working.

image

I didn't realize there was a new dex-tray folder with a different executalbe to build. Building there works! Apologies.

@chappjc
Copy link
Member Author

chappjc commented Sep 1, 2022

I didn't realize there was a new dex-tray folder with a different executalbe to build

Ahhhh! I should have noticed that from your task manager you shared offline

@JoeGruffins
Copy link
Member

Why does there need to be a new folder? We need to keep up with the two now. Things here don't really change that much over time, but seems like we could have build flags if you wanted to build the tray support like --tags tray and put the initiation logic in a separate file?

@chappjc
Copy link
Member Author

chappjc commented Sep 1, 2022

Why does there need to be a new folder? We need to keep up with the two now. Things here don't really change that much over time, but seems like we could have build flags if you wanted to build the tray support like --tags tray and put the initiation logic in a separate file?

I'm trying, perhaps a little too hard, to avoid putting these two new depends in the main module's go.mod. I'll see how it feels merged with build tags instead.

@chappjc chappjc marked this pull request as draft September 1, 2022 16:35
@chappjc chappjc force-pushed the tray branch 3 times, most recently from 2fb46f1 to b6343b7 Compare September 2, 2022 15:51
@chappjc chappjc marked this pull request as ready for review September 2, 2022 15:53
@chappjc chappjc added this to the 0.6/1.0 milestone Sep 22, 2022
Copy link
Member

@buck54321 buck54321 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant! Working beautifully on Linux. May fire up Windows later, but don't wait on me.

Copy link
Member

@JoeGruffins JoeGruffins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working well on windows.

@chappjc
Copy link
Member Author

chappjc commented Sep 27, 2022

Mac:

image

Open logs folder works.

Edit config file only works if you first associate the text editor with .conf files. Otherwise the console says:

No application knows how to open URL file:///Users/jon/Library/Applicatoin%20Support/Dexc/dexc.conf (Error Domain=NSOSStatusErrorDomain Code=-10814 "kLSApplicationNotFoundErr: E.g. no application claims the file" UserInfo={_LSLine=1489, _LSFunction=runEvaluator}).

Perhaps a .ini extension would open without having to change file associations. Not worth the effort now though.

@chappjc chappjc merged commit a0ee939 into decred:master Sep 27, 2022
@chappjc chappjc deleted the tray branch September 27, 2022 15:38
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

Successfully merging this pull request may close these issues.

3 participants