Add support for "openAtLogin"
This commit is contained in:
parent
f926f80d8c
commit
f512df309d
|
@ -130,13 +130,13 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label for="startOnLogin">
|
<label for="openAtLogin">
|
||||||
<input id="startOnLogin" type="checkbox" name="StartOnLogin" [(ngModel)]="startOnLogin"
|
<input id="openAtLogin" type="checkbox" name="OpenAtLogin" [(ngModel)]="openAtLogin"
|
||||||
(change)="saveStartOnLogin()">
|
(change)="saveOpenAtLogin()">
|
||||||
{{'startOnLogin' | i18n}}
|
{{'openAtLogin' | i18n}}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<small class="help-block">{{'startOnLoginDesc' | i18n}}</small>
|
<small class="help-block">{{'openAtLoginDesc' | i18n}}</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" *ngIf="showAlwaysShowDock">
|
<div class="form-group" *ngIf="showAlwaysShowDock">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
|
|
|
@ -51,7 +51,7 @@ export class SettingsComponent implements OnInit {
|
||||||
biometricText: string;
|
biometricText: string;
|
||||||
alwaysShowDock: boolean;
|
alwaysShowDock: boolean;
|
||||||
showAlwaysShowDock: boolean = false;
|
showAlwaysShowDock: boolean = false;
|
||||||
startOnLogin: boolean;
|
openAtLogin: boolean;
|
||||||
|
|
||||||
enableTrayText: string;
|
enableTrayText: string;
|
||||||
enableTrayDescText: string;
|
enableTrayDescText: string;
|
||||||
|
@ -157,6 +157,7 @@ export class SettingsComponent implements OnInit {
|
||||||
this.biometricText = await this.storageService.get<string>(ConstantsService.biometricText);
|
this.biometricText = await this.storageService.get<string>(ConstantsService.biometricText);
|
||||||
this.alwaysShowDock = await this.storageService.get<boolean>(ElectronConstants.alwaysShowDock);
|
this.alwaysShowDock = await this.storageService.get<boolean>(ElectronConstants.alwaysShowDock);
|
||||||
this.showAlwaysShowDock = this.platformUtilsService.getDevice() === DeviceType.MacOsDesktop;
|
this.showAlwaysShowDock = this.platformUtilsService.getDevice() === DeviceType.MacOsDesktop;
|
||||||
|
this.openAtLogin = await this.storageService.get<boolean>(ElectronConstants.openAtLogin);
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveVaultTimeoutOptions() {
|
async saveVaultTimeoutOptions() {
|
||||||
|
@ -307,8 +308,9 @@ export class SettingsComponent implements OnInit {
|
||||||
await this.storageService.save(ElectronConstants.alwaysShowDock, this.alwaysShowDock);
|
await this.storageService.save(ElectronConstants.alwaysShowDock, this.alwaysShowDock);
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveStartOnLogin() {
|
async saveOpenAtLogin() {
|
||||||
this.messagingService.send(this.startOnLogin ? 'addOpenAtLogin' : 'removeOpenAtLogin');
|
this.storageService.save(ElectronConstants.openAtLogin, this.openAtLogin);
|
||||||
|
this.messagingService.send(this.openAtLogin ? 'addOpenAtLogin' : 'removeOpenAtLogin');
|
||||||
}
|
}
|
||||||
|
|
||||||
private callAnalytics(name: string, enabled: boolean) {
|
private callAnalytics(name: string, enabled: boolean) {
|
||||||
|
|
|
@ -888,10 +888,10 @@
|
||||||
"startToMenuBarDesc": {
|
"startToMenuBarDesc": {
|
||||||
"message": "When the application is first started, only show an icon in the menu bar."
|
"message": "When the application is first started, only show an icon in the menu bar."
|
||||||
},
|
},
|
||||||
"startOnLogin": {
|
"openAtLogin": {
|
||||||
"message": "Start automatically on login"
|
"message": "Start automatically on login"
|
||||||
},
|
},
|
||||||
"startOnLoginDesc": {
|
"openAtLoginDesc": {
|
||||||
"message": "Start the Bitwarden Desktop application automatically on login."
|
"message": "Start the Bitwarden Desktop application automatically on login."
|
||||||
},
|
},
|
||||||
"alwaysShowDock": {
|
"alwaysShowDock": {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ipcMain } from 'electron';
|
import { app, ipcMain } from 'electron';
|
||||||
|
|
||||||
import { Main } from '../main';
|
import { Main } from '../main';
|
||||||
|
|
||||||
|
@ -15,6 +15,10 @@ export class MessagingMain {
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.scheduleNextSync();
|
this.scheduleNextSync();
|
||||||
|
if (process.platform !== 'linux') {
|
||||||
|
const loginSettings = app.getLoginItemSettings();
|
||||||
|
this.storageService.save(ElectronConstants.openAtLogin, loginSettings.openAtLogin);
|
||||||
|
}
|
||||||
ipcMain.on('messagingService', async (event: any, message: any) => this.onMessage(message));
|
ipcMain.on('messagingService', async (event: any, message: any) => this.onMessage(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,9 +48,15 @@ export class MessagingMain {
|
||||||
case 'hideToTray':
|
case 'hideToTray':
|
||||||
this.main.trayMain.hideToTray();
|
this.main.trayMain.hideToTray();
|
||||||
break;
|
break;
|
||||||
case 'addStartOnLogin':
|
case 'addOpenAtLogin':
|
||||||
|
if (process.platform !== 'linux') {
|
||||||
|
app.setLoginItemSettings({openAtLogin: true});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'removeStartOnLogin':
|
case 'removeOpenAtLogin':
|
||||||
|
if (process.platform !== 'linux') {
|
||||||
|
app.setLoginItemSettings({openAtLogin: false});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue