mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-21 02:48:00 +00:00
use glasstron on win32
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import * as glasstron from 'glasstron'
|
import * as glasstron from 'glasstron'
|
||||||
if (process.platform === 'linux') {
|
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||||
glasstron.init()
|
glasstron.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,12 +13,8 @@ import * as path from 'path'
|
|||||||
import { parseArgs } from './cli'
|
import { parseArgs } from './cli'
|
||||||
import { loadConfig } from './config'
|
import { loadConfig } from './config'
|
||||||
|
|
||||||
let SetWindowCompositionAttribute: any
|
|
||||||
let AccentState: any
|
|
||||||
let DwmEnableBlurBehindWindow: any
|
let DwmEnableBlurBehindWindow: any
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
SetWindowCompositionAttribute = require('windows-swca').SetWindowCompositionAttribute
|
|
||||||
AccentState = require('windows-swca').ACCENT_STATE
|
|
||||||
DwmEnableBlurBehindWindow = require('windows-blurbehind').DwmEnableBlurBehindWindow
|
DwmEnableBlurBehindWindow = require('windows-blurbehind').DwmEnableBlurBehindWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,12 +85,6 @@ export class Window {
|
|||||||
|
|
||||||
this.window = new BrowserWindow(bwOptions)
|
this.window = new BrowserWindow(bwOptions)
|
||||||
|
|
||||||
if (process.platform === 'linux') {
|
|
||||||
glasstron.update(this.window, {
|
|
||||||
linux: { requestBlur: true },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.window.once('ready-to-show', () => {
|
this.window.once('ready-to-show', () => {
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
this.window.setVibrancy('window')
|
this.window.setVibrancy('window')
|
||||||
@@ -142,19 +132,16 @@ export class Window {
|
|||||||
this.lastVibrancy = { enabled, type }
|
this.lastVibrancy = { enabled, type }
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
if (parseFloat(os.release()) >= 10) {
|
if (parseFloat(os.release()) >= 10) {
|
||||||
let attribValue = AccentState.ACCENT_DISABLED
|
glasstron.update(this.window, {
|
||||||
if (enabled) {
|
windows: { blurType: enabled ? ((type === 'fluent') ? 'acrylic' : 'blurbehind') : null },
|
||||||
if (type === 'fluent') {
|
})
|
||||||
attribValue = AccentState.ACCENT_ENABLE_ACRYLICBLURBEHIND
|
|
||||||
} else {
|
|
||||||
attribValue = AccentState.ACCENT_ENABLE_BLURBEHIND
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SetWindowCompositionAttribute(this.window.getNativeWindowHandle(), attribValue, 0x00000000)
|
|
||||||
} else {
|
} else {
|
||||||
DwmEnableBlurBehindWindow(this.window, enabled)
|
DwmEnableBlurBehindWindow(this.window, enabled)
|
||||||
}
|
}
|
||||||
}else if(process.platform ==='linux'){
|
} else if (process.platform ==='linux') {
|
||||||
|
glasstron.update(this.window, {
|
||||||
|
linux: { requestBlur: enabled },
|
||||||
|
})
|
||||||
this.window.setBackgroundColor(enabled ? '#00000000' : '#131d27')
|
this.window.setBackgroundColor(enabled ? '#00000000' : '#131d27')
|
||||||
} else {
|
} else {
|
||||||
this.window.setVibrancy(enabled ? 'dark' : null as any) // electron issue 20269
|
this.window.setVibrancy(enabled ? 'dark' : null as any) // electron issue 20269
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
"electron-is-dev": "1.1.0",
|
"electron-is-dev": "1.1.0",
|
||||||
"electron-updater": "^4.3.1",
|
"electron-updater": "^4.3.1",
|
||||||
"fontmanager-redux": "0.4.0",
|
"fontmanager-redux": "0.4.0",
|
||||||
"glasstron": "0.0.3",
|
"glasstron": "sentialx/Glasstron#n-api",
|
||||||
"js-yaml": "3.14.0",
|
"js-yaml": "3.14.0",
|
||||||
"keytar": "^6.0.1",
|
"keytar": "^6.0.1",
|
||||||
"mz": "^2.7.0",
|
"mz": "^2.7.0",
|
||||||
@@ -45,8 +45,7 @@
|
|||||||
"serialport": "^9.0.0",
|
"serialport": "^9.0.0",
|
||||||
"windows-blurbehind": "^1.0.1",
|
"windows-blurbehind": "^1.0.1",
|
||||||
"windows-native-registry": "^1.0.17",
|
"windows-native-registry": "^1.0.17",
|
||||||
"windows-process-tree": "^0.2.4",
|
"windows-process-tree": "^0.2.4"
|
||||||
"windows-swca": "^2.0.2"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/mz": "0.0.32",
|
"@types/mz": "0.0.32",
|
||||||
|
@@ -1186,11 +1186,11 @@ github-from-package@0.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce"
|
resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce"
|
||||||
integrity sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=
|
integrity sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=
|
||||||
|
|
||||||
glasstron@0.0.3:
|
glasstron@sentialx/Glasstron#n-api:
|
||||||
version "0.0.3"
|
version "0.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/glasstron/-/glasstron-0.0.3.tgz#3934d9e9b51dd2fd6b07eff8395493b3361ab917"
|
resolved "https://codeload.github.com/sentialx/Glasstron/tar.gz/1159908e1d85b8cceabf6b5d9353c446caea1f0b"
|
||||||
integrity sha512-yJ8+8gkGXXBlnI+4j6i8N+SaeZcswtrO82M863zQkCc5BQfC5fTXcwj9+v80f0jYUfZLFigsgaFuKoFmlVsOdw==
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
node-addon-api "^3.0.0"
|
||||||
x11 "^2.3.0"
|
x11 "^2.3.0"
|
||||||
|
|
||||||
glob@^7.0.3, glob@^7.1.1, glob@^7.1.3:
|
glob@^7.0.3, glob@^7.1.1, glob@^7.1.3:
|
||||||
|
Reference in New Issue
Block a user