diff --git a/src/main/index.js b/src/main/index.js index a5c0c534..910d205c 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -4,6 +4,7 @@ import { } from 'electron' import Datastore from 'nedb' import path from 'path' +import cp from 'child_process' if (process.argv.includes('--version')) { console.log(`v${app.getVersion()}`) @@ -397,6 +398,11 @@ function runApp() { } }) + ipcMain.on('openInExternalPlayer', (_, payload) => { + const child = cp.spawn(payload.executable, payload.args, { detached: true, stdio: 'ignore' }) + child.unref() + }) + app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit() diff --git a/src/renderer/App.js b/src/renderer/App.js index 11af0ef6..fed5bf3a 100644 --- a/src/renderer/App.js +++ b/src/renderer/App.js @@ -76,6 +76,9 @@ export default Vue.extend({ }, defaultProfile: function () { return this.$store.getters.getDefaultProfile + }, + externalPlayer: function () { + return this.$store.getters.getExternalPlayer } }, mounted: function () { @@ -87,8 +90,6 @@ export default Vue.extend({ this.checkThemeSettings() await this.checkLocale() - this.dataReady = true - if (this.usingElectron) { console.log('User is using Electron') ipcRenderer = require('electron').ipcRenderer @@ -96,8 +97,11 @@ export default Vue.extend({ this.openAllLinksExternally() this.enableOpenUrl() this.setBoundsOnClose() + await this.checkExternalPlayer() } + this.dataReady = true + setTimeout(() => { this.checkForNewUpdates() this.checkForNewBlogPosts() @@ -230,6 +234,14 @@ export default Vue.extend({ } }, + checkExternalPlayer: async function () { + const payload = { + isDev: this.isDev, + externalPlayer: this.externalPlayer + } + this.getExternalPlayerCmdArgumentsData(payload) + }, + handleUpdateBannerClick: function (response) { if (response !== false) { this.showReleaseNotes = true @@ -406,6 +418,7 @@ export default Vue.extend({ 'getRegionData', 'getYoutubeUrlInfo', 'getLocale', + 'getExternalPlayerCmdArgumentsData', 'setUpListenerToSyncSettings' ]) } diff --git a/src/renderer/components/external-player-settings/external-player-settings.js b/src/renderer/components/external-player-settings/external-player-settings.js new file mode 100644 index 00000000..62a15040 --- /dev/null +++ b/src/renderer/components/external-player-settings/external-player-settings.js @@ -0,0 +1,53 @@ +import Vue from 'vue' +import { mapActions } from 'vuex' +import FtCard from '../ft-card/ft-card.vue' +import FtSelect from '../ft-select/ft-select.vue' +import FtInput from '../ft-input/ft-input.vue' +import FtToggleSwitch from '../ft-toggle-switch/ft-toggle-switch.vue' +import FtFlexBox from '../ft-flex-box/ft-flex-box.vue' + +export default Vue.extend({ + name: 'ExternalPlayerSettings', + components: { + 'ft-card': FtCard, + 'ft-select': FtSelect, + 'ft-input': FtInput, + 'ft-toggle-switch': FtToggleSwitch, + 'ft-flex-box': FtFlexBox + }, + data: function () { + return {} + }, + computed: { + isDev: function () { + return process.env.NODE_ENV === 'development' + }, + + externalPlayerNames: function () { + return this.$store.getters.getExternalPlayerNames + }, + externalPlayerValues: function () { + return this.$store.getters.getExternalPlayerValues + }, + externalPlayer: function () { + return this.$store.getters.getExternalPlayer + }, + externalPlayerExecutable: function () { + return this.$store.getters.getExternalPlayerExecutable + }, + externalPlayerIgnoreWarnings: function () { + return this.$store.getters.getExternalPlayerIgnoreWarnings + }, + externalPlayerCustomArgs: function () { + return this.$store.getters.getExternalPlayerCustomArgs + } + }, + methods: { + ...mapActions([ + 'updateExternalPlayer', + 'updateExternalPlayerExecutable', + 'updateExternalPlayerIgnoreWarnings', + 'updateExternalPlayerCustomArgs' + ]) + } +}) diff --git a/src/renderer/components/external-player-settings/external-player-settings.sass b/src/renderer/components/external-player-settings/external-player-settings.sass new file mode 100644 index 00000000..05cb0dfb --- /dev/null +++ b/src/renderer/components/external-player-settings/external-player-settings.sass @@ -0,0 +1 @@ +@use "../../sass-partials/settings" diff --git a/src/renderer/components/external-player-settings/external-player-settings.vue b/src/renderer/components/external-player-settings/external-player-settings.vue new file mode 100644 index 00000000..8a945fea --- /dev/null +++ b/src/renderer/components/external-player-settings/external-player-settings.vue @@ -0,0 +1,56 @@ + + +