diff --git a/src/main.js b/src/main.js index 8162957f..c41b1a6e 100644 --- a/src/main.js +++ b/src/main.js @@ -78,6 +78,11 @@ if (!singleInstanceLock) { value: true, name: 'Exit Prompt', description: 'If this setting is enabled, the app will prompt you everytime you close the app. Disabling this will disable the prompt.' + }, + customTitlebar: { + value: true, + name: 'Custom Titlebar', + description: 'If you are having any issues with the custom titlebar, you can disable it using this setting. NOTE: This setting requires you to restart the whole app for changes to apply.' } } }); @@ -86,7 +91,7 @@ if (!singleInstanceLock) { app.on('ready', () => { mainWindow = new BrowserWindow({ title: `Altus ${app.getVersion()}`, - frame: false, + frame: !settings.get('customTitlebar.value'), titleBarStyle: 'hidden', backgroundColor: '#282C34', icon: './build/icon.ico', @@ -290,7 +295,7 @@ function createWindow(id) { } else { aboutWindow = new BrowserWindow({ title: `About Altus`, - frame: false, + frame: !settings.get('customTitlebar.value'), backgroundColor: '#282C34', titleBarStyle: 'hidden', width: 500, @@ -320,7 +325,7 @@ function createWindow(id) { } else { settingsWindow = new BrowserWindow({ title: `Settings`, - frame: false, + frame: !settings.get('customTitlebar.value'), backgroundColor: '#282C34', titleBarStyle: 'hidden', width: 400, @@ -352,7 +357,7 @@ function createWindow(id) { } else { customCSSWindow = new BrowserWindow({ title: `Custom CSS for WhatsApp`, - frame: false, + frame: !settings.get('customTitlebar.value'), backgroundColor: '#282C34', titleBarStyle: 'hidden', parent: mainWindow, @@ -382,7 +387,7 @@ function createWindow(id) { } else { themeCustomizerWindow = new BrowserWindow({ title: `Customize Theme`, - frame: false, + frame: !settings.get('customTitlebar.value'), backgroundColor: '#282C34', titleBarStyle: 'hidden', parent: mainWindow, @@ -412,7 +417,7 @@ function createWindow(id) { } else { themeManagerWindow = new BrowserWindow({ title: `Manage Themes`, - frame: false, + frame: !settings.get('customTitlebar.value'), backgroundColor: '#282C34', titleBarStyle: 'hidden', parent: mainWindow, @@ -454,4 +459,4 @@ function confirmExit() { return; } }); -} \ No newline at end of file +} diff --git a/src/windows/about/js/about.js b/src/windows/about/js/about.js index a646b7ce..9ccd45dc 100644 --- a/src/windows/about/js/about.js +++ b/src/windows/about/js/about.js @@ -8,18 +8,23 @@ const { const { ipcRenderer } = require('electron'); +const Store = require('electron-store'); -// Create main window titlebar -const mainTitlebar = new customTitlebar.Titlebar({ - backgroundColor: customTitlebar.Color.fromHex('#21252B'), - icon: '../assets/icons/icon.ico', - menu: process.platform === 'darwin' ? Menu.getApplicationMenu() : new Menu(), - minimizable: false, - maximizable: false, - closeable: true -}); +let settings = new Store({name:'settings'}); -document.querySelector('.altus-version').innerText = app.getVersion(); +if (settings.get('customTitlebar.value') === true) { + // Create main window titlebar + const mainTitlebar = new customTitlebar.Titlebar({ + backgroundColor: customTitlebar.Color.fromHex('#21252B'), + icon: '../assets/icons/icon.ico', + menu: process.platform === 'darwin' ? Menu.getApplicationMenu() : new Menu(), + minimizable: false, + maximizable: false, + closeable: true + }); + + // Setting title explicitly + mainTitlebar.updateTitle(`About Altus`) +} -// Setting title explicitly -mainTitlebar.updateTitle(`About Altus`) \ No newline at end of file +document.querySelector('.altus-version').innerText = app.getVersion(); diff --git a/src/windows/customCSS/js/customCSS.js b/src/windows/customCSS/js/customCSS.js index bc9e0d43..dcb73f9a 100644 --- a/src/windows/customCSS/js/customCSS.js +++ b/src/windows/customCSS/js/customCSS.js @@ -7,16 +7,25 @@ const { ipcRenderer } = require('electron'); -// Create main window titlebar -const mainTitlebar = new customTitlebar.Titlebar({ - backgroundColor: customTitlebar.Color.fromHex('#21252B'), - icon: '../assets/icons/icon.ico', - menu: process.platform === 'darwin' ? Menu.getApplicationMenu() : new Menu(), - minimizable: false, - maximizable: false, - closeable: true +let settings = new Store({ + name: 'settings' }); +if (settings.get('customTitlebar.value') === true){ + // Create main window titlebar + const mainTitlebar = new customTitlebar.Titlebar({ + backgroundColor: customTitlebar.Color.fromHex('#21252B'), + icon: '../assets/icons/icon.ico', + menu: process.platform === 'darwin' ? Menu.getApplicationMenu() : new Menu(), + minimizable: false, + maximizable: false, + closeable: true + }); + + // Setting title explicitly + mainTitlebar.updateTitle(`Custom CSS for WhatsApp`); +} + let themes = new Store({ name: 'themes' }); @@ -57,6 +66,3 @@ document.getElementById('themenameinput').addEventListener('focus', () => { document.getElementById('customcssarea').addEventListener('focus', () => { document.getElementById('customcssarea').parentElement.classList.remove('error'); }); - -// Setting title explicitly -mainTitlebar.updateTitle(`Custom CSS for WhatsApp`); \ No newline at end of file diff --git a/src/windows/main/js/main.js b/src/windows/main/js/main.js index 8b73182c..0ff65096 100644 --- a/src/windows/main/js/main.js +++ b/src/windows/main/js/main.js @@ -10,12 +10,19 @@ const Store = require('electron-store'); const generateId = require('uuid/v4'); const HTML = require('../assets/js/elementCodes.js'); -// Create main window titlebar -const mainTitlebar = new customTitlebar.Titlebar({ - backgroundColor: customTitlebar.Color.fromHex('#21252B'), - icon: '../assets/icons/icon.ico', - itemBackgroundColor: customTitlebar.Color.fromHex('#3d444e'), -}); +let settings = new Store({name: 'settings'}); + +if (settings.get('customTitlebar.value') === true) { + // Create main window titlebar + const mainTitlebar = new customTitlebar.Titlebar({ + backgroundColor: customTitlebar.Color.fromHex('#21252B'), + icon: '../assets/icons/icon.ico', + itemBackgroundColor: customTitlebar.Color.fromHex('#3d444e'), + }); + + // Setting title explicitly + mainTitlebar.updateTitle(`Altus ${app.getVersion()}`); +} let tabs = new Store({ name: 'tabs', @@ -307,6 +314,3 @@ function addNewInstance(instance) { } ipcRenderer.on('new-themes-added', e => window.location.reload(true)); - -// Setting title explicitly -mainTitlebar.updateTitle(`Altus ${app.getVersion()}`); \ No newline at end of file diff --git a/src/windows/settings/js/settings.js b/src/windows/settings/js/settings.js index 075393c2..92bc3608 100644 --- a/src/windows/settings/js/settings.js +++ b/src/windows/settings/js/settings.js @@ -14,18 +14,20 @@ const settings = new Store({ name: 'settings' }); -// Create main window titlebar -const mainTitlebar = new customTitlebar.Titlebar({ - backgroundColor: customTitlebar.Color.fromHex('#21252B'), - icon: '../assets/icons/icon.ico', - menu: process.platform === 'darwin' ? Menu.getApplicationMenu() : new Menu(), - minimizable: false, - maximizable: false, - closeable: true -}); +if (settings.get('customTitlebar.value') === true) { + // Create main window titlebar + const mainTitlebar = new customTitlebar.Titlebar({ + backgroundColor: customTitlebar.Color.fromHex('#21252B'), + icon: '../assets/icons/icon.ico', + menu: process.platform === 'darwin' ? Menu.getApplicationMenu() : new Menu(), + minimizable: false, + maximizable: false, + closeable: true + }); -// Setting title explicitly -mainTitlebar.updateTitle(`Settings`); + // Setting title explicitly + mainTitlebar.updateTitle(`Settings`); +} // Load Settings for (setting of settings) { @@ -75,7 +77,9 @@ document.querySelector('#save-button').addEventListener('click', () => { settings.set('trayIcon.value', document.querySelector('#trayIconButton').innerText == "Enabled" ? true : false); settings.set('showExitPrompt.value', document.querySelector('#showExitPromptButton').innerText == "Enabled" ? true : false); + + settings.set('customTitlebar.value', document.querySelector('#customTitlebarButton').innerText == "Enabled" ? true : false); ipcRenderer.send('settings-changed', true); BrowserWindow.getFocusedWindow().close(); -}); \ No newline at end of file +}); diff --git a/src/windows/themeCustomizer/js/themeCustomizer.js b/src/windows/themeCustomizer/js/themeCustomizer.js index 2cefa986..3c0f2159 100644 --- a/src/windows/themeCustomizer/js/themeCustomizer.js +++ b/src/windows/themeCustomizer/js/themeCustomizer.js @@ -4,19 +4,26 @@ const { } = require('electron').remote; const ClipboardJS = require('clipboard'); let cssClipboard = new ClipboardJS('#copy-css-button'); +const Store = require('electron-store'); -// Create main window titlebar -const mainTitlebar = new customTitlebar.Titlebar({ - backgroundColor: customTitlebar.Color.fromHex('#21252B'), - icon: '../assets/icons/icon.ico', - menu: process.platform === 'darwin' ? Menu.getApplicationMenu() : new Menu(), - minimizable: false, - maximizable: false, - closeable: true +const settings = new Store({ + name: 'settings' }); -// Setting title explicitly -mainTitlebar.updateTitle(`Theme Customizer`); +if (settings.get('customTitlebar.value') === true) { + // Create main window titlebar + const mainTitlebar = new customTitlebar.Titlebar({ + backgroundColor: customTitlebar.Color.fromHex('#21252B'), + icon: '../assets/icons/icon.ico', + menu: process.platform === 'darwin' ? Menu.getApplicationMenu() : new Menu(), + minimizable: false, + maximizable: false, + closeable: true + }); + + // Setting title explicitly + mainTitlebar.updateTitle(`Theme Customizer`); +} document.querySelectorAll('.color-input').forEach((e, i) => { switch (i) { @@ -141,4 +148,4 @@ cssClipboard.on('success', () => { copyButton.innerHTML = ' Copy CSS'; copyButton.disabled = false; }, 500); -}); \ No newline at end of file +}); diff --git a/src/windows/themeManager/js/themeManager.js b/src/windows/themeManager/js/themeManager.js index a77818e7..2177c0f5 100644 --- a/src/windows/themeManager/js/themeManager.js +++ b/src/windows/themeManager/js/themeManager.js @@ -7,15 +7,25 @@ const { } = require('electron'); const Store = require('electron-store'); // Create main window titlebar -const mainTitlebar = new customTitlebar.Titlebar({ - backgroundColor: customTitlebar.Color.fromHex('#21252B'), - icon: '../assets/icons/icon.ico', - menu: process.platform === 'darwin' ? Menu.getApplicationMenu() : new Menu(), - minimizable: false, - maximizable: false, - closeable: true +let mainTitlebar; + +const settings = new Store({ + name: 'settings' }); +if (settings.get('customTitlebar.value') === true) { + mainTitlebar = new customTitlebar.Titlebar({ + backgroundColor: customTitlebar.Color.fromHex('#21252B'), + icon: '../assets/icons/icon.ico', + menu: process.platform === 'darwin' ? Menu.getApplicationMenu() : new Menu(), + minimizable: false, + maximizable: false, + closeable: true + }) + // Setting title explicitly + mainTitlebar.updateTitle(`Theme Manager`); +} + const themes = new Store({ name: 'themes' }); @@ -66,6 +76,3 @@ document.getElementById('save-button').addEventListener('click', () => { }); document.getElementById('reload-button').addEventListener('click', () => window.location.reload()); - -// Setting title explicitly -mainTitlebar.updateTitle(`Theme Manager`); \ No newline at end of file