Skip to content

Commit

Permalink
置顶功能更新
Browse files Browse the repository at this point in the history
  • Loading branch information
Wybxc committed Oct 9, 2021
1 parent f0d9487 commit 9fdd18a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "danmaku-dangan",
"version": "1.0.0",
"version": "1.1.1",
"author": "wybxc",
"license": "LGPL-3.0-or-later",
"scripts": {
Expand Down
11 changes: 10 additions & 1 deletion src/main/mainWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function createMainWindow(isDevelopment) {
frame: false,
fullscreen: true,
simpleFullscreen: true,
alwaysOnTop: !config.debug,
focusable: config.debug,
skipTaskbar: true, // 全屏透明
webPreferences: {
devTools: config.debug,
Expand All @@ -35,8 +35,17 @@ function createMainWindow(isDevelopment) {

window.setIgnoreMouseEvents(!config.debug);

let timer;
if (!config.debug) {
window.setAlwaysOnTop(true, "screen-saver"); // 到置顶最高等级
timer = setInterval(() => {
window.moveTop(); // 强行置顶
}, 1000);
}

window.on("closed", () => {
mainWindow = null;
if (timer) clearInterval(timer);
});

window.webContents.on("devtools-opened", () => {
Expand Down

0 comments on commit 9fdd18a

Please sign in to comment.