Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Linux launch support v2 #229

Merged
merged 18 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added src/app/icons/linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions src/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,53 @@ <h2>%%gui.settings.title.ns%%</h2>
</div>
</div>
</details>
<details open platform="linux">
<summary>
<div class="title">
<img src="icons/linux.png">
<h2>%%gui.settings.title.linux%%</h2>
</div>
</summary>
<div class="option" name="linux_launch_method">
<div class="text">
%%gui.settings.linux_launch_method.title%%
<div class="desc">
%%gui.settings.linux_launch_method.desc%%
</div>
</div>
<div class="actions">
<select>
<option value="steam_auto">%%gui.settings.linux_launch_method.methods.steam_auto%%</option>
<option value="steam_executable">%%gui.settings.linux_launch_method.methods.steam_executable%%</option>
<option value="steam_flatpak">%%gui.settings.linux_launch_method.methods.steam_flatpak%%</option>
<option value="steam_protocol">%%gui.settings.linux_launch_method.methods.steam_protocol%%</option>
<option value="custom_command">%%gui.settings.linux_launch_method.methods.command%%</option>
</select>
</div>
</div>
<div class="option" name="linux_launch_cmd_ns">
<div class="text">
%%gui.settings.linux_launch_cmd_ns.title%%
<div class="desc">
%%gui.settings.linux_launch_cmd_ns.desc%%
</div>
</div>
<div class="actions">
<input>
</div>
</div>
<div class="option" name="linux_launch_cmd_vanilla">
<div class="text">
%%gui.settings.linux_launch_cmd_vanilla.title%%
<div class="desc">
%%gui.settings.linux_launch_cmd_vanilla.desc%%
</div>
</div>
<div class="actions">
<input>
</div>
</div>
</details>

<details open>
<summary>
Expand Down
37 changes: 36 additions & 1 deletion src/app/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ ipcRenderer.on("changed-settings", (e, new_settings) => {
})

