Skip to content

Commit 2e4f765

Browse files
committed
fix #53
1 parent b82750a commit 2e4f765

File tree

7 files changed

+27
-35
lines changed

7 files changed

+27
-35
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ org.gradle.parallel=false
77
#org.gradle.configureondemand=true
88

99
# Mod properties
10-
mod.version=1.0.8
10+
mod.version=1.0.9
1111
mod.group=net.notcoded
1212
mod.id=wayfix
1313
mod.name=WayFix

src/main/java/net/notcoded/wayfix/config/ModClothConfig.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ public static Screen buildScreen(Screen parent) {
5050
.setSaveConsumer(value -> config.injectIcon = value)
5151
.build());
5252

53+
category.addEntry(entryBuilder.startBooleanToggle(getText("useAlternativeIconPath"), config.useAlternativeIconPath)
54+
.setDefaultValue(false)
55+
.setTooltip(getText("useAlternativeIconPath.tooltip"), getText("useAlternativeIconPath.tooltip2"))
56+
.requireRestart()
57+
.setSaveConsumer(value -> config.useAlternativeIconPath = value)
58+
.build());
59+
5360
category.addEntry(entryBuilder.startBooleanToggle(getText("keyModifiersFix"), config.keyModifiersFix)
5461
.setDefaultValue(true)
5562
.setTooltip(getText("keyModifiersFix.tooltip"))

src/main/java/net/notcoded/wayfix/config/ModConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ public class ModConfig {
1010
@Comment("Injects the Minecraft Icon at Startup instead of defaulting to the normal Wayland icon.")
1111
public boolean injectIcon = true;
1212

13+
@Comment("[!] Recommended if on GNOME 48 or are having issues.\nInjects the icons at ~/.icons instead of ~/.local/share/icons")
14+
public boolean useAlternativeIconPath = false;
15+
1316
@Comment("Fixes issues where keyboard combinations like 'CTRL + A' or 'CTRL + C' are sent as characters in chat instead of being recognized as key combinations.")
1417
public boolean keyModifiersFix = true;
1518

src/main/java/net/notcoded/wayfix/mixin/MonitorMixin.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/main/java/net/notcoded/wayfix/util/DesktopFileInjector.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,17 @@ private static void injectFile(Path target, byte[] data) {
114114

115115

116116
private static Path getIconFileLocation(int width, int height) {
117-
return XDGPathResolver.getUserDataLocation().resolve("icons/hicolor").resolve(width + "x" + height)
118-
.resolve("apps").resolve(ICON_NAME);
117+
Path path;
118+
if(WayFix.config.useAlternativeIconPath && XDGPathResolver.getHome() != null) {
119+
path = XDGPathResolver.getHome().resolve(".icons");
120+
} else {
121+
path = XDGPathResolver.getUserDataLocation().resolve("icons");
122+
}
123+
124+
return path.resolve("hicolor")
125+
.resolve(width + "x" + height)
126+
.resolve("apps")
127+
.resolve(ICON_NAME);
119128
}
120129

121130
private static Path getDesktopFileLocation() {

src/main/java/net/notcoded/wayfix/util/XDGPathResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
public class XDGPathResolver {
1212

13-
private static Path getHome(){
13+
public static Path getHome(){
1414
String home = System.getenv().getOrDefault("HOME", System.getProperty("user.home"));
1515
if (home == null || home.isEmpty()) {
1616
//throw new IllegalStateException("could not resolve user home");

src/main/resources/assets/wayfix/lang/en_us.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
"wayfix.option.injectIcon": "Inject Minecraft Icon at Startup",
1010
"wayfix.option.injectIcon.tooltip": "Injects the Minecraft Icon at Startup instead of defaulting to the normal Wayland icon.",
1111

12+
"wayfix.option.useAlternativeIconPath": "Use Alternative Icon Path",
13+
"wayfix.option.useAlternativeIconPath.tooltip": "Recommended if on GNOME 48 or are having issues.",
14+
"wayfix.option.useAlternativeIconPath.tooltip2": "Injects the icons at ~/.icons instead of ~/.local/share/icons",
15+
1216
"wayfix.option.keyModifiersFix": "Key Modifiers Fix",
1317
"wayfix.option.keyModifiersFix.tooltip": "Fixes issues where keyboard combinations like 'CTRL + A' or 'CTRL + C' are sent as characters in chat instead of being recognized as key combinations.",
1418

0 commit comments

Comments
 (0)