This commit is contained in:
Ulysse Gressé-Lugué 2024-05-08 11:59:20 +02:00 committed by GitHub
commit d5011b0b90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 4795 additions and 4734 deletions

View File

@ -1360,6 +1360,11 @@ body, button {
border-radius: 50px;
border: 1px solid rgba(126, 126, 126, 0.57);
}
input:disabled + .toggleSwitchSlider {
background-color: rgb(77, 77, 77);
/* box-shadow: inset 2px 1px 20px black; */
border: 1px solid rgb(30, 31, 30)
}
.toggleSwitchSlider:before {
position: absolute;
content: "";
@ -1372,6 +1377,11 @@ body, button {
border-radius: 50px;
transition: .4s;
}
input:checked:disabled + .toggleSwitchSlider {
background-color: rgb(74, 95, 71);
/* box-shadow: inset 2px 1px 20px black; */
border: 1px solid rgb(74, 83, 72)
}
input:checked + .toggleSwitchSlider {
background-color: rgb(31, 140, 11);
/* box-shadow: inset 2px 1px 20px black; */

View File

@ -81,6 +81,7 @@ const DEFAULT_CONFIG = {
resWidth: 1280,
resHeight: 720,
fullscreen: false,
CloseOnLaunch: false,
autoConnect: true,
launchDetached: true
},
@ -733,6 +734,25 @@ exports.setFullscreen = function(fullscreen){
config.settings.game.fullscreen = fullscreen
}
/**
* Check if the launcher should be closed when the game launch.
*
* @param {boolean} def Optional. If true, the default value will be returned.
* @returns {boolean} Whether or not the launcher should be closed when the game launched.
*/
exports.getCloseOnLaunch = function(def = false){
return !def ? config.settings.game.CloseOnLaunch : DEFAULT_CONFIG.settings.game.CloseOnLaunch
}
/**
* Change the status if the launcher should be closed when the game launch.
*
* @param {boolean} CloseOnLaunch Whether or not the launcher should be closed when the game launched.
*/
exports.setCloseOnLaunch = function(CloseOnLaunch){
config.settings.game.CloseOnLaunch = CloseOnLaunch
}
/**
* Check if the game should auto connect to servers.
*

View File

@ -7,6 +7,8 @@ const { getMojangOS, isLibraryCompatible, mcVersionAtLeast } = require('helios-
const { Type } = require('helios-distribution-types')
const os = require('os')
const path = require('path')
const remote = require('@electron/remote');
const win = remote.getCurrentWindow();
const ConfigManager = require('./configmanager')
@ -82,6 +84,10 @@ class ProcessBuilder {
child.unref()
}
if(ConfigManager.getCloseOnLaunch()){
win.close();
}
child.stdout.setEncoding('utf8')
child.stderr.setEncoding('utf8')

View File

@ -89,6 +89,19 @@ bindFileSelectors()
* will be disabled until the value is corrected. This is an automated
* process. More complex UI may need to be bound separately.
*/
closeOnLaunchCheckbox = document.querySelector('input[cValue="CloseOnLaunch"]')
launchDetachedCheckbox = document.querySelector('input[cValue="LaunchDetached"]')
closeOnLaunchCheckbox.addEventListener('change', function() {
if (this.checked) {
launchDetachedCheckbox.disabled = true
launchDetachedCheckbox.checked = true
} else {
launchDetachedCheckbox.disabled = false
}
})
function initSettingsValidators(){
const sEls = document.getElementById('settingsContainer').querySelectorAll('[cValue]')
Array.from(sEls).map((v, index, arr) => {

View File

@ -49,6 +49,7 @@ accountSelectConfirm = "Select"
accountSelectCancel = "Cancel"
[ejs.settings]
closeLauncherOnLaunch = "Close the launcher when the game is launched."
navHeaderText = "Settings"
navAccount = "Account"
navMinecraft = "Minecraft"

View File

@ -93,6 +93,17 @@
</label>
</div>
</div>
<div class="settingsFieldContainer">
<div class="settingsFieldLeft">
<span class="settingsFieldTitle"><%- lang('settings.closeLauncherOnLaunch') %></span>
</div>
<div class="settingsFieldRight">
<label class="toggleSwitch">
<input type="checkbox" cValue="CloseOnLaunch">
<span class="toggleSwitchSlider"></span>
</label>
</div>
</div>
<div class="settingsFieldContainer">
<div class="settingsFieldLeft">
<span class="settingsFieldTitle"><%- lang('settings.autoConnectTitle') %></span>