remove unused standalone jar files
This commit is contained in:
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.distanthorizons.core.jar;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* A fork of iris' dark mode detector (https://github.com/IrisShaders/Iris-Installer/blob/master/src/main/java/net/hypercubemc/iris_installer/DarkModeDetector.java)
|
||||
* Which is a fork of HanSolo's dark mode detector (https://gist.github.com/HanSolo/7cf10b86efff8ca2845bf5ec2dd0fe1d)
|
||||
*
|
||||
* This fork has better support for Linux
|
||||
*
|
||||
* @author HanSolo
|
||||
* @author IMS
|
||||
* @author coolGi
|
||||
*/
|
||||
public class DarkModeDetector
|
||||
{
|
||||
private static final String REGQUERY_UTIL = "reg query ";
|
||||
private static final String REGDWORD_TOKEN = "REG_DWORD";
|
||||
private static final String DARK_THEME_CMD = REGQUERY_UTIL + "\"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize\"" + " /v AppsUseLightTheme";
|
||||
|
||||
public static boolean isDarkMode()
|
||||
{
|
||||
switch (EPlatform.get())
|
||||
{
|
||||
case WINDOWS:
|
||||
return isWindowsDarkMode();
|
||||
case MACOS:
|
||||
return isMacOsDarkMode();
|
||||
case LINUX:
|
||||
// Most Unix(-like) distros also use a lot of the same things as Linux (like desktop environments and window managers)
|
||||
case BSD:
|
||||
case UNIX:
|
||||
return checkLinuxDark();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Needs checking as I dont use Mac
|
||||
public static boolean isMacOsDarkMode()
|
||||
{
|
||||
boolean isDarkMode = false;
|
||||
String line = query("defaults read -g AppleInterfaceStyle");
|
||||
if (line.equals("Dark"))
|
||||
{
|
||||
isDarkMode = true;
|
||||
}
|
||||
return isDarkMode;
|
||||
}
|
||||
|
||||
// Needs checking as I don't use Windows
|
||||
public static boolean isWindowsDarkMode()
|
||||
{
|
||||
try
|
||||
{
|
||||
String result = query(DARK_THEME_CMD);
|
||||
int p = result.indexOf(REGDWORD_TOKEN);
|
||||
|
||||
if (p == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 1 == Light Mode, 0 == Dark Mode
|
||||
String temp = result.substring(p + REGDWORD_TOKEN.length()).trim();
|
||||
return ((Integer.parseInt(temp.substring("0x".length()), 16))) == 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// On Linux there are 2 popular formats for theming
|
||||
// They are qt and gtk. We check the desktop environment and use that to pick which one to use (if none work then use GTK)
|
||||
public static boolean checkLinuxDark()
|
||||
{
|
||||
// Checks "/usr/bin" as "echo $XDG_CURRENT_DESKTOP" dosnt work in java and dosnt detect window managers
|
||||
File de_location = new File("/usr/bin");
|
||||
// System.out.println(de_location.list());
|
||||
for (String de : de_location.list())
|
||||
{
|
||||
// System.out.println(de);
|
||||
if (de.contains("gnome-session")) // Gnome uses GTK
|
||||
{
|
||||
return GTKChecker();
|
||||
}
|
||||
if (de.contains("plasma_session")) // KDE plasma uses QT
|
||||
{
|
||||
return QTChecker();
|
||||
}
|
||||
}
|
||||
return GTKChecker(); // GTK works best with non plasma desktops (desktops includes window managers)
|
||||
}
|
||||
|
||||
public static boolean GTKChecker()
|
||||
{
|
||||
// Checks if the return to "gsettings get org.gnome.desktop.interface color-scheme" in terminal is 'prefer-dark' or contains the word dark in it
|
||||
final Pattern darkThemeNamePattern = Pattern.compile(".*dark.*", Pattern.CASE_INSENSITIVE);
|
||||
return darkThemeNamePattern.matcher(query("gsettings get org.gnome.desktop.interface color-scheme")).matches();
|
||||
}
|
||||
|
||||
public static boolean QTChecker()
|
||||
{
|
||||
// Get the contents of "~/.config/Trolltech.conf" then check "KWinPalette\activeBackground"
|
||||
// With that you grayscale the rgb and check if it is over/under 128
|
||||
|
||||
// If there is a better way of doing this then please let me know
|
||||
// This seems like the best way as qt dosnt have a dark/light preference and just stores pure color values
|
||||
|
||||
try
|
||||
{
|
||||
File themeFile = new File(System.getProperty("user.home") + "/.config/Trolltech.conf");
|
||||
|
||||
BufferedReader reader = new BufferedReader(new FileReader(themeFile));
|
||||
String themeLine = reader.readLine();
|
||||
while (themeLine != null)
|
||||
{ // Go through each line till you find "KWinPalette\activeBackground"
|
||||
if (themeLine.contains("KWinPalette\\activeBackground"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
themeLine = reader.readLine();
|
||||
}
|
||||
reader.close();
|
||||
|
||||
// Get where the # is then read the hex numbers after it
|
||||
short index = (short) themeLine.indexOf("#");
|
||||
short r = (short) Integer.parseInt("" + themeLine.charAt(index + 1) + themeLine.charAt(index + 2), 16);
|
||||
short g = (short) Integer.parseInt("" + themeLine.charAt(index + 3) + themeLine.charAt(index + 4), 16);
|
||||
short b = (short) Integer.parseInt("" + themeLine.charAt(index + 5) + themeLine.charAt(index + 6), 16);
|
||||
if ((r + g + b) / 2 >= 128)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace(); return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Runs a command trough command line */
|
||||
private static String query(String cmd)
|
||||
{
|
||||
try
|
||||
{
|
||||
Process process = Runtime.getRuntime().exec(cmd);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())))
|
||||
{
|
||||
String actualReadLine;
|
||||
while ((actualReadLine = reader.readLine()) != null)
|
||||
{
|
||||
if (stringBuilder.length() != 0)
|
||||
{
|
||||
stringBuilder.append('\n');
|
||||
}
|
||||
stringBuilder.append(actualReadLine);
|
||||
}
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
System.out.println("Exception caught while querying the OS:");
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="700pt"
|
||||
height="700pt"
|
||||
version="1.1"
|
||||
viewBox="0 0 700 700"
|
||||
id="svg4"
|
||||
sodipodi:docname="themeDark.svg"
|
||||
inkscape:version="1.2 (dc2aedaf03, 2022-05-15)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs8" />
|
||||
<sodipodi:namedview
|
||||
id="namedview6"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="pt"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.79607143"
|
||||
inkscape:cx="466.66667"
|
||||
inkscape:cy="466.03858"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1351"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4" />
|
||||
<path
|
||||
d="m573.12 450.62c-1.5625-3.2305-4.0781-5.9023-7.207-7.6562-3.1289-1.7539-6.7227-2.5-10.293-2.1445-52.113 7.4141-105.18-3.3867-150.25-30.578-45.07-27.191-79.371-69.105-97.113-118.66-17.738-49.555-17.832-103.71-0.25781-153.33 12.207-34.535 32.625-65.586 59.5-90.477 3.8047-3.4023 5.9336-8.3008 5.8242-13.406-0.10938-5.1055-2.4414-9.9102-6.3867-13.152-3.9453-3.2422-9.1094-4.5977-14.137-3.7148-55.062 7.5039-106.35 32.211-146.54 70.594s-67.223 88.48-77.246 143.14c-10.023 54.656-2.5273 111.09 21.422 161.23 23.949 50.145 63.129 91.441 111.94 118 48.816 26.559 104.77 37.016 159.89 29.883 55.109-7.1328 106.56-31.492 147-69.602 2.6758-2.5234 4.4883-5.8281 5.1797-9.4414 0.69141-3.6133 0.22656-7.3516-1.3281-10.684z"
|
||||
id="path2"
|
||||
style="fill:#003380" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -1,76 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="700pt"
|
||||
height="700pt"
|
||||
version="1.1"
|
||||
viewBox="0 0 700 700"
|
||||
id="svg22"
|
||||
sodipodi:docname="themeLight.svg"
|
||||
inkscape:version="1.2 (dc2aedaf03, 2022-05-15)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs26" />
|
||||
<sodipodi:namedview
|
||||
id="namedview24"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="pt"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.79607143"
|
||||
inkscape:cx="466.66667"
|
||||
inkscape:cy="466.03858"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1351"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg22" />
|
||||
<g
|
||||
id="g20"
|
||||
style="fill:#55d400">
|
||||
<path
|
||||
d="m472.5 280c0 67.656-54.844 122.5-122.5 122.5s-122.5-54.844-122.5-122.5 54.844-122.5 122.5-122.5 122.5 54.844 122.5 122.5"
|
||||
id="path2"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m350 140c4.6406 0 9.0938-1.8438 12.375-5.125s5.125-7.7344 5.125-12.375v-87.5c0-6.2539-3.3359-12.031-8.75-15.156s-12.086-3.125-17.5 0-8.75 8.9023-8.75 15.156v87.5c0 4.6406 1.8438 9.0938 5.125 12.375s7.7344 5.125 12.375 5.125z"
|
||||
id="path4"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m226.27 180.95c3.1719 3.7031 7.7461 5.918 12.617 6.1055 4.875 0.1875 9.6016-1.6641 13.051-5.1133 3.4492-3.4492 5.3008-8.1758 5.1133-13.051-0.1875-4.8711-2.4023-9.4453-6.1055-12.617l-61.773-61.949c-4.4414-4.4375-10.91-6.1719-16.973-4.5469-6.0664 1.625-10.801 6.3594-12.426 12.426-1.625 6.0625 0.10938 12.531 4.5469 16.973z"
|
||||
id="path6"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m210 280c0-4.6406-1.8438-9.0938-5.125-12.375s-7.7344-5.125-12.375-5.125h-87.5c-6.2539 0-12.031 3.3359-15.156 8.75s-3.125 12.086 0 17.5 8.9023 8.75 15.156 8.75h87.5c4.6406 0 9.0938-1.8438 12.375-5.125s5.125-7.7344 5.125-12.375z"
|
||||
id="path8"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m226.27 379.05-61.949 61.773c-3.7031 3.1719-5.9141 7.7461-6.1016 12.617-0.19141 4.8711 1.6641 9.6016 5.1094 13.051 3.4492 3.4453 8.1797 5.3008 13.051 5.1133 4.8711-0.19141 9.4453-2.4023 12.617-6.1055l61.949-61.949c3.8594-4.5078 5.1719-10.66 3.4922-16.348-1.6836-5.6875-6.1328-10.137-11.82-11.816-5.6875-1.6836-11.84-0.37109-16.348 3.4883z"
|
||||
id="path10"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m350 420c-4.6406 0-9.0938 1.8438-12.375 5.125s-5.125 7.7344-5.125 12.375v87.5c0 6.2539 3.3359 12.031 8.75 15.156s12.086 3.125 17.5 0 8.75-8.9023 8.75-15.156v-87.5c0-4.6406-1.8438-9.0938-5.125-12.375s-7.7344-5.125-12.375-5.125z"
|
||||
id="path12"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m473.73 379.05c-4.5078-3.8594-10.66-5.1719-16.348-3.4922-5.6875 1.6836-10.137 6.1328-11.82 11.82-1.6797 5.6875-0.36719 11.84 3.4922 16.348l61.949 61.949c4.5039 3.8555 10.656 5.1719 16.348 3.4883 5.6875-1.6797 10.137-6.1289 11.816-11.816 1.6836-5.6914 0.36719-11.844-3.4883-16.348z"
|
||||
id="path14"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m595 262.5h-87.5c-6.2539 0-12.031 3.3359-15.156 8.75s-3.125 12.086 0 17.5 8.9023 8.75 15.156 8.75h87.5c6.2539 0 12.031-3.3359 15.156-8.75s3.125-12.086 0-17.5-8.9023-8.75-15.156-8.75z"
|
||||
id="path16"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m461.3 186.2c4.6523 0.027343 9.1211-1.7969 12.426-5.0742l61.949-61.949c3.8555-4.5078 5.1719-10.66 3.4883-16.348-1.6797-5.6875-6.1289-10.137-11.816-11.816-5.6914-1.6836-11.844-0.37109-16.348 3.4883l-61.949 61.773c-3.3086 3.2852-5.1719 7.75-5.1758 12.414-0.003906 4.6602 1.8516 9.1289 5.1562 12.418 3.3047 3.2891 7.7812 5.1211 12.445 5.0938z"
|
||||
id="path18"
|
||||
style="fill:#55d400" />
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.9 KiB |
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" standalone="yes"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
|
||||
<!-- No icon texture for DH -->
|
||||
|
||||
<rect width="50" height="50" x="0" y="0" style="fill:#0000FF" />
|
||||
<rect width="50" height="50" x="50" y="50" style="fill:#0000FF" />
|
||||
<rect width="50" height="50" x="50" y="0" style="fill:#000000" />
|
||||
<rect width="50" height="50" x="0" y="50" style="fill:#000000" />
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 430 B |
Reference in New Issue
Block a user