Skip to content

Commit

Permalink
feat: 添加Wayland专用置顶标识 [Wayland置顶] #136
Browse files Browse the repository at this point in the history
  • Loading branch information
msojocs committed Nov 16, 2024
1 parent 2c0514b commit 2f92478
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 🌈 v1.15.2-3 / 2024-11-

## 🚀 功能

- 置顶: 添加Wayland专用置顶标识 `[Wayland置顶]`.

# 🌈 v1.15.2-2 / 2024-11-09

## 🚀 功能
Expand Down
19 changes: 19 additions & 0 deletions res/scripts/injectExt.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,25 @@ Module._load = (...args) => {
}
}

if (process.env.XDG_SESSION_TYPE === 'wayland' || process.env.WAYLAND_DISPLAY) {
const _setAlwaysOnTop = BrowserWindow.prototype.setAlwaysOnTop;
const key = '[Wayland置顶]'
BrowserWindow.prototype.setAlwaysOnTop = function(...args) {
let title = this.getTitle()
if (args[0] && !title.startsWith(key)) {
// 置顶
title = `${key}${title}`
this.setTitle(title)
}
else if(!args[0] && title.startsWith(key))
{
title = title.replace(key, '')
this.setTitle(title)
}
return _setAlwaysOnTop.apply(this, args)
}
}

const originloadURL = BrowserWindow.prototype.loadURL;
BrowserWindow.prototype.loadURL = function(){
this.setMinimumSize(300, 300);
Expand Down

0 comments on commit 2f92478

Please sign in to comment.