-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3db5d39
Showing
16 changed files
with
23,730 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
yarn.lock | ||
/dist | ||
.DS_Store |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
const Store = require('electron-store'); | ||
|
||
module.exports = new Store({ | ||
defaults: { | ||
backgroundUrl: 'https://example.com/' | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
html, | ||
body { | ||
padding: 0; | ||
margin: 0; | ||
background: transparent; | ||
} | ||
|
||
/* Use OS default fonts */ | ||
body { | ||
font-family: -apple-system, | ||
BlinkMacSystemFont, | ||
'Segoe UI', | ||
Roboto, | ||
Oxygen-Sans, | ||
Ubuntu, | ||
Cantarell, | ||
'Helvetica Neue', | ||
sans-serif, | ||
'Apple Color Emoji', | ||
'Segoe UI Emoji', | ||
'Segoe UI Symbol'; | ||
text-rendering: optimizeLegibility; | ||
font-feature-settings: 'liga', 'clig', 'kern'; | ||
} | ||
|
||
header { | ||
position: absolute; | ||
width: 500px; | ||
height: 250px; | ||
top: 50%; | ||
left: 50%; | ||
margin-top: -125px; | ||
margin-left: -250px; | ||
text-align: center; | ||
} | ||
|
||
header h1 { | ||
font-size: 60px; | ||
font-weight: 200; | ||
margin: 0; | ||
padding: 0; | ||
opacity: 0.7; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Electron Desktop Background</title> | ||
<link rel="stylesheet" href="index.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<header> | ||
<h1>Electron Desktop Background</h1> | ||
<p></p> | ||
</header> | ||
<section class="main"></section> | ||
<footer></footer> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
'use strict'; | ||
const path = require('path'); | ||
const { app, BrowserWindow, Menu } = require('electron'); | ||
/// const {autoUpdater} = require('electron-updater'); | ||
const { is } = require('electron-util'); | ||
const unhandled = require('electron-unhandled'); | ||
const debug = require('electron-debug'); | ||
const contextMenu = require('electron-context-menu'); | ||
const config = require('./config'); | ||
const menu = require('./menu'); | ||
const packageJson = require('./package.json'); | ||
const createTray = require('./tray'); | ||
const tray = null; | ||
unhandled(); | ||
// Debug(); | ||
contextMenu(); | ||
|
||
//app.setAppUserModelId(packageJson.build.appId); | ||
|
||
// Uncomment this before publishing your first version. | ||
// It's commented out as it throws an error if there are no published versions. | ||
// if (!is.development) { | ||
// const FOUR_HOURS = 1000 * 60 * 60 * 4; | ||
// setInterval(() => { | ||
// autoUpdater.checkForUpdates(); | ||
// }, FOUR_HOURS); | ||
// | ||
// autoUpdater.checkForUpdates(); | ||
// } | ||
|
||
// Prevent window from being garbage collected | ||
let mainWindow; | ||
|
||
const createMainWindow = async () => { | ||
const win = new BrowserWindow({ | ||
title: app.name, | ||
show: false, | ||
width: 600, | ||
height: 400, | ||
frame: false, | ||
type: 'desktop' | ||
}); | ||
|
||
win.on('ready-to-show', () => { | ||
win.show(); | ||
}); | ||
|
||
win.on('closed', () => { | ||
// Dereference the window | ||
// For multiple windows store them in an array | ||
mainWindow = undefined; | ||
}); | ||
|
||
// Await win.loadFile(path.join(__dirname, 'index.html')); | ||
await win.maximize(); | ||
await win.loadURL(config.get('backgroundUrl')); | ||
return win; | ||
}; | ||
|
||
// Prevent multiple instances of the app | ||
if (!app.requestSingleInstanceLock()) { | ||
app.quit(); | ||
} | ||
|
||
app.on('second-instance', () => { | ||
if (mainWindow) { | ||
if (mainWindow.isMinimized()) { | ||
mainWindow.restore(); | ||
} | ||
|
||
mainWindow.show(); | ||
} | ||
}); | ||
|
||
app.on('window-all-closed', () => { | ||
if (!is.macos) { | ||
app.quit(); | ||
} | ||
}); | ||
|
||
app.on('activate', () => { | ||
if (!mainWindow) { | ||
mainWindow = createMainWindow(); | ||
} | ||
}); | ||
|
||
(async () => { | ||
await app.whenReady(); | ||
Menu.setApplicationMenu(menu); | ||
mainWindow = await createMainWindow(); | ||
createTray(mainWindow); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
'use strict'; | ||
const path = require('path'); | ||
const {app, Menu, shell} = require('electron'); | ||
const { | ||
is, | ||
appMenu, | ||
aboutMenuItem, | ||
openUrlMenuItem, | ||
openNewGitHubIssue, | ||
debugInfo | ||
} = require('electron-util'); | ||
const config = require('./config'); | ||
|
||
const showPreferences = () => { | ||
// Show the app's preferences here | ||
}; | ||
|
||
const helpSubmenu = [ | ||
openUrlMenuItem({ | ||
label: 'Website', | ||
url: 'https://github.com/mattruzzi/undefined' | ||
}), | ||
openUrlMenuItem({ | ||
label: 'Source Code', | ||
url: 'https://github.com/mattruzzi/undefined' | ||
}), | ||
{ | ||
label: 'Report an Issue…', | ||
click() { | ||
const body = ` | ||
<!-- Please succinctly describe your issue and steps to reproduce it. --> | ||
--- | ||
${debugInfo()}`; | ||
|
||
openNewGitHubIssue({ | ||
user: 'mattruzzi', | ||
repo: 'electron-desktop-background', | ||
body | ||
}); | ||
} | ||
} | ||
]; | ||
|
||
if (!is.macos) { | ||
helpSubmenu.push( | ||
{ | ||
type: 'separator' | ||
}, | ||
aboutMenuItem({ | ||
icon: path.join(__dirname, 'static', 'icon.png'), | ||
text: 'Created by Matthew Ruzzi' | ||
}) | ||
); | ||
} | ||
|
||
const debugSubmenu = [ | ||
{ | ||
label: 'Show Settings', | ||
click() { | ||
config.openInEditor(); | ||
} | ||
}, | ||
{ | ||
label: 'Show App Data', | ||
click() { | ||
shell.openItem(app.getPath('userData')); | ||
} | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: 'Delete Settings', | ||
click() { | ||
config.clear(); | ||
app.relaunch(); | ||
app.quit(); | ||
} | ||
}, | ||
{ | ||
label: 'Delete App Data', | ||
click() { | ||
shell.moveItemToTrash(app.getPath('userData')); | ||
app.relaunch(); | ||
app.quit(); | ||
} | ||
} | ||
]; | ||
|
||
const macosTemplate = [ | ||
appMenu([ | ||
{ | ||
label: 'Preferences…', | ||
accelerator: 'Command+,', | ||
click() { | ||
showPreferences(); | ||
} | ||
} | ||
]), | ||
{ | ||
role: 'fileMenu', | ||
submenu: [ | ||
{ | ||
label: 'Custom' | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
role: 'close' | ||
} | ||
] | ||
}, | ||
{ | ||
role: 'editMenu' | ||
}, | ||
{ | ||
role: 'viewMenu' | ||
}, | ||
{ | ||
role: 'windowMenu' | ||
}, | ||
{ | ||
role: 'help', | ||
submenu: helpSubmenu | ||
} | ||
]; | ||
|
||
// Linux and Windows | ||
const otherTemplate = [ | ||
{ | ||
role: 'fileMenu', | ||
submenu: [ | ||
{ | ||
label: 'Custom' | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: 'Settings', | ||
accelerator: 'Control+,', | ||
click() { | ||
showPreferences(); | ||
} | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
role: 'quit' | ||
} | ||
] | ||
}, | ||
{ | ||
role: 'editMenu' | ||
}, | ||
{ | ||
role: 'viewMenu' | ||
}, | ||
{ | ||
role: 'help', | ||
submenu: helpSubmenu | ||
} | ||
]; | ||
|
||
const template = process.platform === 'darwin' ? macosTemplate : otherTemplate; | ||
|
||
if (is.development) { | ||
template.push({ | ||
label: 'Debug', | ||
submenu: debugSubmenu | ||
}); | ||
} | ||
|
||
module.exports = Menu.buildFromTemplate(template); |
Oops, something went wrong.