Skip to content

Commit

Permalink
feat: add launch in fullscreen on startup toggle (#563)
Browse files Browse the repository at this point in the history
Co-authored-by: ਸਹਜਪ੍ਰੀਤ ਸਿੰਘ  <saihajpreet.singh@gmail.com>
Co-authored-by: Harjot Singh <harjot@harkul.com>
  • Loading branch information
3 people authored Jun 29, 2020
1 parent e3e9963 commit 466dc23
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/electron/electron-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { app } from 'electron'

import logger from '../lib/logger'
import { isDev } from '../lib/consts'

import { createMainWindow, createNonMainWindows, closeNonMainWindows, createWindow, createSplashScreen, getMainWindow } from './window'
import { createMainWindow, createNonMainWindows, closeNonMainWindows, createWindow, createSplashScreen, getMainWindow, getDisplayWindows } from './window'
import { setBeta, initUpdates, checkUpdates, UPDATER_ERRORS } from './updates'


let splashScreen

app.on( 'ready', () => {
Expand All @@ -17,6 +17,12 @@ app.on( 'ready', () => {
} )

const onSettingsChange = ( { system } ) => {
// Fullscreen any display windows on start, if set
const windows = getDisplayWindows()
Object.values( windows ).forEach( window => window.once( 'ready-to-show', () => {
window.setSimpleFullScreen( system.fullscreenOnLaunch )
} ) )

// Toggle multiple displays
if ( system.multipleDisplays ) createNonMainWindows()
else closeNonMainWindows()
Expand All @@ -31,7 +37,6 @@ const onServerReady = server => {

// Create the main window
createMainWindow()

// Close splashscreen when the main window has been shown
getMainWindow().once( 'show', () => splashScreen.close() )
}
Expand Down
3 changes: 3 additions & 0 deletions app/frontend/src/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
faDesktop,
faTags,
faSearch,
faExpandArrowsAlt,
faRemoveFormat,
} from '@fortawesome/free-solid-svg-icons'
import {
Expand Down Expand Up @@ -115,6 +116,7 @@ export const OPTIONS = {
private: { name: 'Private Settings', icon: faLock, type: OPTION_TYPES.toggle, privacy: PRIVACY_TYPES.private },
launchOnStartup: { name: 'Launch On Startup', icon: faDoorOpen, type: OPTION_TYPES.toggle, privacy: PRIVACY_TYPES.global },
multipleDisplays: { name: 'All Displays', icon: faDesktop, type: OPTION_TYPES.toggle, privacy: PRIVACY_TYPES.global },
fullscreenOnLaunch: { name: 'Launch In Fullscreen', icon: faExpandArrowsAlt, type: OPTION_TYPES.toggle, privacy: PRIVACY_TYPES.global },
serverAnalytics: { name: 'Server Usage Analytics', icon: faChartPie, type: OPTION_TYPES.toggle, privacy: PRIVACY_TYPES.global },
automaticUpdates: { name: 'Automatic Updates', icon: faSync, type: OPTION_TYPES.toggle, privacy: PRIVACY_TYPES.global },
betaOptIn: { name: 'Beta Updates', icon: faFlask, type: OPTION_TYPES.toggle, privacy: PRIVACY_TYPES.global },
Expand Down Expand Up @@ -272,6 +274,7 @@ export const DEFAULT_OPTIONS = {
//! Currently not implemented
// launchOnStartup: false,
multipleDisplays: true,
fullscreenOnLaunch: false,
serverAnalytics: true,
automaticUpdates: true,
betaOptIn: false,
Expand Down
1 change: 1 addition & 0 deletions app/settings.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"system": {
"launchOnStartup": false,
"multipleDisplays": true,
"fullscreenOnLaunch": false,
"serverAnalytics": true,
"automaticUpdates": true,
"betaOptIn": false
Expand Down

0 comments on commit 466dc23

Please sign in to comment.