Merge pull request #614 from Hinton/hotfix/autostart-snap
Fix autostart in snap
This commit is contained in:
commit
28c0fdd3f5
2
jslib
2
jslib
|
@ -1 +1 @@
|
|||
Subproject commit 2c414ce27a5c14f6cd7f86cfd07096a192d058ca
|
||||
Subproject commit d7b5f0a26b15472b37aef2248dea51a2aa6d4916
|
|
@ -221,6 +221,7 @@
|
|||
"artifactName": "${productName}-${version}-${arch}.${ext}"
|
||||
},
|
||||
"snap": {
|
||||
"autoStart": true,
|
||||
"confinement": "strict",
|
||||
"plugs": [
|
||||
"default",
|
||||
|
|
|
@ -53,6 +53,7 @@ export class SettingsComponent implements OnInit {
|
|||
alwaysShowDock: boolean;
|
||||
showAlwaysShowDock: boolean = false;
|
||||
openAtLogin: boolean;
|
||||
requireEnableTray: boolean = false;
|
||||
|
||||
enableTrayText: string;
|
||||
enableTrayDescText: string;
|
||||
|
@ -70,6 +71,9 @@ export class SettingsComponent implements OnInit {
|
|||
private userService: UserService, private cryptoService: CryptoService) {
|
||||
const isMac = this.platformUtilsService.getDevice() === DeviceType.MacOsDesktop;
|
||||
|
||||
// Workaround to avoid ghosting trays https://github.com/electron/electron/issues/17622
|
||||
this.requireEnableTray = this.platformUtilsService.getDevice() === DeviceType.LinuxDesktop;
|
||||
|
||||
const trayKey = isMac ? 'enableMenuBar' : 'enableTray';
|
||||
this.enableTrayText = this.i18nService.t(trayKey);
|
||||
this.enableTrayDescText = this.i18nService.t(trayKey + 'Desc');
|
||||
|
@ -269,17 +273,44 @@ export class SettingsComponent implements OnInit {
|
|||
}
|
||||
|
||||
async saveCloseToTray() {
|
||||
if (this.requireEnableTray) {
|
||||
this.enableTray = true;
|
||||
await this.storageService.save(ElectronConstants.enableTrayKey, this.enableTray);
|
||||
}
|
||||
|
||||
await this.storageService.save(ElectronConstants.enableCloseToTrayKey, this.enableCloseToTray);
|
||||
this.callAnalytics('CloseToTray', this.enableCloseToTray);
|
||||
}
|
||||
|
||||
async saveTray() {
|
||||
if (this.requireEnableTray && !this.enableTray && (this.startToTray || this.enableCloseToTray)) {
|
||||
const confirm = await this.platformUtilsService.showDialog(
|
||||
this.i18nService.t('confirmTrayDesc'), this.i18nService.t('confirmTrayTitle'),
|
||||
this.i18nService.t('yes'), this.i18nService.t('no'), 'warning');
|
||||
|
||||
if (confirm) {
|
||||
this.startToTray = false;
|
||||
await this.storageService.save(ElectronConstants.enableStartToTrayKey, this.startToTray);
|
||||
this.enableCloseToTray = false;
|
||||
await this.storageService.save(ElectronConstants.enableCloseToTrayKey, this.enableCloseToTray);
|
||||
} else {
|
||||
this.enableTray = true;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
await this.storageService.save(ElectronConstants.enableTrayKey, this.enableTray);
|
||||
this.callAnalytics('Tray', this.enableTray);
|
||||
this.messagingService.send(this.enableTray ? 'showTray' : 'removeTray');
|
||||
}
|
||||
|
||||
async saveStartToTray() {
|
||||
if (this.requireEnableTray) {
|
||||
this.enableTray = true;
|
||||
await this.storageService.save(ElectronConstants.enableTrayKey, this.enableTray);
|
||||
}
|
||||
|
||||
await this.storageService.save(ElectronConstants.enableStartToTrayKey, this.startToTray);
|
||||
this.callAnalytics('StartToTray', this.startToTray);
|
||||
}
|
||||
|
|
|
@ -900,6 +900,12 @@
|
|||
"alwaysShowDockDesc": {
|
||||
"message": "Show the Bitwarden icon in the Dock even when minimized to the menu bar."
|
||||
},
|
||||
"confirmTrayTitle": {
|
||||
"message": "Confirm disable tray"
|
||||
},
|
||||
"confirmTrayDesc": {
|
||||
"message": "Disabling this setting will also disable all other tray related settings."
|
||||
},
|
||||
"language": {
|
||||
"message": "Language"
|
||||
},
|
||||
|
|
|
@ -102,13 +102,13 @@ export class MessagingMain {
|
|||
private addOpenAtLogin() {
|
||||
if (process.platform === 'linux') {
|
||||
const data = `[Desktop Entry]
|
||||
Type=Application
|
||||
Version=${app.getVersion()}
|
||||
Name=Bitwarden
|
||||
Comment=Bitwarden startup script
|
||||
Exec=${app.getPath('exe')}
|
||||
StartupNotify=false
|
||||
Terminal=false`;
|
||||
Type=Application
|
||||
Version=${app.getVersion()}
|
||||
Name=Bitwarden
|
||||
Comment=Bitwarden startup script
|
||||
Exec=${app.getPath('exe')}
|
||||
StartupNotify=false
|
||||
Terminal=false`;
|
||||
|
||||
const dir = path.dirname(this.linuxStartupFile());
|
||||
if (!fs.existsSync(dir)) {
|
||||
|
|
Loading…
Reference in New Issue