mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
Add support on mac for minimize to menu bar on close, minimize or start
This commit is contained in:
@@ -103,30 +103,30 @@
|
|||||||
<label for="enableMinToTray">
|
<label for="enableMinToTray">
|
||||||
<input id="enableMinToTray" type="checkbox" name="EnableMinToTray"
|
<input id="enableMinToTray" type="checkbox" name="EnableMinToTray"
|
||||||
[(ngModel)]="enableMinToTray" (change)="saveMinToTray()">
|
[(ngModel)]="enableMinToTray" (change)="saveMinToTray()">
|
||||||
{{'enableMinToTray' | i18n}}
|
{{enableMinToTrayText}}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<small class="help-block">{{'enableMinToTrayDesc' | i18n}}</small>
|
<small class="help-block">{{enableMinToTrayDescText}}</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" *ngIf="showMinToTray">
|
<div class="form-group" *ngIf="showMinToTray">
|
||||||
<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"
|
||||||
[(ngModel)]="enableCloseToTray" (change)="saveCloseToTray()">
|
[(ngModel)]="enableCloseToTray" (change)="saveCloseToTray()">
|
||||||
{{'enableCloseToTray' | i18n}}
|
{{enableCloseToTrayText}}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<small class="help-block">{{'enableCloseToTrayDesc' | i18n}}</small>
|
<small class="help-block">{{enableCloseToTrayDescText}}</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" *ngIf="showMinToTray">
|
<div class="form-group" *ngIf="showMinToTray">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label for="startToTray">
|
<label for="startToTray">
|
||||||
<input id="startToTray" type="checkbox" name="StartToTray" [(ngModel)]="startToTray"
|
<input id="startToTray" type="checkbox" name="StartToTray" [(ngModel)]="startToTray"
|
||||||
(change)="saveStartToTray()">
|
(change)="saveStartToTray()">
|
||||||
{{'startToTray' | i18n}}
|
{{startToTrayText}}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<small class="help-block">{{'startToTrayDesc' | i18n}}</small>
|
<small class="help-block">{{startToTrayDescText}}</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" *ngIf="showAlwaysShowDock">
|
<div class="form-group" *ngIf="showAlwaysShowDock">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
|
|||||||
@@ -46,23 +46,44 @@ export class SettingsComponent implements OnInit {
|
|||||||
themeOptions: any[];
|
themeOptions: any[];
|
||||||
clearClipboard: number;
|
clearClipboard: number;
|
||||||
clearClipboardOptions: any[];
|
clearClipboardOptions: any[];
|
||||||
enableTrayText: string;
|
|
||||||
enableTrayDescText: string;
|
|
||||||
supportsBiometric: boolean;
|
supportsBiometric: boolean;
|
||||||
biometric: boolean;
|
biometric: boolean;
|
||||||
biometricText: string;
|
biometricText: string;
|
||||||
alwaysShowDock: boolean;
|
alwaysShowDock: boolean;
|
||||||
showAlwaysShowDock: boolean = false;
|
showAlwaysShowDock: boolean = false;
|
||||||
|
|
||||||
|
enableTrayText: string;
|
||||||
|
enableTrayDescText: string;
|
||||||
|
enableMinToTrayText: string;
|
||||||
|
enableMinToTrayDescText: string;
|
||||||
|
enableCloseToTrayText: string;
|
||||||
|
enableCloseToTrayDescText: string;
|
||||||
|
startToTrayText: string;
|
||||||
|
startToTrayDescText: string;
|
||||||
|
|
||||||
constructor(private analytics: Angulartics2, private toasterService: ToasterService,
|
constructor(private analytics: Angulartics2, private toasterService: ToasterService,
|
||||||
private i18nService: I18nService, private platformUtilsService: PlatformUtilsService,
|
private i18nService: I18nService, private platformUtilsService: PlatformUtilsService,
|
||||||
private storageService: StorageService, private vaultTimeoutService: VaultTimeoutService,
|
private storageService: StorageService, private vaultTimeoutService: VaultTimeoutService,
|
||||||
private stateService: StateService, private messagingService: MessagingService,
|
private stateService: StateService, private messagingService: MessagingService,
|
||||||
private userService: UserService, private cryptoService: CryptoService) {
|
private userService: UserService, private cryptoService: CryptoService) {
|
||||||
const trayKey = this.platformUtilsService.getDevice() === DeviceType.MacOsDesktop ?
|
const isMac = this.platformUtilsService.getDevice() === DeviceType.MacOsDesktop;
|
||||||
'enableMenuBar' : 'enableTray';
|
|
||||||
|
const trayKey = isMac ? 'enableMenuBar' : 'enableTray';
|
||||||
this.enableTrayText = this.i18nService.t(trayKey);
|
this.enableTrayText = this.i18nService.t(trayKey);
|
||||||
this.enableTrayDescText = this.i18nService.t(trayKey + 'Desc');
|
this.enableTrayDescText = this.i18nService.t(trayKey + 'Desc');
|
||||||
|
|
||||||
|
const minToTrayKey = isMac ? 'enableMinToMenuBar' : 'enableMinToTray';
|
||||||
|
this.enableMinToTrayText = this.i18nService.t(minToTrayKey)
|
||||||
|
this.enableMinToTrayDescText = this.i18nService.t(minToTrayKey + 'Desc');
|
||||||
|
|
||||||
|
const closeToTrayKey = isMac ? 'enableCloseToMenuBar' : 'enableCloseToTray';
|
||||||
|
this.enableCloseToTrayText = this.i18nService.t(closeToTrayKey)
|
||||||
|
this.enableCloseToTrayDescText = this.i18nService.t(closeToTrayKey + 'Desc');
|
||||||
|
|
||||||
|
const startToTrayKey = isMac ? 'startToMenuBar' : 'startToTray';
|
||||||
|
this.startToTrayText = this.i18nService.t(startToTrayKey)
|
||||||
|
this.startToTrayDescText = this.i18nService.t(startToTrayKey + 'Desc');
|
||||||
|
|
||||||
this.vaultTimeouts = [
|
this.vaultTimeouts = [
|
||||||
// { name: i18nService.t('immediately'), value: 0 },
|
// { name: i18nService.t('immediately'), value: 0 },
|
||||||
{ name: i18nService.t('oneMinute'), value: 1 },
|
{ name: i18nService.t('oneMinute'), value: 1 },
|
||||||
@@ -115,7 +136,7 @@ export class SettingsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.showMinToTray = this.platformUtilsService.getDevice() === DeviceType.WindowsDesktop;
|
this.showMinToTray = this.platformUtilsService.getDevice() !== DeviceType.LinuxDesktop;
|
||||||
this.vaultTimeout = await this.storageService.get<number>(ConstantsService.vaultTimeoutKey);
|
this.vaultTimeout = await this.storageService.get<number>(ConstantsService.vaultTimeoutKey);
|
||||||
this.vaultTimeoutAction = await this.storageService.get<string>(ConstantsService.vaultTimeoutActionKey);
|
this.vaultTimeoutAction = await this.storageService.get<string>(ConstantsService.vaultTimeoutActionKey);
|
||||||
const pinSet = await this.vaultTimeoutService.isPinLockSet();
|
const pinSet = await this.vaultTimeoutService.isPinLockSet();
|
||||||
|
|||||||
@@ -852,12 +852,24 @@
|
|||||||
"enableMinToTrayDesc": {
|
"enableMinToTrayDesc": {
|
||||||
"message": "When minimizing the window, show an icon in the system tray instead."
|
"message": "When minimizing the window, show an icon in the system tray instead."
|
||||||
},
|
},
|
||||||
|
"enableMinToMenuBar": {
|
||||||
|
"message": "Minimize to menu bar"
|
||||||
|
},
|
||||||
|
"enableMinToMenuBarDesc": {
|
||||||
|
"message": "When minimizing the window, show an icon in the menu bar instead."
|
||||||
|
},
|
||||||
"enableCloseToTray": {
|
"enableCloseToTray": {
|
||||||
"message": "Close to Tray Icon"
|
"message": "Close to Tray Icon"
|
||||||
},
|
},
|
||||||
"enableCloseToTrayDesc": {
|
"enableCloseToTrayDesc": {
|
||||||
"message": "When closing the window, show an icon in the system tray instead."
|
"message": "When closing the window, show an icon in the system tray instead."
|
||||||
},
|
},
|
||||||
|
"enableCloseToMenuBar": {
|
||||||
|
"message": "Close to menu bar"
|
||||||
|
},
|
||||||
|
"enableCloseToMenuBarDesc": {
|
||||||
|
"message": "When closing the window, show an icon in the menu bar instead."
|
||||||
|
},
|
||||||
"enableTray": {
|
"enableTray": {
|
||||||
"message": "Enable Tray Icon"
|
"message": "Enable Tray Icon"
|
||||||
},
|
},
|
||||||
@@ -870,6 +882,12 @@
|
|||||||
"startToTrayDesc": {
|
"startToTrayDesc": {
|
||||||
"message": "When the application is first started, only show an icon in the system tray."
|
"message": "When the application is first started, only show an icon in the system tray."
|
||||||
},
|
},
|
||||||
|
"startToMenuBar": {
|
||||||
|
"message": "Start to menu bar"
|
||||||
|
},
|
||||||
|
"startToMenuBarDesc": {
|
||||||
|
"message": "When the application is first started, only show an icon in the menu bar."
|
||||||
|
},
|
||||||
"alwaysShowDock": {
|
"alwaysShowDock": {
|
||||||
"message": "Always show in the Dock"
|
"message": "Always show in the Dock"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user