-
Notifications
You must be signed in to change notification settings - Fork 102
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-desktop: prepare installable desktop app #1957
Conversation
Cool. One of the reasons I had closed the PoC webview PR (#1452) was because webview had appeared to be dead with about a year of no commits, but it seems to have been brought back to life earlier this year. We should request a stable release tag if we wanna commit to it as a framework for a dex desktop app. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I'm glad webview is getting regular maintenance and you made the effort to properly productize with it!
Will definitely review asap, just a few comments from a quick scan.
I'm not commited to WebView at all. Honestly, if I didn't have anyone to answer to, I would just include a chromium binary with the distro and run it with |
If licensing permits, I wouldn't object to that given we can sandbox the thing so it doesn't fiddle with the user's chromium settings. |
I'm pretty sure we'd have to have the app behave like a "downloader" to fetch the browser because third party binaries with ours is what would be problematic in terms of licensing. |
12a618e
to
b2473d0
Compare
Still Webview, just a separate process for windows. |
cbecf72
to
bb03538
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The webview is working great for me.
There is no build dir the first time you run the build script.
+ DESKTOPICON_BUILDPATH=./build/dexc_0.6.0-pre-0_amd64/usr/share/pixmaps/dexc.png
+ rm -r ./build
rm: cannot remove './build': No such file or directory
if resp.StatusCode == http.StatusOK { | ||
log.Errorf("Unexpected response code from kill signal send: %d (%s)", resp.StatusCode, http.StatusText(resp.StatusCode)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be !=
?
case s.openC <- struct{}{}: | ||
log.Info("Window reopened") | ||
default: | ||
log.Infof("Ignored a window reopen request from another instance") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Nothing to format, here and in a few more places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When this goes in we can squash with you as author. After squash, git commit --amend --author="buck54321 <[email protected]>"
, and ideally tweaked commit message like
add cmd/dexc-desktop
Introduce a new cmd, dexc-desktop. This coordinates a WebView
window with our normal dexc stack.
Prepare Debian archive for installation, including control files,
Desktop Entry specificiation and icons. User can install with
their preferred package manager.
Moves some common utilities to a new package client/app.
Co-authored-by: Jonathan Chappelow <[email protected]>
The pkg-debian.sh addition would ideally be a second commit since dexc-desktop is mostly unrelated to Debian.
client/cmd/dexc-desktop/main.go
Outdated
m.Unlock() | ||
defer closeWindow(windowID) | ||
|
||
cmd.Run() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check and log please
client/cmd/dexc-desktop/main.go
Outdated
// TODO: Enable toggling automatic startup on boot. This would be part of a | ||
// larger effort aimed at securing refunds through system restarts. | ||
// https://github.com/decred/dcrdex/pull/1957#discussion_r1020780014 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems firmly in the realm of user/os setup. At best an installer. Do you mean this app itself that is running dex core would make changes the the user/os env to make auto-startup?
My view is that users start programs that they want to run. We can facilitate system service setup with scripts, systemd configs, installer, etc., but I don't think this app code should be concerned with that.
06a8919
to
dfdfd39
Compare
Ran the dexc-desktop on my Mac and hit this panic immediately. Panic logs
|
@ukane-philemon Would you try a fresh project with just this to see if it works on your mac? package main
import "github.com/webview/webview"
func main() {
w := webview.New(false)
defer w.Destroy()
w.SetTitle("Example")
w.SetSize(480, 320, webview.HintNone)
w.Navigate("http://127.0.0.1:8080")
w.Run()
} |
The issue for MacOS is executing |
Nice. I think I recall that issue when working on dexc/main_tray.go |
client/cmd/dexc-desktop/main.go
Outdated
windowloop: | ||
for { | ||
var backgroundNoteSent bool | ||
select { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like main needs a refactor so that this is in a goroutine and main is just blocking on systray.Run
.
Yup, no panic with your suggestion. #1957 (comment) |
While testing #2333, I noticed that the |
@buck54321, I have some code suggestions that might interest you here e2a3f17. |
I added a debug-level log for the the output of |
@ukane-philemon maybe try with the |
Okay. |
log.Infof("Closing window. %d windows remain open.", remain) | ||
cmd.Process.Kill() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I shut down before a webview is opened, I see a panic since cmd.Process
will still be nil but have been added to m.windows
giving another process an opportunity to access cmd.Process
.
client/cmd/dexc-desktop/main.go
Outdated
w.SetTitle("Decred DEX Client") | ||
w.SetSize(int(C.display_width()), int(C.display_height()), webview.HintNone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also set a min width
here. w.SetSize(600, 600, webview.HintMin)
(min width & height can be anything > 100). The webview almost disappears when I click on minimise and it doesn't look good if users can minimise the window all the way.
client/cmd/dexc-desktop/main.go
Outdated
systray.Run(func() { | ||
systrayOnReady(appCtx, filepath.Dir(cfg.LogPath), openC, killChan) | ||
}, func() { | ||
wg.Done() | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should remove wg.Done()
, the last func
argument can just be nil.
client/cmd/dexc-desktop/main.go
Outdated
defer wg.Done() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also defer cancel()
here since we will no longer be able to create new windows if this goroutine is exited.
Made some conflicts for you. Getting to final review though |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still testing stuff, but have a couple tiny issues to report before taking a break.
package a desktop version for Debian Introduce a new cmd, dexc-desktop. This coordinates a WebView window with our normal dexc stack. Moves some common utilities to a new package client/app. Co-authored-by: Jonathan Chappelow <[email protected]>
Prepare Debian archive for installation, including control files, Desktop Entry specificiation and icons. User can install with their preferred package manager.Debian packaging moved to separate branch.