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
docs: add more fiddles for launch in fiddle
feature
#19849
Changes from 9 commits
996d5ae
bfcdaea
2f04660
358ba01
ee269f6
2bde4d9
8af1ddb
697b8a4
8939b26
103d657
010232b
558cb35
df84d32
b5b33a6
0b391cf
c70e89e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Adding a global shortcut to electron | ||
// | ||
// For more info, see: | ||
// https://electronjs.org/docs/api/screen | ||
|
||
const { app, globalShortcut, BrowserWindow } = require('electron') | ||
|
||
let mainWindow = null; | ||
|
||
app.on('ready', () => { | ||
// Register a 'CommandOrControl+Y' shortcut listener. | ||
globalShortcut.register('CommandOrControl+Y', () => { | ||
// Do stuff when Y and either Command/Control is pressed. | ||
console.log('shortcut...'); | ||
}); | ||
|
||
mainWindow = new BrowserWindow({ | ||
width: 800, | ||
height: 600, | ||
webPreferences: { | ||
nodeIntegration: true | ||
} | ||
cvaldez98 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
|
||
// and load the index.html of the app. | ||
mainWindow.loadFile('index.html'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm there is no |
||
}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Creating a window in the external display | ||
// | ||
// For more info, see: | ||
// https://electronjs.org/docs/api/screen | ||
|
||
const electron = require('electron') | ||
const { app, BrowserWindow } = require('electron') | ||
cvaldez98 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
let win | ||
|
||
app.on('ready', () => { | ||
let displays = electron.screen.getAllDisplays() | ||
cvaldez98 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let externalDisplay = displays.find((display) => { | ||
return display.bounds.x !== 0 || display.bounds.y !== 0 | ||
}) | ||
|
||
if (externalDisplay) { | ||
win = new BrowserWindow({ | ||
x: externalDisplay.bounds.x + 50, | ||
y: externalDisplay.bounds.y + 50 | ||
}) | ||
win.loadURL('https://electronjs.org') | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about an else case with a console.log("no ext display or so")? |
||
}) |
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 point to the global shortcut docs :)