diff --git a/addons/api/mirage/scenarios/ipc.js b/addons/api/mirage/scenarios/ipc.js index 04ff375d4..e10ef7508 100644 --- a/addons/api/mirage/scenarios/ipc.js +++ b/addons/api/mirage/scenarios/ipc.js @@ -127,10 +127,10 @@ export default function initializeMockIPC(server) { } /** - * Check for browsers running on windows OS + * Check for OS frame */ - isWindowsOS() { - return Boolean(window.navigator.userAgent.match(/(windows)/i)); + isFrameless() { + return true; } /** diff --git a/ui/desktop/README.md b/ui/desktop/README.md index 8efc3e47f..2751287f2 100644 --- a/ui/desktop/README.md +++ b/ui/desktop/README.md @@ -78,6 +78,7 @@ These environment variables may be used to customized the build. | `APP_UPDATER_LATEST_VERSION_TAG` | Next version for comparison with current version. | | `APP_UPDATER_LATEST_VERSION_LOCATION` | Location of app release to use for updating client. Can be a filepath or url. | | `BYPASS_CLI_SETUP` | Disable download and extraction of cli. For development use only. | +| `BYPASS_OS_SHELL` | Disable OS shell with window actions. For internal use only. | ### Building for Production diff --git a/ui/desktop/app/controllers/application.js b/ui/desktop/app/controllers/application.js index 10cf5fcc7..27471994d 100644 --- a/ui/desktop/app/controllers/application.js +++ b/ui/desktop/app/controllers/application.js @@ -15,13 +15,12 @@ export default class ApplicationController extends Controller { // =attributes /** - * Display OS window actions (minimize, fullscreen, close) for - * Windows and Linux as OS frame/shell is disable. - * Does not apply to MacOS. + * Check for MacOS frame * @type {boolean} */ - @computed('isMacOS') - get isFrameless() { - return !this.isMacOS; + @computed('isMacOS', 'isFrameless') + get hasMacOSFrame() { + console.log('hasMacOSFrame ', this.isMacOS && !this.isFrameless); + return this.isMacOS && !this.isFrameless; } } diff --git a/ui/desktop/app/routes/application.js b/ui/desktop/app/routes/application.js index 4acb8a175..55bae783d 100644 --- a/ui/desktop/app/routes/application.js +++ b/ui/desktop/app/routes/application.js @@ -31,10 +31,11 @@ export default class ApplicationRoute extends Route { } /** - * Add OS config on controller. + * Add window frame config on controller. */ async setupController(controller) { controller.set('isMacOS', await this.ipc.invoke('isMacOS')); + controller.set('isFrameless', await this.ipc.invoke('isFrameless')); } // =actions diff --git a/ui/desktop/app/templates/application.hbs b/ui/desktop/app/templates/application.hbs index 501eb1db1..78f749688 100644 --- a/ui/desktop/app/templates/application.hbs +++ b/ui/desktop/app/templates/application.hbs @@ -1,3 +1,5 @@ + + {{page-title (app-name)}} diff --git a/ui/desktop/electron-app/src/index.js b/ui/desktop/electron-app/src/index.js index 66272336a..752a09fdf 100644 --- a/ui/desktop/electron-app/src/index.js +++ b/ui/desktop/electron-app/src/index.js @@ -113,11 +113,18 @@ app.on('ready', async () => { } Menu.setApplicationMenu(menuTemplate); + /** + * Enable electron OS frame for MacOS only. + * Disable frame regardless of OS using `BYPASS_OS_SHELL` + */ + let showFrame = isMac(); + if (process.env.BYPASS_OS_SHELL) showFrame = false; + const browserWindowOptions = { width: 1280, height: 760, - titleBarStyle: 'hiddenInset', - frame: isMac(), + frame: showFrame, + titleBarStyle: showFrame ? 'hiddenInset' : 'none', webPreferences: { partition, sandbox: true, diff --git a/ui/desktop/electron-app/src/ipc/handlers.js b/ui/desktop/electron-app/src/ipc/handlers.js index d66182f4c..c5e795e99 100644 --- a/ui/desktop/electron-app/src/ipc/handlers.js +++ b/ui/desktop/electron-app/src/ipc/handlers.js @@ -69,7 +69,14 @@ handle('connect', ({ target_id, token, host_id }) => handle('stop', ({ session_id }) => sessionManager.stopById(session_id)); /** - * Check for MacOS OS + * Check for frameless window state. Only MacOS uses default OS frame. + * Frameless window disables OS window actions (minimize, fullscreen, close). + * Enable `BYPASS_OS_SHELL` to bypass OS verification for frame. + */ +handle('isFrameless', () => !isMac() || process.env.BYPASS_OS_SHELL); + +/** + * Check for MacOS */ handle('isMacOS', () => isMac());