branchseer / DeskGap

A cross-platform desktop app framework based on Node.js and the system webview
https://deskgap.com/
MIT License
1.83k stars 73 forks source link

No context menu #12

Open khariche opened 5 years ago

khariche commented 5 years ago

Hi, First of all, thank you for this very useful module. The only problem I find so far is that when pressing the right mouse button, there is no context menu. I have looked at the API, but cannot find a way to make it appear.

andymans commented 5 years ago

Have you looked at the DeskGap API Demo project? There's a context menu example in there. In brief - your keydown handler should make the following call:

const contextMenu = Menu.buildFromTemplate([{label: "Item One"},{label: "Item Two"}]); contextMenu.popup(browserWindow);

onMouseDown -> execute the above (or better - declare the above to be a function that can be called with different args according to where you are in your app.

You can find the example here

khariche commented 5 years ago

Hi, thank you so much. I am not a developer, just an end user who happened to discover Deskgap as a way to use the chrome "open as window" functionality but with Edge... Would it be too much to ask you to add the appropriate code in my index.js script (to have the regular edge browser context menu)? I am not knowledgeable enough... I totally understand if you don't want to do it:

const { app, BrowserWindow } = require('deskgap');

app.once('ready', () => { const win = new BrowserWindow({ title: "GMAIL", icon: "icon.ico" }); win.loadURL('https://www.google.com/gmail/'); win.setMenu(null); });

Thank you so much!

andymans commented 5 years ago

There's a slight difficulty with what you're trying to to. I'll try to explain: Generally you'd load your own 'local file' ie.. your own custom app as an html page using deskgap. If you're going this route then you can add javascript "in-page" to give you the full context menu.

Your requirement, though, is to load a remote page. When you're going that route it becomes more complex to access and manipulate the page (e.g. add menus etc). This is by design (think security etc.,)

Btw I'm not a Windows user, so I don't know what the "edge browser context menu" looks like. Maybe you can post a screen-shot of what it looks like?

Deskgap does provide a basic context menu when you've loaded a remote web-page like 'gmail" but it's an "element-only" menu - clicking on an image, hyperlink, text input will show the menu; but clicking on the page background will show nothing.

khariche commented 5 years ago

Thank you so much for answering! I understand the problem. In fact, i don't necessarily need the specific context menu from the Edge browser, but whatever context menu appears when using a normal browser on the different websites I use. What I have noticed, for example, is that when selecting and right clicking some text, instead of a helpful menu with options to edit, copy, paste, translate that text, I only get the window menu: restore, maximize, minimize, etc. Another problem I have spotted, is that with websites where there is a login, Deskgap doesn't memorize the credentials, which is deal breaker for me... If these two issues can be fixed, I would be interested in using the module, otherwise I would just stick with the chrome "open as window" functionality, even though it is heavier on resources.

Thanks again.

On Sat, Mar 2, 2019 at 12:31 PM Andy Manson notifications@github.com wrote:

There's a slight difficulty with what you're trying to to. I'll try to explain: Generally you'd load your own 'local file' ie.. your own custom app as an html page using deskgap. If you're going this route then you can add javascript "in-page" to give you the full context menu.

Your requirement, though, is to load a remote page. When you're going that route it becomes more complex to access and manipulate the page (e.g. add menus etc). This is by design (think security etc.,)

Btw I'm not a Windows user, so I don't know what the "edge browser context menu" looks like. Maybe you can post a screen-shot of what it looks like?

Deskgap does provide a basic context menu when you've loaded a remote web-page like 'gmail" but it's an "element-only" menu - clicking on an image, hyperlink, text input will show the menu; but clicking on the page background will show nothing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/patr0nus/DeskGap/issues/12#issuecomment-468912256, or mute the thread https://github.com/notifications/unsubscribe-auth/AtueUfgSRbX60fnLg7T190DUHFN1VZw0ks5vSmESgaJpZM4bO9Jr .