mirror of https://github.com/keeweb/keeweb
fix #689: custom title bar on Windows
parent
7e2823903b
commit
0f4434a361
@ -0,0 +1,60 @@
|
||||
import { View } from 'framework/views/view';
|
||||
import { Events } from 'framework/events';
|
||||
import { Launcher } from 'comp/launcher';
|
||||
import template from 'templates/titlebar-buttons.hbs';
|
||||
|
||||
class TitlebarButtonsView extends View {
|
||||
parent = '.app__titlebar';
|
||||
|
||||
template = template;
|
||||
|
||||
events = {
|
||||
'click .titlebar-buttons-minimize': 'clickMinimize',
|
||||
'click .titlebar-buttons-maximize': 'clickMaximize',
|
||||
'click .titlebar-buttons-restore': 'clickRestore',
|
||||
'click .titlebar-buttons-close': 'clickClose'
|
||||
};
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.maximized = Launcher.mainWindowMaximized();
|
||||
|
||||
this.listenTo(Events, 'app-maximized', this.appMaximized);
|
||||
this.listenTo(Events, 'app-unmaximized', this.appUnmaximized);
|
||||
}
|
||||
|
||||
render() {
|
||||
super.render({
|
||||
maximized: this.maximized
|
||||
});
|
||||
}
|
||||
|
||||
clickMinimize() {
|
||||
Launcher.minimizeMainWindow();
|
||||
}
|
||||
|
||||
clickMaximize() {
|
||||
Launcher.maximizeMainWindow();
|
||||
}
|
||||
|
||||
clickRestore() {
|
||||
Launcher.restoreMainWindow();
|
||||
}
|
||||
|
||||
clickClose() {
|
||||
window.close();
|
||||
}
|
||||
|
||||
appMaximized() {
|
||||
this.maximized = true;
|
||||
this.render();
|
||||
}
|
||||
|
||||
appUnmaximized() {
|
||||
this.maximized = false;
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
|
||||
export { TitlebarButtonsView };
|
@ -0,0 +1,19 @@
|
||||
.titlebar-buttons {
|
||||
font-size: 0;
|
||||
|
||||
> .fa {
|
||||
-webkit-app-region: no-drag;
|
||||
font-size: 16px;
|
||||
padding: 4px 16px;
|
||||
height: $custom-titlebar-height;
|
||||
box-sizing: border-box;
|
||||
&:hover {
|
||||
background: var(--titlebar-button-background-color);
|
||||
}
|
||||
&.fa-titlebar-close {
|
||||
&:hover {
|
||||
background: $titlebar-close-button-background-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<div class="titlebar-buttons">
|
||||
<i class="fa fa-titlebar-minimize titlebar-buttons-minimize"></i>
|
||||
{{#if maximized}}
|
||||
<i class="fa fa-titlebar-restore titlebar-buttons-restore"></i>
|
||||
{{else}}
|
||||
<i class="fa fa-titlebar-maximize titlebar-buttons-maximize"></i>
|
||||
{{/if}}
|
||||
<i class="fa fa-titlebar-close titlebar-buttons-close"></i>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000" width="512" height="512"><path d="M445 500l-285 -285l55 -55l285 285l285 -285l55 55l-285 285l285 285l-55 55l-285 -285l-285 285l-55 -55z"/></svg>
|
After Width: | Height: | Size: 208 B |
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000" width="512" height="512"><path d="M188 813v-625h625v625h-625zM750 250h-500v500h500v-500z"/></svg>
|
After Width: | Height: | Size: 162 B |
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000" width="512" height="512"><path d="M875 500v-62h-687v62h687z"/></svg>
|
After Width: | Height: | Size: 133 B |
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000" width="512" height="512"><path d="M188 688v-563h562v563h-562zM688 188h-438v437h438v-437zM313 688h62v62h438v-437h-63v-63h125v563h-562v-125z"/></svg>
|
After Width: | Height: | Size: 212 B |
Loading…
Reference in New Issue