Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Core 2022-03-10 17:31:02 +00:00
commit 6da8c3c2b6
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
45 changed files with 11490 additions and 480 deletions

View file

@ -120,6 +120,8 @@ export class AppEvents {
public ready(plug: any) {
this.plugin = plug
console.log('[AppEvents] App ready');
AppEvents.setLoginSettings()
}
public bwCreated() {
@ -139,7 +141,9 @@ export class AppEvents {
}
this.InstanceHandler()
this.InitTray()
if (process.platform !== "darwin") {
this.InitTray()
}
}
/***********************************************************************************************************************
@ -329,4 +333,23 @@ export class AppEvents {
clipboard.writeText(data)
})
}
/**
* Set login settings
* @private
*/
private static setLoginSettings() {
if (utils.getStoreValue('general.onStartup.enabled')) {
app.setLoginItemSettings({
openAtLogin: true,
path: app.getPath('exe'),
args: [`${utils.getStoreValue('general.onStartup.hidden') ? '--hidden' : ''}`]
})
} else {
app.setLoginItemSettings({
openAtLogin: false,
path: app.getPath('exe')
})
}
}
}

View file

@ -10,7 +10,6 @@ import {networkInterfaces} from "os";
import * as mm from 'music-metadata';
import fetch from 'electron-fetch'
import {wsapi} from "./wsapi";
import {AppImageUpdater, NsisUpdater} from "electron-updater";
import {utils} from './utils';
import {Plugins} from "./plugins";
@ -1130,8 +1129,18 @@ export class BrowserWindow {
isQuiting = true
});
app.on('activate', function(){
BrowserWindow.win.show()
BrowserWindow.win.focus()
});
// Quit when all windows are closed.
app.on('window-all-closed', () => {
app.quit()
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
BrowserWindow.win.on("closed", () => {

View file

@ -7,7 +7,6 @@ export class Store {
private defaults: any = {
"general": {
"close_button_hide": false,
"open_on_startup": false,
"discord_rpc": 1, // 0 = disabled, 1 = enabled as Cider, 2 = enabled as Apple Music
"discord_rpc_clear_on_pause": true,
"language": "en_US", // electron.app.getLocale().replace('-', '_') this can be used in future
@ -23,6 +22,10 @@ export class Store {
"artists": true,
"videos": true,
"podcasts": true
},
"onStartup": {
"enabled": false,
"hidden": false,
}
},
"home": {

View file

@ -1,4 +1,5 @@
import {app, Menu, shell} from "electron";
import {utils} from "../base/utils";
export default class Thumbar {
/**
@ -76,13 +77,19 @@ export default class Thumbar {
label: 'Window',
submenu: [
{role: 'minimize'},
{
label: 'Show',
click: () => utils.getWindow().show()
},
{role: 'zoom'},
...(this.isMac ? [
{type: 'separator'},
{role: 'front'},
] : [
{role: 'close'}
{}
]),
{role: 'close'},
{type: 'separator'},
{
label: 'Edit',
submenu: [