1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-12-02 13:13:31 +01:00

start to tray updates

This commit is contained in:
Kyle Spearrin 2019-02-02 12:27:06 -05:00
parent a380188120
commit 65845cd909
5 changed files with 23 additions and 28 deletions

2
jslib

@ -1 +1 @@
Subproject commit b01709240e4fc0674caea4edfebe5e46249c2bd2 Subproject commit 04e6fac5e46b4ab1ab62592c6654396f384bdf76

View File

@ -53,16 +53,6 @@
<small class="help-block">{{'enableMinToTrayDesc' | i18n}}</small> <small class="help-block">{{'enableMinToTrayDesc' | i18n}}</small>
</div> </div>
<div class="form-group" *ngIf="showMinToTray"> <div class="form-group" *ngIf="showMinToTray">
<div class="checkbox">
<label for="startMinimized">
<input id="startMinimized" type="checkbox" name="StartMinimized"
[(ngModel)]="startMinimized" (change)="saveStartMinimized()">
{{'startMinimized' | i18n}}
</label>
</div>
<small class="help-block">{{'startMinimizedDesc' | i18n}}</small>
</div>
<div class="form-group">
<div class="checkbox"> <div class="checkbox">
<label for="enableCloseToTray"> <label for="enableCloseToTray">
<input id="enableCloseToTray" type="checkbox" name="EnableCloseToTray" <input id="enableCloseToTray" type="checkbox" name="EnableCloseToTray"
@ -72,6 +62,16 @@
</div> </div>
<small class="help-block">{{'enableCloseToTrayDesc' | i18n}}</small> <small class="help-block">{{'enableCloseToTrayDesc' | i18n}}</small>
</div> </div>
<div class="form-group" *ngIf="showMinToTray">
<div class="checkbox">
<label for="startToTray">
<input id="startToTray" type="checkbox" name="StartToTray"
[(ngModel)]="startToTray" (change)="saveStartToTray()">
{{'startToTray' | i18n}}
</label>
</div>
<small class="help-block">{{'startToTrayDesc' | i18n}}</small>
</div>
<div class="form-group"> <div class="form-group">
<label for="theme">{{'theme' | i18n}}</label> <label for="theme">{{'theme' | i18n}}</label>
<select id="theme" name="Theme" [(ngModel)]="theme" (change)="saveTheme()"> <select id="theme" name="Theme" [(ngModel)]="theme" (change)="saveTheme()">

View File

@ -32,7 +32,7 @@ export class SettingsComponent implements OnInit {
enableCloseToTray: boolean = false; enableCloseToTray: boolean = false;
enableTray: boolean = false; enableTray: boolean = false;
showMinToTray: boolean = false; showMinToTray: boolean = false;
startMinimized: boolean = false; startToTray: boolean = false;
locale: string; locale: string;
lockOptions: any[]; lockOptions: any[];
localeOptions: any[]; localeOptions: any[];
@ -81,7 +81,7 @@ export class SettingsComponent implements OnInit {
this.enableMinToTray = await this.storageService.get<boolean>(ElectronConstants.enableMinimizeToTrayKey); this.enableMinToTray = await this.storageService.get<boolean>(ElectronConstants.enableMinimizeToTrayKey);
this.enableCloseToTray = await this.storageService.get<boolean>(ElectronConstants.enableCloseToTrayKey); this.enableCloseToTray = await this.storageService.get<boolean>(ElectronConstants.enableCloseToTrayKey);
this.enableTray = await this.storageService.get<boolean>(ElectronConstants.enableTrayKey); this.enableTray = await this.storageService.get<boolean>(ElectronConstants.enableTrayKey);
this.startMinimized = await this.storageService.get<boolean>(ElectronConstants.enableStartMinimizedKey); this.startToTray = await this.storageService.get<boolean>(ElectronConstants.enableStartToTrayKey);
this.locale = await this.storageService.get<string>(ConstantsService.localeKey); this.locale = await this.storageService.get<string>(ConstantsService.localeKey);
this.theme = await this.storageService.get<string>(ConstantsService.themeKey); this.theme = await this.storageService.get<string>(ConstantsService.themeKey);
} }
@ -113,9 +113,9 @@ export class SettingsComponent implements OnInit {
this.messagingService.send(this.enableTray ? 'showTray' : 'removeTray'); this.messagingService.send(this.enableTray ? 'showTray' : 'removeTray');
} }
async saveStartMinimized() { async saveStartToTray() {
await this.storageService.save(ElectronConstants.enableStartMinimizedKey, this.startMinimized); await this.storageService.save(ElectronConstants.enableStartToTrayKey, this.startToTray);
this.callAnalytics('StartMinimized', this.startMinimized); this.callAnalytics('StartToTray', this.startToTray);
} }
async saveLocale() { async saveLocale() {

View File

@ -821,11 +821,11 @@
"enableTrayDesc": { "enableTrayDesc": {
"message": "Always show an icon in the system tray." "message": "Always show an icon in the system tray."
}, },
"startMinimized": { "startToTray": {
"message": "Start minimized" "message": "Start To Tray Icon"
}, },
"startMinimizedDesc": { "startToTrayDesc": {
"message": "When starting the application, it will only show an icon in the system tray." "message": "When the application is first started, only show an icon in the system tray."
}, },
"language": { "language": {
"message": "Language" "message": "Language"

View File

@ -1,8 +1,4 @@
import { import { app } from 'electron';
app,
BrowserWindow,
MenuItemConstructorOptions,
} from 'electron';
import * as path from 'path'; import * as path from 'path';
import { I18nService } from './services/i18n.service'; import { I18nService } from './services/i18n.service';
@ -12,9 +8,9 @@ import { MessagingMain } from './main/messaging.main';
import { PowerMonitorMain } from './main/powerMonitor.main'; import { PowerMonitorMain } from './main/powerMonitor.main';
import { ConstantsService } from 'jslib/services/constants.service'; import { ConstantsService } from 'jslib/services/constants.service';
import { ElectronConstants } from 'jslib/electron/electronConstants';
import { LowdbStorageService } from 'jslib/services/lowdbStorage.service'; import { LowdbStorageService } from 'jslib/services/lowdbStorage.service';
import { ElectronConstants } from 'jslib/electron/electronConstants';
import { KeytarStorageListener } from 'jslib/electron/keytarStorageListener'; import { KeytarStorageListener } from 'jslib/electron/keytarStorageListener';
import { ElectronLogService } from 'jslib/electron/services/electronLog.service'; import { ElectronLogService } from 'jslib/electron/services/electronLog.service';
import { ElectronMainMessagingService } from 'jslib/electron/services/electronMainMessaging.service'; import { ElectronMainMessagingService } from 'jslib/electron/services/electronMainMessaging.service';
@ -104,8 +100,7 @@ export class Main {
click: () => this.messagingService.send('lockVault'), click: () => this.messagingService.send('lockVault'),
}]); }]);
await this.updaterMain.init(); await this.updaterMain.init();
if (await this.storageService.get<boolean>(ElectronConstants.enableStartToTrayKey)) {
if(await this.storageService.get<boolean>(ElectronConstants.enableStartMinimizedKey)) {
this.trayMain.hideToTray(); this.trayMain.hideToTray();
} }
}, (e: any) => { }, (e: any) => {