From 0abef214cfb5f5f1f953ba15bd3c8ed20f86ed1a Mon Sep 17 00:00:00 2001 From: booploops <49113086+booploops@users.noreply.github.com> Date: Fri, 1 Apr 2022 00:07:01 -0700 Subject: [PATCH] added native title bar option, added window control position --- src/main/base/browserwindow.ts | 10 +++++++++- src/main/base/store.ts | 4 +++- src/renderer/less/linux.less | 2 +- src/renderer/main/vueapp.js | 25 ++++++++++++++++++++++++- src/renderer/views/app/chrome-top.ejs | 6 +++--- src/renderer/views/pages/settings.ejs | 20 ++++++++++++++++++++ 6 files changed, 60 insertions(+), 7 deletions(-) diff --git a/src/main/base/browserwindow.ts b/src/main/base/browserwindow.ts index 83002c54..d6eacb80 100644 --- a/src/main/base/browserwindow.ts +++ b/src/main/base/browserwindow.ts @@ -322,11 +322,19 @@ export class BrowserWindow { } else { this.options.transparent = true; } + this.options.autoHideMenuBar = true + if(utils.getStoreValue("visual.nativeTitleBar")) { + this.options.titleBarStyle = "visible"; + this.options.frame = true + } break; case "linux": this.options.backgroundColor = "#1E1E1E"; this.options.autoHideMenuBar = true - this.options.frame = true + if(utils.getStoreValue("visual.nativeTitleBar")) { + this.options.titleBarStyle = "visible"; + this.options.frame = true + } break; case "darwin": this.options.transparent = true; diff --git a/src/main/base/store.ts b/src/main/base/store.ts index 4ad48f9e..7165c12a 100644 --- a/src/main/base/store.ts +++ b/src/main/base/store.ts @@ -118,7 +118,9 @@ export class Store { "miniplayer_top_toggle": true, "directives": { "windowLayout": "default" - } + }, + "windowControlPosition": 0, // 0 default right + "nativeTitleBar": false }, "lyrics": { "enable_mxm": false, diff --git a/src/renderer/less/linux.less b/src/renderer/less/linux.less index 6b26d1ee..dc0be238 100644 --- a/src/renderer/less/linux.less +++ b/src/renderer/less/linux.less @@ -1,6 +1,6 @@ // Linux body[platform="linux"] { #window-controls-container { - display: none; + //display: none; } } \ No newline at end of file diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index f49df215..1abe4076 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -151,6 +151,7 @@ const app = new Vue({ tmpVar: [], notification: false, chrome: { + nativeControls: false, contentScrollPosY: 0, appliedTheme: { location: "", @@ -580,6 +581,10 @@ const app = new Vue({ this.chrome.windowControlPosition = "left" } + if(this.cfg.visual.nativeTitleBar) { + this.chrome.nativeControls = true + } + this.setLz(this.cfg.general.language) this.setLzManual() clearTimeout(this.hangtimer) @@ -960,7 +965,7 @@ const app = new Vue({ if (directives[directive]) { return directives[directive].value } else if (this.cfg.visual.directives[directive]) { - return this.cfg.visual.directives.windowLayout + return this.cfg.visual.directives[directive] } else { return "" } @@ -982,6 +987,24 @@ const app = new Vue({ classes.simplebg = true } + if(this.platform !== "darwin") { + switch(parseInt(this.cfg.visual.windowControlPosition)) { + default: + case 0: + this.chrome.windowControlPosition = "right" + this.chrome.forceDirectives["macosemu"] = { + value: false + } + break; + case 1: + this.chrome.windowControlPosition = "left" + this.chrome.forceDirectives["macosemu"] = { + value: true + } + break; + } + } + if (this.getThemeDirective('windowLayout') == 'twopanel') { classes.twopanel = true } diff --git a/src/renderer/views/app/chrome-top.ejs b/src/renderer/views/app/chrome-top.ejs index 776b5391..6177f568 100644 --- a/src/renderer/views/app/chrome-top.ejs +++ b/src/renderer/views/app/chrome-top.ejs @@ -1,6 +1,6 @@