Skip to content

javasuns/AsusProfiler

Repository files navigation

AsusProfiler

Power Controlling for ASUS laptops

This application is created based on the scripts provided by u/desentizised in this Reddit post "How to gain even more control of your Flow X13". There are 4 profiles you can choose from (ULTRA, SILENT, BALANCED and PERFORMANCE), which are fully customizable through the applications.propreties. You may compile the application yourself, which is created with Java and JavaFX, or run it straight away through the ready executable.

BSD-3 license

Screenshots

Windows
AsusProfiler AsusProfiler LogViewer

Builds

Windows
Download

Important Note

Since version 1.1 the executable image is not created with GraalVM and Gluon Client, since there is luck of AWT support which is needed for System Tray icons. Hence, jpackage is used to create the application image.

Getting started

To compile the software code yourself in Windows you would need to apply the following steps:

1. Setting JAVA_HOME

Windows Sample

set JAVA_HOME=C:\Programs\Java\jdk-17.0.4

2. Create executable Jar file.

The below gradle command will create AsusProfiler-1.3.jar under ./build/libs

gradlew.bat clean build 

3. Use JPackage to create a Windows executable image

3a. Setting Windows Path

set PATH=%PATH%;%JAVA_HOME%\bin

3b. Download Jmods for JavaFX

Since the application GUI is created with JavaFX you will need to download the latest jmods from here. Once downloaded, extract the zip file in your preffered path. In this example I have download jmods 18.0.2 and extracted them under C:\Programs\Java\javafx-jmods-18.0.2.

3c. Run JPackage to create image.

jpackage --input build/libs ^
--name AsusProfiler ^
--main-jar AsusProfiler-1.3.jar ^
--type app-image ^
--module-path "C:\Programs\Java\javafx-jmods-18.0.2" ^
--add-modules javafx.controls,javafx.fxml,javafx.graphics ^
--app-version 1.3 ^
--vendor "JavaSuns" ^
--copyright "Copyright (C) 2022-23" ^
--icon src\main\resources\javasuns\profiler\asus\image\Logo.ico

3d. Locate the executable.

The AsusProfiler directory is created with the Windows executable in it. You would need to add the application.properties file in it before being able to run it.

Getting started [Old Method] (Native image with GraalVM and GluonHQ for v1.0)

To compile the software code yourself in Windows you would need to apply the following steps:

1. Install Microsoft Visual Studio

In order to create Microsft Windows native apps you will need Microsoft Visual Studio. Instructions can be found in Gluon's website.

2. Setting JAVA_HOME and GRAALVM_HOME

GraalVM is mandatory for creating native apps. It is available for download on the GraalVM website. If you have a JDK already installed on your PC, it would be a wise to place GraalVM binaries under the same Java directory for consolidation. ASUS Profiler app has been tested against OpenJDK version 17.0.4 and GraalVM Community Edition 22.0.

Windows Sample

set JAVA_HOME=C:\Programs\Java\jdk-17.0.4
set GRAALVM_HOME=C:\Programs\Java\graalvm-ce-java17-22.1.0

3. Tasks

You can run the regular tasks to build and run your project as a regular Java project:

gradlew.bat clean build
gradlew.bat run

Once you are able to run the pure Java project, you proceed with the native taks:

Desktop Native Application

This task does the AOT compilation. It is a very intensive and lengthy task (several minutes, depending on your project and CPU).

Run the below commands through x64 Native Tools Command Prompt for VS 2022:

gradlew.bat nativeCompile  # AOT Compilation
gradlew.bat nativeLink     # Generates native executable
gradlew.bat nativeRun      # Runs the generated executable

Alternatively, you may combine all the above commands into one:

gradlew.bat nativeBuild nativeRun  # "nativeBuild" combines nativeCompile and nativeLink.