macOS Changes
onStartup implemented
This commit is contained in:
parent
bab1b0db4d
commit
b71a7b22c0
6 changed files with 99 additions and 62 deletions
|
@ -120,6 +120,8 @@ export class AppEvents {
|
|||
public ready(plug: any) {
|
||||
this.plugin = plug
|
||||
console.log('[AppEvents] App ready');
|
||||
|
||||
AppEvents.setLoginSettings()
|
||||
}
|
||||
|
||||
public bwCreated() {
|
||||
|
@ -139,8 +141,10 @@ export class AppEvents {
|
|||
}
|
||||
|
||||
this.InstanceHandler()
|
||||
if (process.platform !== "darwin") {
|
||||
this.InitTray()
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private methods
|
||||
|
@ -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')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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', () => {
|
||||
// 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", () => {
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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: [
|
||||
|
|
|
@ -1060,41 +1060,19 @@ input[type=range].web-slider::-webkit-slider-runnable-track {
|
|||
}
|
||||
|
||||
body[platform="darwin"] .app-chrome .app-chrome-item > .window-controls > div.minimize {
|
||||
height: 12px;
|
||||
width: 12px;
|
||||
background-color: rgb(255, 92, 92);
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
margin: auto 4px;
|
||||
color: rgb(130, 0, 5);
|
||||
-webkit-app-region: no-drag;
|
||||
background-image: unset;
|
||||
display: none;
|
||||
}
|
||||
|
||||
body[platform="darwin"] .app-chrome .app-chrome-item > .window-controls {
|
||||
width: 67px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
body[platform="darwin"] .app-chrome .app-chrome-item > .window-controls > div.minmax {
|
||||
height: 12px;
|
||||
width: 12px;
|
||||
background-color: rgb(255, 189, 76);
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
margin: auto 4px;
|
||||
-webkit-app-region: no-drag;
|
||||
background-image: unset;
|
||||
display: none;
|
||||
}
|
||||
|
||||
body[platform="darwin"] .app-chrome .app-chrome-item > .window-controls > div.close {
|
||||
height: 12px;
|
||||
width: 12px;
|
||||
background-color: rgb(0, 202, 86);
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
margin: auto 4px auto 4px;
|
||||
-webkit-app-region: no-drag;
|
||||
background-image: unset;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.app-chrome .app-chrome-item.playback-controls {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script type="text/x-template" id="cider-settings">
|
||||
<div class="content-inner settings-page">
|
||||
<div class="md-option-container">
|
||||
<!-- General Settings -->
|
||||
<div class="md-option-header">
|
||||
<span>{{$root.getLz('settings.header.general')}}</span>
|
||||
</div>
|
||||
|
@ -43,6 +44,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Audio Settings -->
|
||||
<div class="md-option-header">
|
||||
<span>{{$root.getLz('settings.header.audio')}}</span>
|
||||
</div>
|
||||
|
@ -123,6 +126,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Visual Settings -->
|
||||
<div class="md-option-header">
|
||||
<span>{{$root.getLz('settings.header.visual')}}</span>
|
||||
</div>
|
||||
|
@ -244,6 +249,38 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Window Settings -->
|
||||
<div class="md-option-header">
|
||||
<span>{{$root.getLz('settings.header.window')}}</span>
|
||||
</div>
|
||||
<div class="settings-option-body">
|
||||
<div class="md-option-line">
|
||||
<div class="md-option-segment">
|
||||
{{$root.getLz('settings.option.window.openOnStartup')}}
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<input type="checkbox" v-model="app.cfg.general.onStartup.enabled" switch/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line" v-show="app.cfg.general.onStartup.enabled">
|
||||
<div class="md-option-segment">
|
||||
{{$root.getLz('settings.option.window.openOnStartup.hidden')}}
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<input type="checkbox" v-model="app.cfg.general.onStartup.hidden" switch/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line" v-show="app.platform !== 'darwin'">
|
||||
<div class="md-option-segment">
|
||||
{{$root.getLz("settings.option.widow.close_button_hide")}}
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<input type="checkbox" v-model="app.cfg.general.close_button_hide" switch/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Lyric Settings -->
|
||||
<div class="md-option-header">
|
||||
<span>{{$root.getLz('settings.header.lyrics')}}</span>
|
||||
</div>
|
||||
|
@ -548,6 +585,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Connectivity Settings -->
|
||||
<div class="md-option-header">
|
||||
<span>{{$root.getLz('settings.header.connectivity')}}</span>
|
||||
</div>
|
||||
|
@ -628,8 +667,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Debug Settings -->
|
||||
<div class="md-option-header">
|
||||
<span>{{$root.getLz('settings.header.debug')}}</span>
|
||||
</div>
|
||||
|
@ -656,7 +694,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Experimental Settings -->
|
||||
<div class="md-option-header">
|
||||
<span>{{$root.getLz('settings.header.experimental')}}</span>
|
||||
</div>
|
||||
|
@ -736,14 +774,6 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line">
|
||||
<div class="md-option-segment">
|
||||
{{$root.getLz("settings.option.experimental.close_button_hide")}}
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<input type="checkbox" v-model="app.cfg.general.close_button_hide" switch/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line update-check">
|
||||
<div class="md-option-segment">
|
||||
{{$root.getLz('settings.option.general.updateCider')}}
|
||||
|
@ -780,11 +810,12 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="opacity: 0.5; pointer-events: none">
|
||||
|
||||
<!-- Unfinished Settings -->
|
||||
<div class="md-option-header">
|
||||
<span>{{$root.getLz('settings.header.unfinished')}}</span>
|
||||
</div>
|
||||
<div class="settings-option-body">
|
||||
<div class="settings-option-body" style="opacity: 0.5; pointer-events: none">
|
||||
|
||||
<div class="md-option-line">
|
||||
<div class="md-option-segment">
|
||||
|
@ -822,20 +853,6 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line">
|
||||
<div class="md-option-segment">
|
||||
Open Cider on Startup
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<select class="md-select">
|
||||
<option value='0'>Never</option>
|
||||
<option value='1'>Always</option>
|
||||
<option value='2'>Always, minimized</option>
|
||||
<option value='2'>Always, hidden in tray</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue