mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
Close to tray (#168)
* Close to Tray implemented * Enable Tray Icon on Linux * Rever german locale * Revert eaf730e51cd6ea025ba78a4e7904bc47e0b44147 * Show quit button in file menu only for linux and windows
This commit is contained in:
parent
178053e9fd
commit
03117facbb
@ -52,6 +52,16 @@
|
||||
</div>
|
||||
<small class="help-block">{{'enableMinToTrayDesc' | i18n}}</small>
|
||||
</div>
|
||||
<div class="form-group" *ngIf="showMinToTray">
|
||||
<div class="checkbox">
|
||||
<label for="enableCloseToTray">
|
||||
<input id="enableCloseToTray" type="checkbox" name="EnableCloseToTray"
|
||||
[(ngModel)]="enableCloseToTray" (change)="saveCloseToTray()">
|
||||
{{'enableCloseToTray' | i18n}}
|
||||
</label>
|
||||
</div>
|
||||
<small class="help-block">{{'enableCloseToTrayDesc' | i18n}}</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label for="disableGa">
|
||||
|
@ -30,6 +30,7 @@ export class SettingsComponent implements OnInit {
|
||||
disableGa: boolean = false;
|
||||
disableFavicons: boolean = false;
|
||||
enableMinToTray: boolean = false;
|
||||
enableCloseToTray: boolean = false;
|
||||
enableTray: boolean = false;
|
||||
showMinToTray: boolean = false;
|
||||
locale: string;
|
||||
@ -78,6 +79,7 @@ export class SettingsComponent implements OnInit {
|
||||
this.lockOption = await this.storageService.get<number>(ConstantsService.lockOptionKey);
|
||||
this.disableFavicons = await this.storageService.get<boolean>(ConstantsService.disableFaviconKey);
|
||||
this.enableMinToTray = await this.storageService.get<boolean>(ElectronConstants.enableMinimizeToTrayKey);
|
||||
this.enableCloseToTray = await this.storageService.get<boolean>(ElectronConstants.enableCloseToTrayKey);
|
||||
this.enableTray = await this.storageService.get<boolean>(ElectronConstants.enableTrayKey);
|
||||
this.locale = await this.storageService.get<string>(ConstantsService.localeKey);
|
||||
this.theme = await this.storageService.get<string>(ConstantsService.themeKey);
|
||||
@ -113,6 +115,11 @@ export class SettingsComponent implements OnInit {
|
||||
this.callAnalytics('MinimizeToTray', this.enableMinToTray);
|
||||
}
|
||||
|
||||
async saveCloseToTray() {
|
||||
await this.storageService.save(ElectronConstants.enableCloseToTrayKey, this.enableCloseToTray);
|
||||
this.callAnalytics('CloseToTray', this.enableCloseToTray);
|
||||
}
|
||||
|
||||
async saveTray() {
|
||||
await this.storageService.save(ElectronConstants.enableTrayKey, this.enableTray);
|
||||
this.callAnalytics('Tray', this.enableTray);
|
||||
|
@ -806,6 +806,12 @@
|
||||
"enableMinToTrayDesc": {
|
||||
"message": "When minimizing the window, show an icon in the system tray instead."
|
||||
},
|
||||
"enableCloseToTray": {
|
||||
"message": "Close to Tray Icon"
|
||||
},
|
||||
"enableCloseToTrayDesc": {
|
||||
"message": "When closing the window, show an icon in the system tray instead."
|
||||
},
|
||||
"enableTray": {
|
||||
"message": "Enable Tray Icon"
|
||||
},
|
||||
|
@ -367,6 +367,13 @@ export class MenuMain extends BaseMenu {
|
||||
},
|
||||
];
|
||||
|
||||
const firstMenuOptionsWindowsLinux: MenuItemConstructorOptions[] = [
|
||||
{
|
||||
label: this.i18nService.t('quitBitwarden'),
|
||||
role: 'quit',
|
||||
},
|
||||
];
|
||||
|
||||
const updateMenuItem = {
|
||||
label: this.main.i18nService.t('checkForUpdates'),
|
||||
click: () => this.main.updaterMain.checkForUpdate(true),
|
||||
@ -398,6 +405,10 @@ export class MenuMain extends BaseMenu {
|
||||
// File menu
|
||||
template[0].submenu = (template[0].submenu as MenuItemConstructorOptions[]).concat(
|
||||
firstMenuOptions);
|
||||
if(process.platform === 'linux' || process.platform === 'win32') {
|
||||
template[0].submenu = (template[0].submenu as MenuItemConstructorOptions[]).concat(
|
||||
firstMenuOptionsWindowsLinux);
|
||||
}
|
||||
|
||||
// About menu
|
||||
const aboutMenuAdditions: MenuItemConstructorOptions[] = [
|
||||
|
Loading…
Reference in New Issue
Block a user