Implement Open Tab on Launch feature

This commit is contained in:
Amaru8 2022-04-28 23:50:08 +02:00
parent 1f06a6a89f
commit 591c80205b
3 changed files with 39 additions and 2 deletions

View file

@ -45,6 +45,10 @@ export class Store {
"enabled": false, "enabled": false,
"hidden": false, "hidden": false,
}, },
"resumeWindow": {
"tab": "home",
"dynamicData": ""
},
"keybind": { "keybind": {
"search": [ "search": [
process.platform == "darwin" ? "Command" : "Control", process.platform == "darwin" ? "Command" : "Control",

View file

@ -480,6 +480,13 @@ const app = new Vue({
app.modals[key] = false; app.modals[key] = false;
} }
}, },
restoreTabs() {
if (app.cfg.general.resumeWindow.tab == "dynamic") {
this.appRoute(app.cfg.general.resumeWindow.dynamicData)
} else {
this.appRoute(app.cfg.general.resumeWindow.tab)
}
},
promptAddToPlaylist() { promptAddToPlaylist() {
app.modals.addToPlaylist = true; app.modals.addToPlaylist = true;
}, },
@ -894,10 +901,9 @@ const app = new Vue({
document.body.removeAttribute("loading") document.body.removeAttribute("loading")
if (window.location.hash != "") { if (window.location.hash != "") {
this.appRoute(window.location.hash) this.appRoute(window.location.hash)
} else {
this.page = "home"
} }
this.restoreTabs()
this.mediaKeyFixes() this.mediaKeyFixes()
setTimeout(() => { setTimeout(() => {
@ -1566,6 +1572,13 @@ const app = new Vue({
return; return;
} }
route = route.replace(/#/g, "") route = route.replace(/#/g, "")
if (app.cfg.general.resumeWindow.tab == "dynamic") {
if (route == "home" || route == "library-songs" || route == "library-albums" || route == "library-artists" || route == "library-videos" || route == "podcasts") {
app.cfg.general.resumeWindow.dynamicData = route
} else {
app.cfg.general.resumeWindow.dynamicData = "home"
}
}
// if the route contains does not include a / then route to the page directly // if the route contains does not include a / then route to the page directly
if (route.indexOf("/") == -1) { if (route.indexOf("/") == -1) {
this.page = route this.page = route

View file

@ -61,6 +61,26 @@
</select> </select>
</div> </div>
</div> </div>
<div class="md-option-line">
<div class="md-option-segment">
Open Tab on Launch<br>
<small>
({{$root.getLz('settings.option.visual.hardwareAcceleration.description')}})
</small>
</div>
<div class="md-option-segment md-option-segment_auto">
<select class="md-select" style="width:180px;" v-model="$root.cfg.general.resumeWindow.tab">
<option value="home">{{$root.getLz('home.title')}}</option>
<option value="library-recentlyadded">{{$root.getLz('term.recentlyAdded')}}</option>
<option value="library-songs">{{$root.getLz('term.songs')}}</option>
<option value="library-albums">{{$root.getLz('term.albums')}}</option>
<option value="library-artists">{{$root.getLz('term.artists')}}</option>
<option value="library-videos">{{$root.getLz('term.videos')}}</option>
<option value="podcasts">{{$root.getLz('term.podcasts')}}</option>
<option value="dynamic">Dynamic</option>
</select>
</div>
</div>
<div class="md-option-line"> <div class="md-option-line">
<div class="md-option-segment"> <div class="md-option-segment">
{{$root.getLz('settings.option.general.customizeSidebar')}} {{$root.getLz('settings.option.general.customizeSidebar')}}