zserge / lorca

Build cross-platform modern desktop apps in Go + HTML5
MIT License
8.04k stars 535 forks source link

Possible to make the UI have less Chrome functionality, particularly on right click? #66

Closed shaun-wilson closed 5 years ago

shaun-wilson commented 5 years ago

I'm trying out lorca and I am new to Go. I have created a little web server and have got it showing in a UI with lorca (on win 10 if that matters). I have noticed that the UI window is still basically Chrome, but without the menus and tab bars. For example;

Can any of this be disabled by lorca, or is limiting the functionality only possible via the tools of HTML/CSS/JS? I don't think that CSS/JS will resolve the right click on the titlebar problems at all.

How does Electron handle this? (I've not developed with it)

velut commented 5 years ago

Hi,

Some options are more customizable than others. Also note that in the README among the listed limitations there is this:

No control over the Chrome window yet (e.g. you can't remove border, make it transparent, control position or size).

With respect to your questions:

I can right click on the background, and the menu is the same as in Chrome, with commands like "Cast" and "Translate to English", Back/Forward, etc.

Try searching for javascript disable/replace context menu. You can find solutions like:

https://stackoverflow.com/questions/737022/how-do-i-disable-right-click-on-my-web-page

http://jsfiddle.net/z9rgoxLu/2/

I can select and copy text.

Try searching for javascript prevent copy paste, there are some solutions.

If I hover over a hyperlink, the tooltip appears in the bottom of the window with the new address.

This seems difficult without manipulating links from javascript.

If I right click on a hyperlink, I can do things like "Open in Tab", which starts up a full version of Chrome.

I think disabling right-clicks (your first point) should help with this.

If I right click on the programs titlebar, I get options like Print, Zoom, Back/Forward, "Open Browser Window", etc.

I don't think that this can be disabled.

You could run your app in kiosk mode by passing the --kiosk flag to lorca.New().

See

https://www.chromium.org/developers/how-tos/run-chromium-with-flags

https://github.com/zserge/lorca/blob/de29b2b46deca1fa1d13132745c74b8290fcd582/ui.go#L61

How does Electron handle this? (I've not developed with it)

Electron should be more customizable, it does have frameless windows built in for example.

https://electronjs.org/docs/api/frameless-window