+
⦿ build.reports.problems
+
+
+
+ | File Name |
+ Summary |
+
+
+
+ | problems-report.html |
+ - Summary: This code provides a GUI-based tool for controlling fans and keyboard backlighting, as well as checking fan speeds - It offers a user-friendly interface to manage these features, making it easy to adjust settings and monitor performance.Additional Context:* The project structure is not provided in this context. The file path is build/reports/problems/problems-report.html. The file content appears to be an HTML report, but its relevance to the code file is unclear. |
+
+
+
+
+
+
+
+
+
+
+---
+
+## Getting Started
+
+### Prerequisites
+
+This project requires the following dependencies:
+
+- **Programming Language:** Java
+- **Package Manager:** Gradle
+
+### Installation
+
+Build VictusHub from the source and intsall dependencies:
+
+1. **Clone the repository:**
+
+ ```sh
+ ❯ git clone https://github.com/range79/VictusHub/
+ ```
+
+2. **Navigate to the project directory:**
+
+ ```sh
+ ❯ cd VictusHub
+ ```
+
+3. **Install the dependencies:**
+
+
+
+ ```sh
+ ❯ gradle victusBuild
+ ```
+
+### Usage
+
+Run the project with:
+
+**Using [gradle](https://gradle.org/):**
+```sh
+gradle run
+```
+
+### Testing
+
+Victushub uses the {__test_framework__} test framework. Run the test suite with:
+
+**Using [gradle](https://gradle.org/):**
+```sh
+gradle test
+```
+
+---
+
+## Roadmap
+
+- [X] **`Task 1`**:
Implement feature one.
+- [ ] **`Task 2`**: Implement feature two.
+- [ ] **`Task 3`**: Implement feature three.
+
+---
+
+## Contributing
+
+- **💬 [Join the Discussions](https://github.com/range79/VictusHub/discussions)**: Share your insights, provide feedback, or ask questions.
+- **🐛 [Report Issues](https://github.com/range79/VictusHub/issues)**: Submit bugs found or log feature requests for the `VictusHub` project.
+- **💡 [Submit Pull Requests](https://github.com/range79/VictusHub/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs.
+
+
+Contributing Guidelines
+
+1. **Fork the Repository**: Start by forking the project repository to your github account.
+2. **Clone Locally**: Clone the forked repository to your local machine using a git client.
+ ```sh
+ git clone https://github.com/range79/VictusHub/
+ ```
+3. **Create a New Branch**: Always work on a new branch, giving it a descriptive name.
+ ```sh
+ git checkout -b new-feature-x
+ ```
+4. **Make Your Changes**: Develop and test your changes locally.
+5. **Commit Your Changes**: Commit with a clear message describing your updates.
+ ```sh
+ git commit -m 'Implemented new feature x.'
+ ```
+6. **Push to github**: Push the changes to your forked repository.
+ ```sh
+ git push origin new-feature-x
+ ```
+7. **Submit a Pull Request**: Create a PR against the original project repository. Clearly describe the changes and their motivations.
+8. **Review**: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
+
+
+
+Contributor Graph
+
+
+
+
+
+
+
+
+---
+
+## License
+
+Victushub is protected under the [LICENSE](https://choosealicense.com/licenses) License. For more details, refer to the [LICENSE](https://choosealicense.com/licenses/) file.
+
+---
+
+## Acknowledgments
+
+- Credit `contributors`, `inspiration`, `references`, etc.
+
+
+
+[![][back-to-top]](#top)
+
+
+
+
+[back-to-top]: https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square
+
+
+---
diff --git a/VictusService/.gitignore b/VictusService/.gitignore
new file mode 100644
index 0000000..849e6f1
--- /dev/null
+++ b/VictusService/.gitignore
@@ -0,0 +1,43 @@
+.gradle
+build
+!gradle/wrapper/gradle-wrapper.jar
+!**/src/main/**/build/
+!**/src/test/**/build/
+.kotlin
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/VictusService/.idea/.gitignore b/VictusService/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/VictusService/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/VictusService/.idea/gradle.xml b/VictusService/.idea/gradle.xml
new file mode 100644
index 0000000..c0d6c23
--- /dev/null
+++ b/VictusService/.idea/gradle.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VictusService/.idea/misc.xml b/VictusService/.idea/misc.xml
new file mode 100644
index 0000000..ceec3c0
--- /dev/null
+++ b/VictusService/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VictusService/build.gradle b/VictusService/build.gradle
new file mode 100644
index 0000000..9eee311
--- /dev/null
+++ b/VictusService/build.gradle
@@ -0,0 +1,34 @@
+plugins {
+ id 'java'
+ id 'org.graalvm.buildtools.native' version '0.9.21'
+}
+
+group = 'com.range'
+version = '1.0-SNAPSHOT'
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ implementation "org.slf4j:slf4j-simple:2.0.17"
+ testImplementation platform('org.junit:junit-bom:5.10.0')
+ testImplementation 'org.junit.jupiter:junit-jupiter'
+}
+
+graalvmNative {
+ binaries {
+ named("main") {
+ mainClass = "com.range.Main"
+ javaLauncher = javaToolchains.launcherFor {
+ languageVersion = JavaLanguageVersion.of(17)
+
+ }
+ }
+ }
+}
+
+
+test {
+ useJUnitPlatform()
+}
diff --git a/VictusService/gradle/wrapper/gradle-wrapper.jar b/VictusService/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..d64cd49
Binary files /dev/null and b/VictusService/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/VictusService/gradle/wrapper/gradle-wrapper.properties b/VictusService/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..1af9e09
--- /dev/null
+++ b/VictusService/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/VictusService/gradlew b/VictusService/gradlew
new file mode 100755
index 0000000..1aa94a4
--- /dev/null
+++ b/VictusService/gradlew
@@ -0,0 +1,249 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/VictusService/gradlew.bat b/VictusService/gradlew.bat
new file mode 100644
index 0000000..6689b85
--- /dev/null
+++ b/VictusService/gradlew.bat
@@ -0,0 +1,92 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/VictusService/settings.gradle b/VictusService/settings.gradle
new file mode 100644
index 0000000..0a9810b
--- /dev/null
+++ b/VictusService/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'VictusService'
\ No newline at end of file
diff --git a/VictusService/src/main/java/com/range/CommandRunner.java b/VictusService/src/main/java/com/range/CommandRunner.java
new file mode 100644
index 0000000..192e6f0
--- /dev/null
+++ b/VictusService/src/main/java/com/range/CommandRunner.java
@@ -0,0 +1,15 @@
+package com.range;
+
+import java.io.IOException;
+
+public class CommandRunner
+{
+ public static void runCommandAsync(String command) throws IOException {
+
+ ProcessBuilder pb = new ProcessBuilder("bash", "-c", command);
+ Process process = pb.start();
+ System.out.printf("Failed to run command: %s\n", command);
+ }
+
+ }
+
diff --git a/VictusService/src/main/java/com/range/Main.java b/VictusService/src/main/java/com/range/Main.java
new file mode 100644
index 0000000..d0bbc9d
--- /dev/null
+++ b/VictusService/src/main/java/com/range/Main.java
@@ -0,0 +1,69 @@
+package com.range;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Main {
+ private static final Path CONFIG_PATH = Path.of(System.getProperty("user.home"), ".config/victusservice/victus.config");
+
+ public static void main(String[] args) {
+ try {
+ if (Files.exists(CONFIG_PATH)) {
+ List
lines = Files.readAllLines(CONFIG_PATH);
+ Map config = new HashMap<>();
+ for (String line : lines) {
+ line = line.trim();
+ if (line.isEmpty() || line.startsWith("#")) continue;
+ String[] parts = line.split("=", 2);
+ if (parts.length == 2) {
+ config.put(parts[0], parts[1]);
+ }
+ }
+
+ int fanCount = 0;
+ for (String key : config.keySet()) {
+ if (key.startsWith("fan")) {
+ fanCount++;
+ }
+ }
+
+ for (int i = 1; i <= fanCount; i++) {
+ String fanValue = config.getOrDefault("fan" + i, "0");
+ if (!fanValue.equalsIgnoreCase("auto")) { // auto ise yazdırma
+ int fanSpeed = Integer.parseInt(fanValue);
+ System.out.println("Fan " + i + " speed: " + fanSpeed);
+ String command = "echo " + fanSpeed + " | sudo tee /sys/devices/platform/hp-wmi/hwmon/hwmon*/fan" + i + "_target";
+ CommandRunner.runCommandAsync(command);
+ } else {
+ System.out.println("Fan " + i + " is in Auto Mode, skipping RPM set.");
+ }
+ }
+
+
+ int kbdLight = Integer.parseInt(config.getOrDefault("kbd_light", "0"));
+ System.out.println("Keyboard light: " + kbdLight);
+ CommandRunner.runCommandAsync("echo " + kbdLight + " | sudo tee /sys/class/leds/hp::kbd_backlight/brightness");
+
+
+ String kbdColor = config.getOrDefault("kbd_color", "0,0,0");
+ System.out.println("Keyboard color: " + kbdColor);
+ String[] rgb = kbdColor.split(",");
+ if (rgb.length == 3) {
+ String command = String.format(
+ "echo \"%s %s %s\" | sudo tee /sys/class/leds/hp::kbd_backlight/multi_intensity",
+ rgb[0], rgb[1], rgb[2]);
+ CommandRunner.runCommandAsync(command);
+ }
+
+ } else {
+ System.err.println("Config file not found: " + CONFIG_PATH);
+ }
+ } catch (IOException e) {
+ System.err.println("Error reading config file: " + e.getMessage());
+ }
+ }
+}
diff --git a/Victushub-gui/.gitignore b/Victushub-gui/.gitignore
new file mode 100644
index 0000000..ba1cc0e
--- /dev/null
+++ b/Victushub-gui/.gitignore
@@ -0,0 +1,44 @@
+.gradle
+
+!gradle/wrapper/gradle-wrapper.jar
+!**/src/main/**/build/
+!**/src/test/**/build/
+.kotlin
+build
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/Victushub-gui/.idea/.gitignore b/Victushub-gui/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/Victushub-gui/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/.name b/Victushub-gui/.idea/.name
similarity index 100%
rename from .idea/.name
rename to Victushub-gui/.idea/.name
diff --git a/Victushub-gui/.idea/gradle.xml b/Victushub-gui/.idea/gradle.xml
new file mode 100644
index 0000000..ce1c62c
--- /dev/null
+++ b/Victushub-gui/.idea/gradle.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Victushub-gui/.idea/misc.xml b/Victushub-gui/.idea/misc.xml
new file mode 100644
index 0000000..684d59e
--- /dev/null
+++ b/Victushub-gui/.idea/misc.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Victushub-gui/.idea/vcs.xml b/Victushub-gui/.idea/vcs.xml
new file mode 100644
index 0000000..288b36b
--- /dev/null
+++ b/Victushub-gui/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LICENSE b/Victushub-gui/LICENSE
similarity index 100%
rename from LICENSE
rename to Victushub-gui/LICENSE
diff --git a/Victushub-gui/build.gradle.kts b/Victushub-gui/build.gradle.kts
new file mode 100644
index 0000000..33ad7c8
--- /dev/null
+++ b/Victushub-gui/build.gradle.kts
@@ -0,0 +1,93 @@
+
+plugins {
+ java
+ application
+ id("org.javamodularity.moduleplugin") version "1.8.15"
+ id("org.openjfx.javafxplugin") version "0.0.13"
+ id ("com.gluonhq.gluonfx-gradle-plugin") version "1.0.27"
+}
+
+group = "com.range"
+version = "1.0-SNAPSHOT"
+
+repositories {
+ mavenCentral()
+}
+
+val junitVersion = "5.12.1"
+
+java {
+ toolchain {
+ languageVersion = JavaLanguageVersion.of(17)
+ }
+}
+
+tasks.withType {
+ options.encoding = "UTF-8"
+}
+
+application {
+ mainModule.set("com.range.victusHub")
+ mainClass.set("com.range.victusHub.Launcher")
+}
+
+javafx {
+ version = "17.0.14"
+ modules = listOf("javafx.controls", "javafx.fxml")
+}
+
+dependencies {
+ implementation("org.controlsfx:controlsfx:11.2.1")
+ implementation("com.dlsc.formsfx:formsfx-core:11.6.0") {
+ exclude(group = "org.openjfx")
+ }
+ implementation("org.kordamp.ikonli:ikonli-javafx:12.3.1")
+ // https://mvnrepository.com/artifact/org.slf4j/slf4j-simple
+ implementation("org.slf4j:slf4j-simple:2.0.17")
+ testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
+ testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
+}
+
+tasks.withType {
+ useJUnitPlatform()
+}
+
+
+gluonfx {
+ reflectionList = listOf(
+ "com.range.victusHub.fan.FanAndKeyboardController",
+ "com.range.victusHub.fan.FanController",
+
+ "com.range.victusHub.VictusHub",
+ "com.range.victusHub.fan.FanController",
+
+
+ "javafx.scene.control.Button",
+ "javafx.scene.control.Label",
+ "javafx.scene.control.TextField",
+ "javafx.scene.control.PasswordField",
+ "javafx.scene.control.TextArea",
+ "javafx.scene.control.CheckBox",
+ "javafx.scene.control.RadioButton",
+ "javafx.scene.control.ToggleGroup",
+ "javafx.scene.control.ComboBox",
+ "javafx.scene.control.ListView",
+ "javafx.scene.control.TableView",
+ "javafx.scene.control.TableColumn",
+ "javafx.scene.control.Slider",
+ "javafx.scene.control.ColorPicker",
+ "javafx.scene.control.TitledPane",
+ "javafx.scene.control.TabPane",
+ "javafx.scene.control.Tab",
+ "javafx.scene.control.MenuBar",
+ "javafx.scene.control.Menu",
+ "javafx.scene.control.MenuItem",
+ "javafx.scene.layout.AnchorPane",
+ "javafx.scene.layout.GridPane",
+ "javafx.scene.layout.VBox",
+ "javafx.scene.layout.HBox",
+ "javafx.scene.layout.StackPane"
+ )
+ resourcesList = listOf("src/main/resources/com/range/victusHub/hello-view.fxml")
+
+}
diff --git a/Victushub-gui/gradle/wrapper/gradle-wrapper.jar b/Victushub-gui/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..9bbc975
Binary files /dev/null and b/Victushub-gui/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/Victushub-gui/gradle/wrapper/gradle-wrapper.properties b/Victushub-gui/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..ed4c299
--- /dev/null
+++ b/Victushub-gui/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/Victushub-gui/gradlew b/Victushub-gui/gradlew
new file mode 100755
index 0000000..faf9300
--- /dev/null
+++ b/Victushub-gui/gradlew
@@ -0,0 +1,251 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/Victushub-gui/gradlew.bat b/Victushub-gui/gradlew.bat
new file mode 100644
index 0000000..9b42019
--- /dev/null
+++ b/Victushub-gui/gradlew.bat
@@ -0,0 +1,94 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/images/img.png b/Victushub-gui/images/img.png
similarity index 100%
rename from images/img.png
rename to Victushub-gui/images/img.png
diff --git a/qodana.yaml b/Victushub-gui/qodana.yaml
similarity index 100%
rename from qodana.yaml
rename to Victushub-gui/qodana.yaml
diff --git a/settings.gradle.kts b/Victushub-gui/settings.gradle.kts
similarity index 67%
rename from settings.gradle.kts
rename to Victushub-gui/settings.gradle.kts
index c2e5ef7..c25e7d3 100644
--- a/settings.gradle.kts
+++ b/Victushub-gui/settings.gradle.kts
@@ -1,4 +1,4 @@
-rootProject.name = "victushub"
+rootProject.name = "VictusHub-gui"
pluginManagement {
repositories {
gradlePluginPortal()
diff --git a/Victushub-gui/src/main/java/com/range/victusHub/Launcher.java b/Victushub-gui/src/main/java/com/range/victusHub/Launcher.java
new file mode 100644
index 0000000..172d4d1
--- /dev/null
+++ b/Victushub-gui/src/main/java/com/range/victusHub/Launcher.java
@@ -0,0 +1,15 @@
+package com.range.victusHub;
+
+import javafx.application.Application;
+
+import java.util.logging.Logger;
+
+public class Launcher {
+
+ private static final Logger log = Logger.getLogger("Launcher");
+
+ public static void main(String[] args) {
+ log.info("Application Started");
+ Application.launch(VictusHub.class, args);
+ }
+}
diff --git a/src/main/java/com/example/victusHub/VictusHub.java b/Victushub-gui/src/main/java/com/range/victusHub/VictusHub.java
similarity index 76%
rename from src/main/java/com/example/victusHub/VictusHub.java
rename to Victushub-gui/src/main/java/com/range/victusHub/VictusHub.java
index 499bfa9..b991f2e 100644
--- a/src/main/java/com/example/victusHub/VictusHub.java
+++ b/Victushub-gui/src/main/java/com/range/victusHub/VictusHub.java
@@ -1,4 +1,4 @@
-package com.example.victusHub;
+package com.range.victusHub;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
@@ -13,7 +13,8 @@ public VictusHub() {
}
@Override
public void start(Stage stage) throws IOException {
- FXMLLoader fxmlLoader = new FXMLLoader(VictusHub.class.getResource("hello-view.fxml"));
+ FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/com.range.victusHub/hello-view.fxml"));
+
Scene scene = new Scene(fxmlLoader.load(), 700, 1000);
stage.setTitle("Victus Hub");
stage.setScene(scene);
diff --git a/Victushub-gui/src/main/java/com/range/victusHub/fan/FanAndKeyboardController.java b/Victushub-gui/src/main/java/com/range/victusHub/fan/FanAndKeyboardController.java
new file mode 100644
index 0000000..20b5f0c
--- /dev/null
+++ b/Victushub-gui/src/main/java/com/range/victusHub/fan/FanAndKeyboardController.java
@@ -0,0 +1,144 @@
+package com.range.victusHub.fan;
+
+import javafx.application.Platform;
+import javafx.fxml.FXML;
+import javafx.scene.control.*;
+import javafx.scene.layout.VBox;
+import javafx.scene.paint.Color;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.nio.file.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+public class FanAndKeyboardController {
+
+ private final Logger logger = LoggerFactory.getLogger(FanAndKeyboardController.class);
+
+ @FXML
+ private VBox fanContainer;
+
+ @FXML
+ private Slider suryaLightSlider;
+ @FXML
+ private Label lightValueLabel;
+
+ @FXML
+ private ColorPicker colorPicker;
+
+ private FanController fanController;
+ private List fans;
+
+ private static final Path CONFIG_PATH = Path.of(System.getProperty("user.home"), ".config/victusservice/victus.config");
+
+ @FXML
+ private void initialize() {
+ fanController = new FanController();
+ fans = fanController.getFans();
+
+ // Fan UI
+ for (int i = 0; i < fans.size(); i++) {
+ FanController.Fan fan = fans.get(i);
+ TitledPane pane = createFanPane(fan, i);
+ fanContainer.getChildren().add(pane);
+ }
+
+ // Keyboard light slider
+ suryaLightSlider.valueProperty().addListener((obs, oldVal, newVal) ->
+ lightValueLabel.setText("Current Brightness: " + newVal.intValue() + "%"));
+ }
+
+ private TitledPane createFanPane(FanController.Fan fan, int index) {
+ VBox content = new VBox(10);
+
+ Label label = new Label(fan.toString());
+
+ Slider slider = new Slider(0, fan.getMaxRpm(), fan.getMaxRpm() / 2.0);
+ slider.setShowTickLabels(true);
+ slider.setShowTickMarks(true);
+
+ Button applyButton = new Button("Apply Speed");
+ applyButton.setOnAction(e -> {
+ fan.setSpeed((int) slider.getValue());
+ label.setText("Applied Speed: " + (int) slider.getValue());
+ updateConfig("fan" + (index + 1), String.valueOf((int) slider.getValue()));
+ });
+
+ Button autoButton = new Button("Auto Mode");
+ autoButton.setOnAction(e -> {
+ fan.setAutoMode();
+ label.setText("Auto Mode Enabled");
+ updateConfig("fan" + (index + 1), "auto");
+ });
+
+ content.getChildren().addAll(label, slider, applyButton, autoButton);
+
+ TitledPane pane = new TitledPane("Fan " + (index + 1), content);
+ pane.setCollapsible(false);
+ return pane;
+ }
+
+ @FXML
+ private void onApplyLightClick() {
+ int brightness = (int) suryaLightSlider.getValue();
+ String cmd = "echo " + brightness + " | sudo tee /sys/class/leds/hp::kbd_backlight/brightness";
+ runCommandAsync(cmd,
+ () -> {
+ lightValueLabel.setText("Applied Brightness: " + brightness + "%");
+ updateConfig("kbd_light", String.valueOf(brightness));
+ },
+ () -> lightValueLabel.setText("Error applying brightness"));
+ }
+
+ @FXML
+ private void onSetLightClick() {
+ Color color = colorPicker.getValue();
+ int r = (int) (color.getRed() * 255);
+ int g = (int) (color.getGreen() * 255);
+ int b = (int) (color.getBlue() * 255);
+
+ String cmd = String.format("echo \"%d %d %d\" | sudo tee /sys/class/leds/hp::kbd_backlight/multi_intensity", r, g, b);
+ runCommandAsync(cmd,
+ () -> {
+ logger.info("RGB Applied: " + r + " " + g + " " + b);
+ updateConfig("kbd_color", r + "," + g + "," + b);
+ },
+ () -> logger.error("Error applying RGB"));
+ }
+
+ private void runCommandAsync(String command, Runnable onSuccess, Runnable onError) {
+ new Thread(() -> {
+ try {
+ ProcessBuilder pb = new ProcessBuilder("bash", "-c", command);
+ Process process = pb.start();
+ int exitCode = process.waitFor();
+ Platform.runLater(() -> {
+ if (exitCode == 0) onSuccess.run();
+ else onError.run();
+ });
+ } catch (Exception e) {
+ Platform.runLater(onError);
+ logger.error("Error running command: {}", command, e);
+ }
+ }).start();
+ }
+
+ private void updateConfig(String key, String value) {
+ try {
+ Properties props = new Properties();
+ if (Files.exists(CONFIG_PATH)) {
+ try { props.load(Files.newBufferedReader(CONFIG_PATH)); } catch (IOException ignored) {}
+ } else {
+ Files.createDirectories(CONFIG_PATH.getParent());
+ Files.createFile(CONFIG_PATH);
+ }
+ props.setProperty(key, value);
+ props.store(Files.newBufferedWriter(CONFIG_PATH), "Updated by FanAndKeyboardController");
+ } catch (IOException e) {
+ logger.error("Error updating config file", e);
+ }
+ }
+}
diff --git a/Victushub-gui/src/main/java/com/range/victusHub/fan/FanController.java b/Victushub-gui/src/main/java/com/range/victusHub/fan/FanController.java
new file mode 100644
index 0000000..9181c6a
--- /dev/null
+++ b/Victushub-gui/src/main/java/com/range/victusHub/fan/FanController.java
@@ -0,0 +1,109 @@
+package com.range.victusHub.fan;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class FanController {
+
+ private static final String BASE_PATH = "/sys/devices/platform/hp-wmi/hwmon";
+ private final List fans = new ArrayList<>();
+
+ public FanController() {
+ detectFans();
+ }
+
+ private void detectFans() {
+ File hwmonDir = new File(BASE_PATH);
+ if (!hwmonDir.exists() || !hwmonDir.isDirectory()) return;
+
+ File[] hwmons = hwmonDir.listFiles((dir, name) -> name.startsWith("hwmon"));
+ if (hwmons == null) return;
+
+ for (File hwmon : hwmons) {
+ File[] fanTargets = hwmon.listFiles((dir, name) -> name.matches("fan\\d+_target"));
+ if (fanTargets == null) continue;
+
+ for (File fanFile : fanTargets) {
+ String index = fanFile.getName().replaceAll("\\D+", "");
+ File enableFile = new File(hwmon, "pwm" + index + "_enable");
+ File maxFile = new File(hwmon, "fan" + index + "_max");
+
+ int maxRpm = readInt(maxFile);
+ fans.add(new Fan(Integer.parseInt(index), fanFile, enableFile, maxRpm));
+ }
+ }
+ }
+
+ public List getFans() {
+ return fans;
+ }
+
+
+ public void enableAutoModeAll() {
+ for (Fan fan : fans) {
+ fan.setAutoMode();
+ }
+ }
+
+
+ public void enableManualModeAll() {
+ for (Fan fan : fans) {
+ fan.setManualMode();
+ }
+ }
+
+ private int readInt(File file) {
+ try (java.util.Scanner sc = new java.util.Scanner(file)) {
+ return sc.nextInt();
+ } catch (Exception e) {
+ return 6000;
+ }
+ }
+
+ public static class Fan {
+ private final int index;
+ private final File targetFile;
+ private final File enableFile;
+ private final int maxRpm;
+
+ public Fan(int index, File targetFile, File enableFile, int maxRpm) {
+ this.index = index;
+ this.targetFile = targetFile;
+ this.enableFile = enableFile;
+ this.maxRpm = maxRpm;
+ }
+
+ public void setAutoMode() {
+ write(enableFile, "2");
+ }
+
+ public void setManualMode() {
+ write(enableFile, "1");
+ }
+
+ public void setSpeed(int rpm) {
+ if (rpm > maxRpm) rpm = maxRpm;
+ write(targetFile, String.valueOf(rpm));
+ }
+
+ public int getMaxRpm() {
+ return maxRpm;
+ }
+
+ private void write(File file, String value) {
+ try (FileWriter fw = new FileWriter(file)) {
+ fw.write(value);
+ } catch (IOException e) {
+ System.err.println("Fan " + index + ": " + e.getMessage());
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Fan " + index + " (max " + maxRpm + " rpm)";
+ }
+ }
+}
diff --git a/src/main/java/module-info.java b/Victushub-gui/src/main/java/module-info.java
similarity index 52%
rename from src/main/java/module-info.java
rename to Victushub-gui/src/main/java/module-info.java
index b49d5af..4e45ce7 100644
--- a/src/main/java/module-info.java
+++ b/Victushub-gui/src/main/java/module-info.java
@@ -1,4 +1,4 @@
-module com.example.victusHub {
+module com.range.victusHub {
requires javafx.controls;
requires javafx.fxml;
@@ -8,6 +8,8 @@
requires java.logging;
requires org.slf4j;
- opens com.example.victusHub to javafx.fxml;
- exports com.example.victusHub;
+ opens com.range.victusHub to javafx.fxml;
+ exports com.range.victusHub;
+ exports com.range.victusHub.fan;
+ opens com.range.victusHub.fan to javafx.fxml;
}
\ No newline at end of file
diff --git a/src/main/resources/com/example/victusHub/hello-view.fxml b/Victushub-gui/src/main/resources/com.range.victusHub/hello-view.fxml
similarity index 50%
rename from src/main/resources/com/example/victusHub/hello-view.fxml
rename to Victushub-gui/src/main/resources/com.range.victusHub/hello-view.fxml
index 8d7b5d6..bfc31ca 100644
--- a/src/main/resources/com/example/victusHub/hello-view.fxml
+++ b/Victushub-gui/src/main/resources/com.range.victusHub/hello-view.fxml
@@ -4,52 +4,59 @@
-
+
-
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
+
-
-
-
+
+
+
+
-
+
-
-
-
-
+
+
-
+
-
-
+
@@ -57,9 +64,10 @@
-
diff --git a/src/main/resources/com/example/victusHub/style.css b/Victushub-gui/src/main/resources/com.range.victusHub/style.css
similarity index 100%
rename from src/main/resources/com/example/victusHub/style.css
rename to Victushub-gui/src/main/resources/com.range.victusHub/style.css
diff --git a/build.gradle.kts b/build.gradle.kts
index fd14e09..0e8fe4d 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,97 +1,23 @@
-plugins {
- java
- application
- id("org.javamodularity.moduleplugin") version "1.8.15"
- id("org.openjfx.javafxplugin") version "0.0.13"
- id ("com.gluonhq.gluonfx-gradle-plugin") version "1.0.27"
-}
-
-group = "com.example"
-version = "1.0-SNAPSHOT"
+version = "1.0"
-repositories {
- mavenCentral()
-}
+tasks.register("victusBuild") {
+ dependsOn(
+ ":Victushub-gui:nativeBuild",
+ ":VictusService:nativeBuild"
+ )
-val junitVersion = "5.12.1"
-java {
- toolchain {
- languageVersion = JavaLanguageVersion.of(17)
+ from("Victushub-gui/build/gluonfx/x86_64-linux/Victushub-gui") {
+ into("")
}
-}
-tasks.withType {
- options.encoding = "UTF-8"
-}
-
-application {
- mainModule.set("com.example.victusHub")
- mainClass.set("com.example.victusHub.Launcher")
-}
-
-javafx {
- version = "17.0.14"
- modules = listOf("javafx.controls", "javafx.fxml")
-}
-dependencies {
- implementation("org.controlsfx:controlsfx:11.2.1")
- implementation("com.dlsc.formsfx:formsfx-core:11.6.0") {
- exclude(group = "org.openjfx")
+ from("VictusService/build/native/nativeCompile/VictusService") {
+ into("/")
}
- implementation("org.kordamp.ikonli:ikonli-javafx:12.3.1")
- // https://mvnrepository.com/artifact/org.slf4j/slf4j-simple
- implementation("org.slf4j:slf4j-simple:2.0.17")
- testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
- testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
-}
-
-tasks.withType {
- useJUnitPlatform()
-}
-
-
-gluonfx {
- reflectionList = listOf(
- "com.example.victusHub.VictusHub",
- "com.example.victusHub.FanController",
-
-
- "javafx.scene.control.Button",
- "javafx.scene.control.Label",
- "javafx.scene.control.TextField",
- "javafx.scene.control.PasswordField",
- "javafx.scene.control.TextArea",
- "javafx.scene.control.CheckBox",
- "javafx.scene.control.RadioButton",
- "javafx.scene.control.ToggleGroup",
- "javafx.scene.control.ComboBox",
- "javafx.scene.control.ListView",
- "javafx.scene.control.TableView",
- "javafx.scene.control.TableColumn",
- "javafx.scene.control.Slider",
- "javafx.scene.control.ColorPicker",
- "javafx.scene.control.TitledPane",
- "javafx.scene.control.TabPane",
- "javafx.scene.control.Tab",
- "javafx.scene.control.MenuBar",
- "javafx.scene.control.Menu",
- "javafx.scene.control.MenuItem",
- "javafx.scene.layout.AnchorPane",
- "javafx.scene.layout.GridPane",
- "javafx.scene.layout.VBox",
- "javafx.scene.layout.HBox",
- "javafx.scene.layout.StackPane"
- )
- resourcesList = listOf("src/main/resources/com/example/victusHub/hello-view.fxml")
-
-}
-tasks.register("victusBuild") {
- dependsOn("nativeBuild")
- from("build/gluonfx/x86_64-linux/victushub")
- into("Installer")
+ destinationDir = file("Installer")
+ includeEmptyDirs = false
}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 249e583..9bbc975 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..f856c3c
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,4 @@
+rootProject.name = "VictusHub"
+
+include("Victushub-gui")
+include("VictusService")
\ No newline at end of file
diff --git a/src/main/java/com/example/victusHub/FanController.java b/src/main/java/com/example/victusHub/FanController.java
deleted file mode 100644
index 1c6f7c0..0000000
--- a/src/main/java/com/example/victusHub/FanController.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package com.example.victusHub;
-
-import javafx.application.Platform;
-import javafx.fxml.FXML;
-import javafx.scene.control.*;
-import javafx.scene.layout.VBox;
-import javafx.scene.paint.Color;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class FanController {
-
- private final Logger logger = LoggerFactory.getLogger(FanController.class);
- private final FanCounter fanCounter = new FanCounter();
-
- @FXML
- private VBox fanContainer;
- private final List fanSliders = new ArrayList<>();
- private final List fanLabels = new ArrayList<>();
-
- @FXML
- private Slider suryaLightSlider;
- @FXML
- private Label lightValueLabel;
-
- @FXML
- private ColorPicker colorPicker;
-
-
- @FXML
- private void initialize() {
- int fanCount = fanCounter.detectFanCount();
- for (int i = 0; i < fanCount; i++) {
- Slider slider = new Slider(0, 10000, 0);
- slider.setShowTickLabels(true);
- slider.setShowTickMarks(true);
-
- Label label = new Label("Current RPM: 0");
- slider.valueProperty().addListener((obs, oldVal, newVal) ->
- label.setText("Current RPM: " + newVal.intValue()));
-
- Button applyButton = new Button("Apply");
- int index = i;
- applyButton.setOnAction(e -> applyFanSpeed(index));
-
- VBox fanBox = new VBox(5, new Label("Fan " + (i + 1)), slider, label, applyButton);
- fanContainer.getChildren().add(fanBox);
-
- fanSliders.add(slider);
- fanLabels.add(label);
- }
-
- suryaLightSlider.valueProperty().addListener((obs, oldVal, newVal) ->
- lightValueLabel.setText("Current Brightness: " + newVal.intValue() + "%"));
- }
-
- private void applyFanSpeed(int index) {
- int speed = (int) fanSliders.get(index).getValue();
- String command = "echo " + speed + " | sudo tee /sys/devices/platform/hp-wmi/hwmon/hwmon*/fan1_target";
- runCommandAsync(command,
- () -> fanLabels.get(index).setText("Applied Speed: " + speed + " RPM"),
- () -> fanLabels.get(index).setText("Error applying fan speed"));
- }
-
- @FXML
- private void onApplyLightClick() {
- int brightness = (int) suryaLightSlider.getValue();
- String command = "echo " + brightness + " | sudo tee /sys/class/leds/hp::kbd_backlight/brightness";
- runCommandAsync(command,
- () -> lightValueLabel.setText("Applied Brightness: " + brightness + "%"),
- () -> lightValueLabel.setText("Error applying brightness"));
- }
-
- @FXML
- private void onSetLightClick() {
- Color color = colorPicker.getValue();
- int r = (int) (color.getRed() * 255);
- int g = (int) (color.getGreen() * 255);
- int b = (int) (color.getBlue() * 255);
- String command = String.format("echo \"%d %d %d\" | sudo tee /sys/class/leds/hp::kbd_backlight/multi_intensity", r, g, b);
-
- runCommandAsync(command,
- () -> logger.info("RGB Applied: " + r + " " + g + " " + b) ,
- () ->logger.error("Error applying RGB")
- );
-
- }
-
- private void runCommandAsync(String command, Runnable onSuccess, Runnable onError) {
- new Thread(() -> {
- try {
- ProcessBuilder pb = new ProcessBuilder("bash", "-c", command);
- Process process = pb.start();
- int exitCode = process.waitFor();
- Platform.runLater(() -> {
- if (exitCode == 0) onSuccess.run();
- else onError.run();
- });
- } catch (Exception e) {
- Platform.runLater(onError);
- logger.error("Error running command: {}", command, e);
- }
- }).start();
- }
-}
diff --git a/src/main/java/com/example/victusHub/FanCounter.java b/src/main/java/com/example/victusHub/FanCounter.java
deleted file mode 100644
index 3793a73..0000000
--- a/src/main/java/com/example/victusHub/FanCounter.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.example.victusHub;
-
-
-import java.io.File;
-
-public class FanCounter {
-
- public int detectFanCount() {
- File hwmonDir = new File("/sys/devices/platform/hp-wmi/hwmon/");
- if (!hwmonDir.exists() || !hwmonDir.isDirectory()) {
- return 0;
- }
-
- File[] hwmonFolders = hwmonDir.listFiles((dir, name) -> name.startsWith("hwmon"));
- int fanCount = 0;
-
- if (hwmonFolders != null) {
- for (File hwmon : hwmonFolders) {
- File[] fanFiles = hwmon.listFiles((dir, name) -> name.matches("fan\\d+_input"));
- if (fanFiles != null) {
- fanCount += fanFiles.length;
- }
- }
- }
-
- return fanCount;
- }
-}
diff --git a/src/main/java/com/example/victusHub/Launcher.java b/src/main/java/com/example/victusHub/Launcher.java
deleted file mode 100644
index 185ce68..0000000
--- a/src/main/java/com/example/victusHub/Launcher.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.example.victusHub;
-
-import javafx.application.Application;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.InputStreamReader;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.stream.Collectors;
-
-public class Launcher {
-
- private static final Logger LOG = Logger.getLogger("Launcher");
-
- public static void main(String[] args) throws InterruptedException {
- LOG.info("Launcher starting, performing minimal config check...");
-
- String binaryPath = args.length > 0 ? args[0] : "/usr/local/bin/victusHub";
- String sudoersName = args.length > 1 ? args[1] : "victusHub-" + System.getProperty("user.name");
-
- // Minimal config check
- ConfigCheckerMinimal.check(binaryPath, "/etc/sudoers.d/" + sudoersName);
- Thread.sleep(1000);
- // Start JavaFX application
- Application.launch(VictusHub.class, args);
- }
-
- /** Minimal config checker */
- public static class ConfigCheckerMinimal {
- public static void check(String binaryPath, String sudoersPath) {
- LOG.info("=== Config Check (Minimal) ===");
- checkBinary(binaryPath);
- checkSudoers(sudoersPath);
- checkGetcap(binaryPath);
- LOG.info("=== Config Check Completed ===");
- }
-
- private static void checkBinary(String pathStr) {
- Path path = Path.of(pathStr);
- if (!Files.exists(path)) {
- LOG.warning("Binary not found: " + pathStr);
- return;
- }
- File f = path.toFile();
- LOG.info("Binary found: " + f.getAbsolutePath());
- LOG.info(" - size: " + f.length() + " bytes");
- LOG.info(" - executable: " + f.canExecute());
- try {
- String perms = Files.getPosixFilePermissions(path).stream()
- .map(Object::toString)
- .collect(Collectors.joining(","));
- LOG.info(" - permissions: " + perms);
- } catch (Exception e) {
- LOG.fine("Unable to read permissions: " + e.getMessage());
- }
- }
-
- private static void checkSudoers(String sudoersPath) {
- Path path = Path.of(sudoersPath);
- if (!Files.exists(path)) {
- LOG.info("Sudoers fragment missing: " + sudoersPath);
- LOG.info(" -> To allow passwordless sudo (with user consent): echo \" ALL=(root) NOPASSWD: \" | sudo tee " + sudoersPath);
- return;
- }
- LOG.info("Sudoers fragment exists: " + sudoersPath);
- runAndLog(List.of("sudo", "visudo", "-c", "-f", sudoersPath), "visudo validation");
- }
-
- private static void checkGetcap(String binaryPath) {
- runAndLog(List.of("which", "getcap"), "getcap check (is libcap installed?)");
- runAndLog(List.of("getcap", binaryPath), "getcap - binary capabilities");
- }
-
- private static void runAndLog(List cmd, String desc) {
- try {
- ProcessBuilder pb = new ProcessBuilder(cmd);
- pb.redirectErrorStream(true);
- Process p = pb.start();
- try (BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
- String out = br.lines().collect(Collectors.joining("\n"));
- int rc = p.waitFor();
- if (rc == 0) {
- LOG.info(desc + " succeeded. Output: " + (out.isBlank() ? "" : out));
- } else {
- LOG.warning(desc + " failed (rc=" + rc + "). Output: " + (out.isBlank() ? "" : out));
- if (out.toLowerCase().contains("sudo") || out.toLowerCase().contains("password")) {
- LOG.warning(" -> Note: visudo/sudo commands may require root password; interactive terminal may be needed.");
- }
- }
- }
- } catch (Exception e) {
- LOG.log(Level.WARNING, desc + " could not run: " + e.getMessage(), e);
- }
- }
- }
-}