Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ function createSSWindow(argv) {
transparent: true,
frame: nq,
icon: path.join(__dirname, 'icon.ico'),
show: false
show: false,
resizable: false //avoid user resize screensaver and click other element behind screensaver
})
if (store.get("onlyShowVideoOnPrimaryMonitor") && displays[i].id !== screen.getPrimaryDisplay().id) {
win.loadFile('web/black.html');
Expand Down Expand Up @@ -506,6 +507,8 @@ function setUpConfigFile() {
}
store.set('randomSpeed', store.get('randomSpeed') ?? 30);
store.set('videoQuality', store.get('videoQuality') ?? false);
store.set('wakeOnMouseMovement', store.get('wakeOnMouseMovement') ?? true);
store.set('wakeOnMouseClick', store.get('wakeOnMouseClick') ?? true);
store.set('fps', store.get('fps') ?? 60);

//config
Expand Down
8 changes: 8 additions & 0 deletions web/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ <h3>Advanced Settings</h3>
onclick="updateSetting('videoQuality','check')">
<label for="videoQuality">Disable all video processing</label>
<br>
<input type="checkbox" id="wakeOnMouseMovement" class="w3-check"
onclick="updateSetting('wakeOnMouseMovement','check')">
<label for="wakeOnMouseMovement">Wake on mouse movement</label>
<br>
<input type="checkbox" id="wakeOnMouseClick" class="w3-check"
onclick="updateSetting('wakeOnMouseClick','check')">
<label for="wakeOnMouseClick">Wake on mouse click</label>
<br>
<hr>
<button class="w3-button w3-white w3-border w3-border-blue w3-round-large"
style="font-size: small"
Expand Down
2 changes: 1 addition & 1 deletion web/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let customVideos = electron.store.get("customVideos");

//Updates all the <input> tags with their proper values. Called on page load
function displaySettings() {
let checked = ["timeOfDay", "skipVideosWithKey", "sameVideoOnScreens", "videoCache", "videoCacheProfiles", "videoCacheRemoveUnallowed", "avoidDuplicateVideos", "onlyShowVideoOnPrimaryMonitor", "videoQuality", "immediatelyUpdateVideoCache", "useTray", "blankScreen", "sleepAfterBlank", "lockAfterRun", "alternateRenderMethod", "useLocationForSunrise", "runOnBattery", "enableGlobalShortcut"];
let checked = ["timeOfDay", "skipVideosWithKey", "sameVideoOnScreens", "videoCache", "videoCacheProfiles", "videoCacheRemoveUnallowed", "avoidDuplicateVideos", "onlyShowVideoOnPrimaryMonitor", "videoQuality", "immediatelyUpdateVideoCache", "useTray", "blankScreen", "sleepAfterBlank", "lockAfterRun", "alternateRenderMethod", "useLocationForSunrise", "runOnBattery", "enableGlobalShortcut", "wakeOnMouseMovement", "wakeOnMouseClick"];
for (let i = 0; i < checked.length; i++) {
$(`#${checked[i]}`).prop('checked', electron.store.get(checked[i]));
}
Expand Down
23 changes: 15 additions & 8 deletions web/screensaver.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ let previousErrorId = "";
let numErrors = 1;
let screenNumber = null;
let randomType, randomDirection;
let wakeOnMouseMovement = electron.store.get("wakeOnMouseMovement");
let wakeOnMouseClick = electron.store.get("wakeOnMouseClick");

function quitApp() {
electron.ipcRenderer.send('quitApp');
Expand All @@ -19,15 +21,20 @@ function quitApp() {
document.addEventListener('keydown', (e) => {
electron.ipcRenderer.send('keyPress', e.code);
});
document.addEventListener('mousedown', quitApp);

if (wakeOnMouseClick) {
document.addEventListener('mousedown', quitApp);
}
setTimeout(function () {
var threshold = 5;
document.addEventListener('mousemove', function (e) {
if (threshold * threshold < e.movementX * e.movementX
+ e.movementY * e.movementY) {
quitApp();
}
});
if (wakeOnMouseMovement) {
var threshold = 5;
document.addEventListener('mousemove', function (e) {
if (threshold * threshold < e.movementX * e.movementX
+ e.movementY * e.movementY) {
quitApp();
}
});
}
}, 1500);

let containers = [document.getElementById("video"), document.getElementById("video2")]
Expand Down