mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-02 13:02:00 +08:00
feat(next): remove pin from custom title bar buttons
This commit is contained in:
parent
50b69d26f6
commit
aad2f93844
@ -30,19 +30,14 @@ const TPL = `
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
width: 40px;
|
width: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-bar-buttons .top-btn.active{
|
|
||||||
background-color:var(--accented-background-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.title-bar-buttons .btn.focus, .title-bar-buttons .btn:focus {
|
.title-bar-buttons .btn.focus, .title-bar-buttons .btn:focus {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
</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 -->
|
||||||
<div class="top-btn" title="${t("title_bar_buttons.window-on-top")}"><button class="btn bx bx-pin"></button></div>
|
|
||||||
<div class="minimize-btn"><button class="btn bx bx-minus"></button></div>
|
<div class="minimize-btn"><button class="btn bx bx-minus"></button></div>
|
||||||
<div class="maximize-btn"><button class="btn bx bx-checkbox"></button></div>
|
<div class="maximize-btn"><button class="btn bx bx-checkbox"></button></div>
|
||||||
<div class="close-btn"><button class="btn bx bx-x"></button></div>
|
<div class="close-btn"><button class="btn bx bx-x"></button></div>
|
||||||
@ -56,35 +51,11 @@ export default class TitleBarButtonsWidget extends BasicWidget {
|
|||||||
|
|
||||||
this.$widget = $(TPL);
|
this.$widget = $(TPL);
|
||||||
this.contentSized();
|
this.contentSized();
|
||||||
|
|
||||||
const $topBtn = this.$widget.find(".top-btn");
|
|
||||||
const $minimizeBtn = this.$widget.find(".minimize-btn");
|
const $minimizeBtn = this.$widget.find(".minimize-btn");
|
||||||
const $maximizeBtn = this.$widget.find(".maximize-btn");
|
const $maximizeBtn = this.$widget.find(".maximize-btn");
|
||||||
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
|
|
||||||
setTimeout(() => {
|
|
||||||
const remote = utils.dynamicRequire('@electron/remote');
|
|
||||||
if (remote.BrowserWindow.getFocusedWindow()?.isAlwaysOnTop()) {
|
|
||||||
$topBtn.addClass('active');
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
$topBtn.on('click', () => {
|
|
||||||
$topBtn.trigger('blur');
|
|
||||||
const remote = utils.dynamicRequire('@electron/remote');
|
|
||||||
const focusedWindow = remote.BrowserWindow.getFocusedWindow();
|
|
||||||
const isAlwaysOnTop = focusedWindow.isAlwaysOnTop()
|
|
||||||
if (isAlwaysOnTop) {
|
|
||||||
focusedWindow.setAlwaysOnTop(false)
|
|
||||||
$topBtn.removeClass('active');
|
|
||||||
} else {
|
|
||||||
focusedWindow.setAlwaysOnTop(true);
|
|
||||||
$topBtn.addClass('active');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$minimizeBtn.on('click', () => {
|
$minimizeBtn.on('click', () => {
|
||||||
$minimizeBtn.trigger('blur');
|
$minimizeBtn.trigger('blur');
|
||||||
const remote = utils.dynamicRequire('@electron/remote');
|
const remote = utils.dynamicRequire('@electron/remote');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user