Skip to content

Commit 4016b79

Browse files
Ap4uukmicrowin7
authored andcommitted
[FIX] Preserve user-disabled state for mark:true optionals after restart
1 parent 945fd5a commit 4016b79

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

components/launcher-api/src/main/java/pro/gravit/launcher/base/profiles/optional/OptionalView.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ public class OptionalView {
1818

1919
public OptionalView(ClientProfile profile) {
2020
this.all = profile.getOptional();
21-
for (OptionalFile f : this.all) {
22-
if (f.mark) enable(f, true, null);
23-
}
2421
}
2522

2623
public OptionalView(OptionalView view) {
@@ -39,8 +36,6 @@ public OptionalView(ClientProfile profile, OptionalView old) {
3936
}
4037
if(old.isEnabled(oldFile)) {
4138
enable(newFile, old.installInfo.get(oldFile).isManual, (file, status) -> {});
42-
} else {
43-
disable(newFile, (file, status) -> {});
4439
}
4540
}
4641
fixDependencies();

components/launcher-runtime/src/main/java/pro/gravit/launcher/runtime/backend/ProfileSettingsImpl.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public ProfileSettingsImpl(ClientProfile profile, LauncherBackendImpl backend) {
5050
if(JVMHelper.OS_TYPE == JVMHelper.OS.LINUX && System.getenv("WAYLAND_DISPLAY") != null) {
5151
this.flags.add(Flag.LINUX_WAYLAND_SUPPORT);
5252
}
53-
processTriggers(profile, this.view);
53+
processTriggers(profile, this.view, true);
5454
}
5555

5656
@Override
@@ -206,7 +206,7 @@ public void initAfterGson(ClientProfile profile, LauncherBackendImpl backend) {
206206
this.backend = backend;
207207
this.profile = profile;
208208
this.view = new OptionalView(profile);
209-
processTriggers(profile, this.view);
209+
processTriggers(profile, this.view, false);
210210
for(var e : enabled) {
211211
var opt = profile.getOptionalFile(e);
212212
if(opt == null) {
@@ -234,7 +234,7 @@ public void initAfterGson(ClientProfile profile, LauncherBackendImpl backend) {
234234

235235

236236

237-
public void processTriggers(ClientProfile profile, OptionalView view) {
237+
public void processTriggers(ClientProfile profile, OptionalView view, boolean applyEnabledByDefault) {
238238
TriggerManagerContext context = new TriggerManagerContext(profile);
239239
for (OptionalFile optional : view.all) {
240240
if (optional.limited) {
@@ -247,6 +247,10 @@ public void processTriggers(ClientProfile profile, OptionalView view) {
247247
optional.visible = true;
248248
}
249249
}
250+
// Apply mark-based defaults only for freshly created profile settings.
251+
if (applyEnabledByDefault && optional.visible && optional.mark) {
252+
view.enable(optional, false, null);
253+
}
250254
if (optional.triggersList == null) continue;
251255
boolean isRequired = false;
252256
int success = 0;

0 commit comments

Comments
 (0)