Skip to content

Commit

Permalink
Allow Setting Window Icon on KWin
Browse files Browse the repository at this point in the history
  • Loading branch information
thr3343 committed Jan 12, 2024
1 parent c66351e commit 928807b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/java/net/vulkanmod/config/VideoResolution.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ private static String getStringFromPlat(int plat) {
public static boolean isAndroid() { return activePlat == GLFW_ANY_PLATFORM; }

//Desktop Environment Names: https://wiki.archlinux.org/title/Environment_variables_#Examples
public static boolean isGNOME(){return activeDE.contains("gnome") || activeDE.contains("GNOME");}
public static boolean isGnome(){return activeDE.contains("gnome");}
public static boolean isKWin(){return activeDE.contains("kde");}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class MinecraftMixin {
*/
@Redirect(method="<init>", at=@At(value="INVOKE", target="Lcom/mojang/blaze3d/platform/Window;setIcon(Lnet/minecraft/server/packs/PackResources;Lcom/mojang/blaze3d/platform/IconSet;)V"))
private void bypassWaylandIcon(Window instance, PackResources packResources, IconSet iconSet) throws IOException {
if(!VideoResolution.isWayLand())
if(VideoResolution.isKWin() || !VideoResolution.isWayLand())
{
this.window.setIcon(this.vanillaPackResources, SharedConstants.getCurrentVersion().isStable() ? IconSet.RELEASE : IconSet.SNAPSHOT);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/vulkanmod/mixin/window/WindowMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private GLCapabilities redirect2() {
private void vulkanHint(WindowEventHandler windowEventHandler, ScreenManager screenManager, DisplayData displayData, String string, String string2, CallbackInfo ci) {
GLFW.glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
//Fix Gnome Client-Side Decorators
GLFW.glfwWindowHint(GLFW_DECORATED, VideoResolution.isGNOME() && VideoResolution.isWayLand() ? GLFW_FALSE : GLFW_TRUE);
GLFW.glfwWindowHint(GLFW_DECORATED, VideoResolution.isGnome() && VideoResolution.isWayLand() ? GLFW_FALSE : GLFW_TRUE);
// GLFW.glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);
// GLFW.glfwWindowHint(GLFW_FOCUSED, GLFW_FALSE);
}
Expand Down

0 comments on commit 928807b

Please sign in to comment.