mirror of
https://github.com/fanchenio/DawnLauncher.git
synced 2025-07-14 05:12:11 +08:00
修复'透明窗口'下出现窗口闪烁的问题。
This commit is contained in:
parent
a2ccd8670b
commit
5c791874c6
@ -24,7 +24,11 @@ function createWindow() {
|
|||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
focusable: true,
|
focusable: true,
|
||||||
show: false,
|
show: false,
|
||||||
backgroundColor: getMainBackgorunColor(),
|
transparent: global.setting.appearance.transparency < 1,
|
||||||
|
backgroundColor:
|
||||||
|
global.setting.appearance.transparency === 1
|
||||||
|
? getMainBackgorunColor()
|
||||||
|
: null,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
spellcheck: false,
|
spellcheck: false,
|
||||||
preload: join(__dirname, "../preload/index.js"),
|
preload: join(__dirname, "../preload/index.js"),
|
||||||
|
@ -49,7 +49,11 @@ function createAddEditWindow(id: number | null, parentId: number | null) {
|
|||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
focusable: true,
|
focusable: true,
|
||||||
show: false,
|
show: false,
|
||||||
backgroundColor: getMainBackgorunColor(),
|
transparent: global.setting.appearance.transparency < 1,
|
||||||
|
backgroundColor:
|
||||||
|
global.setting.appearance.transparency === 1
|
||||||
|
? getMainBackgorunColor()
|
||||||
|
: null,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
spellcheck: false,
|
spellcheck: false,
|
||||||
preload: join(__dirname, "../preload/index.js"),
|
preload: join(__dirname, "../preload/index.js"),
|
||||||
@ -113,7 +117,11 @@ function createSetIconWindow(id: number) {
|
|||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
focusable: true,
|
focusable: true,
|
||||||
show: false,
|
show: false,
|
||||||
backgroundColor: getMainBackgorunColor(),
|
transparent: global.setting.appearance.transparency < 1,
|
||||||
|
backgroundColor:
|
||||||
|
global.setting.appearance.transparency === 1
|
||||||
|
? getMainBackgorunColor()
|
||||||
|
: null,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
spellcheck: false,
|
spellcheck: false,
|
||||||
preload: join(__dirname, "../preload/index.js"),
|
preload: join(__dirname, "../preload/index.js"),
|
||||||
@ -172,7 +180,11 @@ function createAssociateFolderWindow(id: number) {
|
|||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
focusable: true,
|
focusable: true,
|
||||||
show: false,
|
show: false,
|
||||||
backgroundColor: getMainBackgorunColor(),
|
transparent: global.setting.appearance.transparency < 1,
|
||||||
|
backgroundColor:
|
||||||
|
global.setting.appearance.transparency === 1
|
||||||
|
? getMainBackgorunColor()
|
||||||
|
: null,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
spellcheck: false,
|
spellcheck: false,
|
||||||
preload: join(__dirname, "../preload/index.js"),
|
preload: join(__dirname, "../preload/index.js"),
|
||||||
@ -236,7 +248,11 @@ function createAggregateWindow(id: number) {
|
|||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
focusable: true,
|
focusable: true,
|
||||||
show: false,
|
show: false,
|
||||||
backgroundColor: getMainBackgorunColor(),
|
transparent: global.setting.appearance.transparency < 1,
|
||||||
|
backgroundColor:
|
||||||
|
global.setting.appearance.transparency === 1
|
||||||
|
? getMainBackgorunColor()
|
||||||
|
: null,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
spellcheck: false,
|
spellcheck: false,
|
||||||
preload: join(__dirname, "../preload/index.js"),
|
preload: join(__dirname, "../preload/index.js"),
|
||||||
|
@ -25,7 +25,11 @@ function createBackupRestoreDataWindow() {
|
|||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
focusable: true,
|
focusable: true,
|
||||||
show: false,
|
show: false,
|
||||||
backgroundColor: getMainBackgorunColor(),
|
transparent: global.setting.appearance.transparency < 1,
|
||||||
|
backgroundColor:
|
||||||
|
global.setting.appearance.transparency === 1
|
||||||
|
? getMainBackgorunColor()
|
||||||
|
: null,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
spellcheck: false,
|
spellcheck: false,
|
||||||
preload: join(__dirname, "../preload/index.js"),
|
preload: join(__dirname, "../preload/index.js"),
|
||||||
|
@ -8,7 +8,10 @@ import { initSystemItem } from "./item/commons/data";
|
|||||||
import commonIpcEvent from "./commons/ipcEvent";
|
import commonIpcEvent from "./commons/ipcEvent";
|
||||||
import itemIpcEvent from "./item/ipcEvent";
|
import itemIpcEvent from "./item/ipcEvent";
|
||||||
import settingIpcEvent from "./setting/ipcEvent";
|
import settingIpcEvent from "./setting/ipcEvent";
|
||||||
import { init as settingDataInit } from "./setting/data";
|
import {
|
||||||
|
init as settingDataInit,
|
||||||
|
update as updateSetting,
|
||||||
|
} from "./setting/data";
|
||||||
import { setShortcutKey } from "./setting";
|
import { setShortcutKey } from "./setting";
|
||||||
import searchIpcEvent from "./search/ipcEvent";
|
import searchIpcEvent from "./search/ipcEvent";
|
||||||
import { createMainWindow } from "./main";
|
import { createMainWindow } from "./main";
|
||||||
@ -37,8 +40,13 @@ process.env.VITE_PUBLIC = process.env.VITE_DEV_SERVER_URL
|
|||||||
// 解决透明窗口闪烁
|
// 解决透明窗口闪烁
|
||||||
app.commandLine.appendSwitch("wm-window-animations-disabled");
|
app.commandLine.appendSwitch("wm-window-animations-disabled");
|
||||||
|
|
||||||
// 解决创建窗口屏幕闪烁问题
|
// 初始化设置数据
|
||||||
app.disableHardwareAcceleration();
|
settingDataInit();
|
||||||
|
// 如果主窗口是非透明窗口的话,禁止GPU加速,解决白屏问题。
|
||||||
|
// 如果主窗口是透明窗口的话,将除主窗口外的窗口都改为透明度0.99,解决解决白屏问题。
|
||||||
|
if (global.setting.appearance.transparency === 1) {
|
||||||
|
app.disableHardwareAcceleration();
|
||||||
|
}
|
||||||
|
|
||||||
// Set application name for Windows 10+ notifications
|
// Set application name for Windows 10+ notifications
|
||||||
if (process.platform === "win32") app.setAppUserModelId(app.getName());
|
if (process.platform === "win32") app.setAppUserModelId(app.getName());
|
||||||
@ -62,8 +70,18 @@ app.whenReady().then(() => {
|
|||||||
}
|
}
|
||||||
// addon
|
// addon
|
||||||
global.addon = require("../../native/addon.node");
|
global.addon = require("../../native/addon.node");
|
||||||
// 初始化数据
|
if (global.first) {
|
||||||
settingDataInit();
|
// 首次添加,判断系统语言
|
||||||
|
if (app.getLocale().toLowerCase().indexOf("zh-") === 0) {
|
||||||
|
// 简体中文
|
||||||
|
global.setting.general.language = "SimplifiedChinese";
|
||||||
|
} else {
|
||||||
|
// 英文
|
||||||
|
global.setting.general.language = "English";
|
||||||
|
}
|
||||||
|
// 修改
|
||||||
|
updateSetting(global.setting);
|
||||||
|
}
|
||||||
// 获取语言
|
// 获取语言
|
||||||
global.language = getLanguage(global.setting.general.language);
|
global.language = getLanguage(global.setting.general.language);
|
||||||
// 禁用debugtron
|
// 禁用debugtron
|
||||||
|
@ -59,7 +59,11 @@ async function createAddEditWindow(
|
|||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
focusable: true,
|
focusable: true,
|
||||||
show: false,
|
show: false,
|
||||||
backgroundColor: getMainBackgorunColor(),
|
transparent: global.setting.appearance.transparency < 1,
|
||||||
|
backgroundColor:
|
||||||
|
global.setting.appearance.transparency === 1
|
||||||
|
? getMainBackgorunColor()
|
||||||
|
: null,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
spellcheck: false,
|
spellcheck: false,
|
||||||
preload: join(__dirname, "../preload/index.js"),
|
preload: join(__dirname, "../preload/index.js"),
|
||||||
@ -119,7 +123,11 @@ async function createNetworkIconWindow() {
|
|||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
focusable: true,
|
focusable: true,
|
||||||
show: false,
|
show: false,
|
||||||
backgroundColor: getMainBackgorunColor(),
|
transparent: global.setting.appearance.transparency < 1,
|
||||||
|
backgroundColor:
|
||||||
|
global.setting.appearance.transparency === 1
|
||||||
|
? getMainBackgorunColor()
|
||||||
|
: null,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
spellcheck: false,
|
spellcheck: false,
|
||||||
preload: join(__dirname, "../preload/index.js"),
|
preload: join(__dirname, "../preload/index.js"),
|
||||||
@ -170,7 +178,11 @@ async function createSVGIconWindow() {
|
|||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
focusable: true,
|
focusable: true,
|
||||||
show: false,
|
show: false,
|
||||||
backgroundColor: getMainBackgorunColor(),
|
transparent: global.setting.appearance.transparency < 1,
|
||||||
|
backgroundColor:
|
||||||
|
global.setting.appearance.transparency === 1
|
||||||
|
? getMainBackgorunColor()
|
||||||
|
: null,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
spellcheck: false,
|
spellcheck: false,
|
||||||
preload: join(__dirname, "../preload/index.js"),
|
preload: join(__dirname, "../preload/index.js"),
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
import { BrowserWindow, shell, screen } from "electron";
|
import { BrowserWindow, shell, screen } from "electron";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { getWindowInScreen, sendToWebContent } from "../commons";
|
import {
|
||||||
|
getMainBackgorunColor,
|
||||||
|
getWindowInScreen,
|
||||||
|
sendToWebContent,
|
||||||
|
} from "../commons";
|
||||||
import cacheData from "../commons/cacheData";
|
import cacheData from "../commons/cacheData";
|
||||||
|
|
||||||
// 窗口
|
// 窗口
|
||||||
@ -24,7 +28,11 @@ function createQuickSearchWindow() {
|
|||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
alwaysOnTop: true,
|
alwaysOnTop: true,
|
||||||
backgroundColor: global.setting.appearance.theme.mainBackgroundColor,
|
transparent: global.setting.appearance.transparency < 1,
|
||||||
|
backgroundColor:
|
||||||
|
global.setting.appearance.transparency === 1
|
||||||
|
? getMainBackgorunColor()
|
||||||
|
: null,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
spellcheck: false,
|
spellcheck: false,
|
||||||
backgroundThrottling: false,
|
backgroundThrottling: false,
|
||||||
|
@ -51,14 +51,6 @@ function select() {
|
|||||||
* 添加
|
* 添加
|
||||||
*/
|
*/
|
||||||
function add(setting: Setting) {
|
function add(setting: Setting) {
|
||||||
// 首次添加,判断系统语言
|
|
||||||
if (app.getLocale().toLowerCase().indexOf("zh-") === 0) {
|
|
||||||
// 简体中文
|
|
||||||
setting.general.language = "SimplifiedChinese";
|
|
||||||
} else {
|
|
||||||
// 英文
|
|
||||||
setting.general.language = "English";
|
|
||||||
}
|
|
||||||
// SQL
|
// SQL
|
||||||
let sql = `INSERT INTO ${settingTableName}
|
let sql = `INSERT INTO ${settingTableName}
|
||||||
(id, setting)
|
(id, setting)
|
||||||
@ -67,6 +59,8 @@ function add(setting: Setting) {
|
|||||||
let id = db.prepare(sql).run(1, JSON.stringify(setting)).lastInsertRowid;
|
let id = db.prepare(sql).run(1, JSON.stringify(setting)).lastInsertRowid;
|
||||||
if (id) {
|
if (id) {
|
||||||
global.setting = setting;
|
global.setting = setting;
|
||||||
|
// 添加设置被视为首次打开软件
|
||||||
|
global.first = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -34,7 +34,11 @@ function createSettingWindow() {
|
|||||||
fullscreenable: false,
|
fullscreenable: false,
|
||||||
skipTaskbar: true,
|
skipTaskbar: true,
|
||||||
show: false,
|
show: false,
|
||||||
backgroundColor: getMainBackgorunColor(),
|
transparent: global.setting.appearance.transparency < 1,
|
||||||
|
backgroundColor:
|
||||||
|
global.setting.appearance.transparency === 1
|
||||||
|
? getMainBackgorunColor()
|
||||||
|
: null,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
spellcheck: false,
|
spellcheck: false,
|
||||||
preload: join(__dirname, "../preload/index.js"),
|
preload: join(__dirname, "../preload/index.js"),
|
||||||
|
2
electron/types/global.d.ts
vendored
2
electron/types/global.d.ts
vendored
@ -5,6 +5,8 @@ import { Setting } from "../../types/setting";
|
|||||||
declare global {
|
declare global {
|
||||||
// addon
|
// addon
|
||||||
var addon: any;
|
var addon: any;
|
||||||
|
// 是否是首次打开软件
|
||||||
|
var first: boolean;
|
||||||
// 语言
|
// 语言
|
||||||
var language: any;
|
var language: any;
|
||||||
// 主窗口
|
// 主窗口
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
:style="{
|
:style="{
|
||||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||||
color: store.setting.appearance.theme.mainFontColor,
|
color: store.setting.appearance.theme.mainFontColor,
|
||||||
|
borderRadius:
|
||||||
|
store.setting.appearance.transparency < 1 &&
|
||||||
|
store.setting.appearance.windowRounded
|
||||||
|
? '8px'
|
||||||
|
: undefined,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="flex items-center px-2 app-region-drag">
|
<div class="flex items-center px-2 app-region-drag">
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
:style="{
|
:style="{
|
||||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||||
color: store.setting.appearance.theme.mainFontColor,
|
color: store.setting.appearance.theme.mainFontColor,
|
||||||
|
borderRadius:
|
||||||
|
store.setting.appearance.transparency < 1 &&
|
||||||
|
store.setting.appearance.windowRounded
|
||||||
|
? '8px'
|
||||||
|
: undefined,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="flex items-center app-region-drag">
|
<div class="flex items-center app-region-drag">
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
:style="{
|
:style="{
|
||||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||||
color: store.setting.appearance.theme.mainFontColor,
|
color: store.setting.appearance.theme.mainFontColor,
|
||||||
|
borderRadius:
|
||||||
|
store.setting.appearance.transparency < 1 &&
|
||||||
|
store.setting.appearance.windowRounded
|
||||||
|
? '8px'
|
||||||
|
: undefined,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="flex items-center app-region-drag">
|
<div class="flex items-center app-region-drag">
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
:style="{
|
:style="{
|
||||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||||
color: store.setting.appearance.theme.mainFontColor,
|
color: store.setting.appearance.theme.mainFontColor,
|
||||||
|
borderRadius:
|
||||||
|
store.setting.appearance.transparency < 1 &&
|
||||||
|
store.setting.appearance.windowRounded
|
||||||
|
? '8px'
|
||||||
|
: undefined,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="flex items-center app-region-drag">
|
<div class="flex items-center app-region-drag">
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
:style="{
|
:style="{
|
||||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||||
color: store.setting.appearance.theme.mainFontColor,
|
color: store.setting.appearance.theme.mainFontColor,
|
||||||
|
borderRadius:
|
||||||
|
store.setting.appearance.transparency < 1 &&
|
||||||
|
store.setting.appearance.windowRounded
|
||||||
|
? '8px'
|
||||||
|
: undefined,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="flex items-center px-2 app-region-drag">
|
<div class="flex items-center px-2 app-region-drag">
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
:style="{
|
:style="{
|
||||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||||
color: store.setting.appearance.theme.mainFontColor,
|
color: store.setting.appearance.theme.mainFontColor,
|
||||||
|
borderRadius:
|
||||||
|
store.setting.appearance.transparency < 1 &&
|
||||||
|
store.setting.appearance.windowRounded
|
||||||
|
? '8px'
|
||||||
|
: undefined,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="flex items-center px-2 app-region-drag">
|
<div class="flex items-center px-2 app-region-drag">
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||||
color: store.setting.appearance.theme.mainFontColor,
|
color: store.setting.appearance.theme.mainFontColor,
|
||||||
height: height + 'px',
|
height: height + 'px',
|
||||||
|
borderRadius:
|
||||||
|
store.setting.appearance.transparency < 1 &&
|
||||||
|
store.setting.appearance.windowRounded
|
||||||
|
? '8px'
|
||||||
|
: undefined,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="flex items-center px-2 app-region-drag">
|
<div class="flex items-center px-2 app-region-drag">
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
:style="{
|
:style="{
|
||||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||||
color: store.setting.appearance.theme.mainFontColor,
|
color: store.setting.appearance.theme.mainFontColor,
|
||||||
|
borderRadius:
|
||||||
|
store.setting.appearance.transparency < 1 &&
|
||||||
|
store.setting.appearance.windowRounded
|
||||||
|
? '8px'
|
||||||
|
: undefined,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="flex items-center px-2 app-region-drag">
|
<div class="flex items-center px-2 app-region-drag">
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
:style="{
|
:style="{
|
||||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||||
color: store.setting.appearance.theme.mainFontColor,
|
color: store.setting.appearance.theme.mainFontColor,
|
||||||
|
borderRadius:
|
||||||
|
store.setting.appearance.transparency < 1 &&
|
||||||
|
store.setting.appearance.windowRounded
|
||||||
|
? '8px'
|
||||||
|
: undefined,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="flex items-center px-2 app-region-drag">
|
<div class="flex items-center px-2 app-region-drag">
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
:style="{
|
:style="{
|
||||||
color: store.setting.appearance.theme.mainFontColor,
|
color: store.setting.appearance.theme.mainFontColor,
|
||||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||||
|
borderRadius:
|
||||||
|
store.setting.appearance.transparency < 1 &&
|
||||||
|
store.setting.appearance.windowRounded
|
||||||
|
? '8px'
|
||||||
|
: undefined,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
backgroundColor: store.setting.appearance.theme.mainBackgroundColor,
|
||||||
color: store.setting.appearance.theme.mainFontColor,
|
color: store.setting.appearance.theme.mainFontColor,
|
||||||
height: height + 'px',
|
height: height + 'px',
|
||||||
|
borderRadius:
|
||||||
|
store.setting.appearance.transparency < 1 &&
|
||||||
|
store.setting.appearance.windowRounded
|
||||||
|
? '8px'
|
||||||
|
: undefined,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="flex items-center px-2 app-region-drag">
|
<div class="flex items-center px-2 app-region-drag">
|
||||||
|
Loading…
Reference in New Issue
Block a user