let settings = {
default: {...settings_data},

data: () => {return settings_data},

// asks the main process to reset the config/settings file
Expand Down Expand Up @@ -138,7 +140,7 @@ settings.popup.toggle = (state) => {
}

settings.popup.apply = () => {
settings = {...settings, ...settings.popup.get()};
settings.set(settings.popup.get());
ipcRenderer.send("save-settings", settings.popup.get());
}

Expand Down Expand Up @@ -174,11 +176,25 @@ settings.popup.load = () => {
let categories = document.querySelectorAll("#options details");
for (let i = 0; i < categories.length; i++) {
categories[i].setAttribute("open", true);

// hide categories that aren't for the current platform
let for_platform = categories[i].getAttribute("platform");
if (for_platform && process.platform != for_platform) {
categories[i].style.display = "none";
categories[i].setAttribute("perma-hidden", true);
}
}

let options = document.querySelectorAll(".option");

for (let i = 0; i < options.length; i++) {
// hide options that aren't for the current platform
let for_platform = options[i].getAttribute("platform");
if (for_platform && process.platform != for_platform) {
options[i].style.display = "none";
options[i].setAttribute("perma-hidden", true);
}

let optName = options[i].getAttribute("name");
if (optName == "forcedlang") {
let div = options[i].querySelector("select");
Expand Down Expand Up @@ -207,6 +223,25 @@ settings.popup.load = () => {
}

if (settings_data[optName] != undefined) {
// check if setting has a `<select>`
let select_el = options[i].querySelector(".actions select");
if (select_el) {
// get `<option>` for settings value, if it exists
let option = select_el.querySelector(
`option[value="${settings_data[optName]}"]`
)

// check if it exists
if (option) {
// set the `<select>` to the settings value
select_el.value = settings_data[optName];
} else { // use the default value
select_el.value = settings.default[optName];
}

continue;
}

switch(typeof settings_data[optName]) {
case "string":
options[i].querySelector(".actions input").value = settings_data[optName];
Expand Down
4 changes: 4 additions & 0 deletions src/app/js/toasts.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,8 @@ toasts.dismiss = (id) => {
}
}

ipcRenderer.on("toast", (_, properties) => {
Toast(properties);
})

module.exports = toasts;
30 changes: 30 additions & 0 deletions src/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,25 @@
"desc": "Wenn \"Automatische Spracherkennung\" deaktiviert ist, wird diese Option genutzt um die Sprachen zu ändern. Oft ist ein Neustart nötig!",
"title": "Sprache"
},
"linux_launch_cmd_ns": {
"desc": "Dieser Befehl wird zum starten von Northstar ausgeführt wenn die Startmethode \"Eigener Befehl\" ausgewählt ist. Startvariabeln werden am ende des Befehl angehangen und als Environmentvariable $TF_ARGS mitgegeben.",
"title": "Northstar Startbefehl"
},
"linux_launch_cmd_vanilla": {
"desc": "Dieser Befehl wird zum starten von Vanilla ausgeführt wenn die Startmethode \"Eigener Befehl\" ausgewählt ist. Startvariabeln werden am ende des Befehls angehangen und als Environmentvariable $TF_ARGS mitgegeben.",
"title": "Vanilla Startbefehl"
},
"linux_launch_method": {
"desc": "Die Methode welche zum start des Spieles auf Linux genutzt wird.",
"methods": {
"command": "Eigener Befehl",
"steam_auto": "Steam (Automatisch)",
"steam_executable": "Steam (Ausführungsdatei)",
"steam_flatpak": "Steam (Flatpak)",
"steam_protocol": "Steam (Protokoll)"
},
"title": "Linux Startmethode"
},
"miscbuttons": {
"buttons": {
"change_gamepath": "Spielepfad ändern",
Expand Down Expand Up @@ -179,6 +198,7 @@
"save": "Speichern",
"title": {
"language": "Sprache",
"linux": "Linux",
"misc": "Sonstiges",
"ns": "Northstar",
"updates": "Updates"
Expand All @@ -197,16 +217,26 @@
"desc": {
"duped": "hat mehrere Ordner in sich mit dem selben Namen, wodurch ein duplizierter Ordner ensteht! Falls du der Entwickler bist solltest du dies beheben!",
"failed": "Ein unbekannter Fehler ist aufgetaucht beim Installieren, die Schuld kann beim Autor liegen oder bei Viper selbst!",
"failed_launch_command": "Es gab einen Fehler beim ausführen vom Startbefehl.",
"installed": "wurde installiert!",
"malformed": "hat eine fehlerhafte Ordnerstruktur, falls du der Entwickler bist, solltest du dies beheben.",
"missing_flatpak": "Konnte nicht mit Flatpak starten, da keine Instanz gefunden wurde.",
"missing_flatpak_steam": "Konnte nicht mit der Flatpak version von Steam starten, da keine Instanz gefunden wurde.",
"missing_launch_command": "Es wurde kein Startbefehl angegeben, bitte setze einen fest.",
"missing_steam": "Kann nicht direkt über Steam starten, da keine Instanz gefunden wurde.",
"no_internet": "Viper funktioniert möglicherweise nicht korrekt",
"unknown_error": "Ein unbekannter Fehler ist aufgetreten für mehr details drücken! Es wird empfohlen einen Screenshot von der detalierten Fehlernachricht zu machen wenn ein Bug-Report erstellt wird!"
},
"title": {
"duped": "Duplizierter Ordner name!",
"failed": "Fehler beim Installieren des Mods!",
"failed_launch_command": "Ausführungsfehler vom Startbefehl!",
"installed": "Mod installiert!",
"malformed": "Fehlerhafte Ordnerstruktur!",
"missing_flatpak": "Flatpak fehlt!",
"missing_flatpak_steam": "Flatpak Steam fehlt!",
"missing_launch_command": "Fehlender Startbefehl!",
"missing_steam": "Steam fehlt!",
"no_internet": "Kein Internet",
"unknown_error": "Unbekannter Fehler!"
}
Expand Down
35 changes: 33 additions & 2 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@

"title": {
"ns": "Northstar",
"linux": "Linux",
"language": "Language",
"updates": "Updates",
"misc": "Miscellaneous"
Expand Down Expand Up @@ -198,6 +199,26 @@

"open_gamepath_alert": "No valid gamepath is selected, so there's no gamepath to open, please select a valid gamepath first!",
"reset_config_alert": "Please confirm that you want to reset the config file, after confirming Viper will delete the config file, and then restart."
},

"linux_launch_method": {
"title": "Linux launch method",
"desc": "The method to use when launching the game on Linux",
"methods": {
"steam_auto": "Steam (Auto)",
"steam_executable": "Steam (Executable)",
"steam_flatpak": "Steam (Flatpak)",
"steam_protocol": "Steam (Protocol)",
"command": "Custom command"
}
},
"linux_launch_cmd_ns": {
"title": "Northstar launch command",
"desc": "This is the command that will be used when you use \"Custom command\" as the launch method and you're launching Northstar, launch options are appended at the end of the command and in an environment variable named $TF_ARGS"
},
"linux_launch_cmd_vanilla": {
"title": "Vanilla launch command",
"desc": "This is the command that will be used when you use \"Custom command\" as the launch method and you're launching the vanilla game, launch options are appended at the end of the command and in an environment variable named $TF_ARGS"
}
},

Expand Down Expand Up @@ -234,7 +255,12 @@
"failed": "Failed to install",
"malformed": "Incorrect folder structure!",
"unknown_error": "Unknown Error!",
"no_internet": "No Internet"
"no_internet": "No Internet",
"failed_launch_command": "Failed running launch command",
"missing_launch_command": "Missing launch command",
"missing_steam": "Missing Steam",
"missing_flatpak": "Missing Flatpak",
"missing_flatpak_steam": "Missing Flatpak Steam"
},

"desc": {
Expand All @@ -243,7 +269,12 @@
"failed": "An unknown error occurred while trying to install the mod. This may be the author's fault, and it may also be Viper's fault.",
"duped": "has multiple mod folders in it, with the same name, causing duplicate folders, if you're the developer, you should fix this.",
"unknown_error": "An unknown error occurred, click for more details. You may want to take a screenshot of the detailed error when filing a bug report.",
"no_internet": "Viper may not work properly."
"no_internet": "Viper may not work properly.",
"failed_launch_command": "Something went wrong whilst running the custom launch command",
"missing_launch_command": "There's currently no custom launch command set, one has to be configured to launch",
"missing_steam": "Can't launch with Steam directly, as it doesn't seem to be installed",
"missing_flatpak": "Can't launch with Flatpak, as it doesn't seem to be installed",
"missing_flatpak_steam": "Can't launch with the Flatpak version of Steam, as it doesn't seem to be installed"
}
}
},
Expand Down
24 changes: 23 additions & 1 deletion src/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,25 @@
"desc": "Cuando \"Detectar automáticamente el idioma\" está deshabilitado, ésta opción decidirá el lenguaje. Se necesita reiniciar para que surja efecto.",
"title": "Idioma"
},
"linux_launch_cmd_ns": {
"desc": "Este es el comando que será usado cuando seleccione \"Comando personalizado\" como el método de ejecución al lanzar Northstar. Las opciones de ejecución seran añadidas al final de dicho comando y en una variable de entorno llamada $TF_ARGS",
"title": "Comando de lanzamiento para Northstar"
},
"linux_launch_cmd_vanilla": {
"desc": "Este es el comando que será usado cuando seleccione \"Comando personalizado\" como el método de ejecución al lanzar la versión \"Vanilla\" del juego. Las opciones de ejecución seran añadidas al final de dicho comando y en una variable de entorno llamada $TF_ARGS",
"title": "Comando de ejecución para \"Vanilla\""
},
"linux_launch_method": {
"desc": "El método a usarse cuando ejecute el juego en Linux",
"methods": {
"command": "Comando personalizado",
"steam_auto": "Steam (Automático)",
"steam_executable": "Steam (Ejecutable)",
"steam_flatpak": "Steam (Flatpak)",
"steam_protocol": "Steam (Protocolo)"
},
"title": "Modo de ejecución en Linux"
},
"miscbuttons": {
"buttons": {
"change_gamepath": "Cambiar ruta del juego",
Expand Down Expand Up @@ -179,6 +198,7 @@
"save": "Guardar",
"title": {
"language": "Idioma",
"linux": "Linux",
"misc": "Misceláneos",
"ns": "Northstar",
"updates": "Actualizaciones"
Expand All @@ -205,8 +225,10 @@
"title": {
"duped": "tiene varias carpetas de la modificación con el mismo nombre, lo que genera carpetas duplicadas. Si eres el desarrollador, deberías arreglar esto.",
"failed": "¡Falló al instalar!",
"failed_launch_command": "Error al ejecutar el comando de lanzamiento",
"installed": "¡Modificación instalada!",
"malformed": "¡Estructura de las carpetas incorrecta!",
"missing_launch_command": "El comando de lanzamiento no fue asignado o no se encuentra",
"no_internet": "Sin Internet",
"unknown_error": "¡Error desconocido!"
}
Expand Down Expand Up @@ -264,4 +286,4 @@
"release": "Notas de la versión"
}
}
}
}
30 changes: 30 additions & 0 deletions src/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,25 @@
"desc": "Lorsque \"Auto-détection de la langue\" est désactivée, cette option permet de sélectionner la langue (requiert un redémarrage).",
"title": "Langue"
},
"linux_launch_cmd_ns": {
"desc": "Commande qui sera utilisée lorsque vous sélectionnez \"Commande personnalisée\" comme méthode de lancement de Northstar ; les arguments de démarrage sont ajoutés à la fin de cette commande et dans une variable d'environnement nommée $TF_ARGS",
"title": "Commande de lancement de Northstar"
},
"linux_launch_cmd_vanilla": {
"desc": "Commande qui sera utilisée lorsque vous sélectionnez \"Commande personnalisée\" comme méthode de lancement vanilla ; les arguments de démarrage sont ajoutés à la fin de cette commande et dans une variable d'environnement nommée $TF_ARGS",
"title": "Commande de lancement vanilla"
},
"linux_launch_method": {
"desc": "La façon de lancer le jeu sur Linux",
"methods": {
"command": "Commande personnalisée",
"steam_auto": "Steam (auto)",
"steam_executable": "Steam (exécutable)",
"steam_flatpak": "Steam (Flatpak)",
"steam_protocol": "Steam (protocole)"
},
"title": "Méthode de lancement sur Linux"
},
"miscbuttons": {
"buttons": {
"change_gamepath": "Changer le dossier du jeu",
Expand Down Expand Up @@ -179,6 +198,7 @@
"save": "Sauvegarder",
"title": {
"language": "Langue",
"linux": "Linux",
"misc": "Divers",
"ns": "Northstar",
"updates": "Mises à jour"
Expand All @@ -197,16 +217,26 @@
"desc": {
"duped": "contient plusieurs dossiers ayant le même nom ; si vous êtes le développer, vous devriez réparer ceci.",
"failed": "Une erreur inconnue est survenue lors de l'installation du mod. Cela peut être du ressort de l'auteur du mod ou de Viper.",
"failed_launch_command": "Quelque chose s'est mal passé lors de l'exécution de la commande",
"installed": "a été installé avec succès !",
"malformed": "a une structure de dossier incorrecte ; si vous êtes son développeur, vous devriez réparer ça.",
"missing_flatpak": "Lancement via Flatpak impossible (ne semble pas être installé)",
"missing_flatpak_steam": "Lancement via Flatpak Steam impossible (ne semble pas être installé)",
"missing_launch_command": "Il n'y a actuellement pas d'argument de lancement configuré, il en faut au moins un pour lancer le jeu",
"missing_steam": "Lancement via Steam impossible (ne semble pas être installé)",
"no_internet": "Viper ne fonctionnera pas correctement tant que la connexion n'est pas rétablie.",
"unknown_error": "Une erreur inconnue est survenue, cliquez pour plus de détails. Vous devriez prendre une capture d'écran de l'erreur si vous comptez créer un ticket."
},
"title": {
"duped": "Nom de dossier dupliqué !",
"failed": "L'installation a échoué",
"failed_launch_command": "Echec du lancement de la commande",
"installed": "Mod installé !",
"malformed": "La structure du dossier du mod est incorrecte.",
"missing_flatpak": "Flatpak manquant",
"missing_flatpak_steam": "Flatpak Steam manquant",
"missing_launch_command": "Commande de lancement manquante",
"missing_steam": "Steam manquant",
"no_internet": "Pas de connexion Internet",
"unknown_error": "Erreur inconnue"
}
Expand Down
Loading
Loading