Skip to content

Commit

Permalink
Merge pull request #3358 from mitchell-foote/windows-kiosk-mode
Browse files Browse the repository at this point in the history
Windows kiosk mode
  • Loading branch information
alexanderson1993 authored Aug 20, 2024
2 parents 6a4380c + 285d0c6 commit 665179a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## [3.13.1](https://github.com/Thorium-Sim/thorium/compare/3.13.0...3.13.1) (2024-05-29)


### Bug Fixes

* Fix issues in the build and release process. ([df7e5c5](https://github.com/Thorium-Sim/thorium/commit/df7e5c5ae6709de0f4bb925ef2cb3c8b8f02d010))
* Moved to Node 16, and removed node-sass to make the build work ([d3c5534](https://github.com/Thorium-Sim/thorium/commit/d3c5534fab568da9934e9ad61f0630e2ed998a58))

# [3.13.0](https://github.com/Thorium-Sim/thorium/compare/3.12.1...3.13.0) (2024-05-27)


Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "thorium",
"version": "3.13.0",
"version": "3.13.1",
"description": "Starship Simulator Controls",
"private": true,
"repository": {
Expand Down Expand Up @@ -385,8 +385,6 @@
"param-case": "3.0.3",
"@babel/preset-env": "^7.8.7"
},
"volta": {
"node": "16.20.2"
},
"volta": { "node": "16.20.2" },
"packageManager": "yarn@1.22.1"
}
9 changes: 6 additions & 3 deletions public/electron/helpers/hotkeys.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const {app, globalShortcut, BrowserWindow} = require("electron");
const {windows} = require("./multiWindow");
const {clearMenubar, setMenubar} = require("./setMenubar");
const { app, globalShortcut, BrowserWindow } = require("electron");
const { clearMenubar, setMenubar } = require("./setMenubar");

module.exports = () => {
globalShortcut.register("CommandOrControl+Alt+R", function () {
// This grabs all non-server windows, as the server window doesn't have a uniqueId.
const windows = BrowserWindow.getAllWindows().filter((each) => each.uniqueId);
windows.forEach(mainWindow => {
mainWindow && mainWindow.reload();
});
Expand All @@ -14,6 +15,8 @@ module.exports = () => {
focused && focused.webContents.openDevTools();
});
globalShortcut.register("CommandOrControl+Alt+K", function () {
// This grabs all non-server windows, as the server window doesn't have a uniqueId.
const windows = BrowserWindow.getAllWindows().filter((each) => each.uniqueId);
if (windows[0] && windows[0].isKiosk()) {
windows.forEach(mainWindow => {
mainWindow.setKiosk(false);
Expand Down
20 changes: 13 additions & 7 deletions public/electron/helpers/setMenubar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const {Menu, BrowserWindow, app} = require("electron");
const {windows, addWindow} = require("./multiWindow");
const {getLoadedUrl} = require("./loadedUrl");
const { Menu, BrowserWindow, app } = require("electron");
const { addWindow } = require("./multiWindow");
const { getLoadedUrl } = require("./loadedUrl");

function templateFunc() {
var template = [
Expand All @@ -27,13 +27,15 @@ function templateFunc() {
label: "New Window",
accelerator: "CmdOrCtrl+N",
click: function () {
addWindow({loadedUrl: getLoadedUrl()});
addWindow({ loadedUrl: getLoadedUrl() });
},
},
{
label: "Reload",
accelerator: "CmdOrCtrl+Alt+R",
click: function () {
// This grabs all non-server windows, as the server window doesn't have a uniqueId.
const windows = BrowserWindow.getAllWindows().filter((each) => each.uniqueId);
windows.forEach(mainWindow => {
if (!mainWindow.isDestroyed()) {
mainWindow.reload();
Expand All @@ -46,6 +48,8 @@ function templateFunc() {
label: "Kiosk",
accelerator: "CmdOrCtrl+Alt+K",
click: function () {
// This grabs all non-server windows, as the server window doesn't have a uniqueId.
const windows = BrowserWindow.getAllWindows().filter((each) => each.uniqueId);
if (
windows[0] &&
!windows[0].isDestroyed() &&
Expand Down Expand Up @@ -81,9 +85,9 @@ function templateFunc() {
{
label: "Edit",
submenu: [
{label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:"},
{label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:"},
{label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:"},
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
{
label: "Select All",
accelerator: "CmdOrCtrl+A",
Expand All @@ -98,6 +102,8 @@ function templateFunc() {
function setMenubar() {
const template = templateFunc();
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
// This grabs all non-server windows, as the server window doesn't have a uniqueId.
const windows = BrowserWindow.getAllWindows().filter((each) => each.uniqueId);
windows.forEach(w => {
if (!w.isDestroyed()) {
w.setMenuBarVisibility(true);
Expand Down

0 comments on commit 665179a

Please sign in to comment.