This commit is contained in:
SiriusXT 2023-05-23 20:50:03 +08:00
parent 66c25e7f29
commit 79dca12274
2 changed files with 10 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"[javascript]": { "[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint" "editor.defaultFormatter": "vscode.typescript-language-features"
}, },
"[json]": { "[json]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint" "editor.defaultFormatter": "dbaeumer.vscode-eslint"

View File

@ -30,6 +30,9 @@ const TPL = `
height: 40px; height: 40px;
width: 40px; width: 40px;
} }
.title-bar-buttons .top-btn.active{
background-color:var(--accented-background-color);
}
</style> </style>
<!-- divs act as a hitbox for the buttons, making them clickable on corners --> <!-- divs act as a hitbox for the buttons, making them clickable on corners -->
@ -54,10 +57,10 @@ export default class TitleBarButtonsWidget extends BasicWidget {
const $closeBtn = this.$widget.find(".close-btn"); const $closeBtn = this.$widget.find(".close-btn");
//When the window is restarted, the window will not be reset when it is set to the top, so get the window status and set the icon background //When the window is restarted, the window will not be reset when it is set to the top, so get the window status and set the icon background
(function() { (function () {
const remote = utils.dynamicRequire('@electron/remote'); const remote = utils.dynamicRequire('@electron/remote');
if (remote.BrowserWindow.getFocusedWindow().isAlwaysOnTop()) { if (remote.BrowserWindow.getFocusedWindow().isAlwaysOnTop()) {
$topBtn.css("background-color", "var(--accented-background-color)"); $topBtn.addClass('active');
} }
}()); }());
$topBtn.on('click', () => { $topBtn.on('click', () => {
@ -67,10 +70,10 @@ export default class TitleBarButtonsWidget extends BasicWidget {
const isAlwaysOnTop = focusedWindow.isAlwaysOnTop() const isAlwaysOnTop = focusedWindow.isAlwaysOnTop()
if (isAlwaysOnTop) { if (isAlwaysOnTop) {
focusedWindow.setAlwaysOnTop(false) focusedWindow.setAlwaysOnTop(false)
$topBtn.css("background-color", ""); $topBtn.removeClass('active');
} else { } else {
focusedWindow.setAlwaysOnTop(true); focusedWindow.setAlwaysOnTop(true);
$topBtn.css("background-color", "var(--accented-background-color)"); $topBtn.addClass('active');
} }
}); });