Skip to main content

Prerequisites

Before you begin, ensure you have the following installed:

Required Tools

JDK

Java Development Kit 11 or higher

Kotlin

Kotlin 2.3.0 (managed by Gradle)

Gradle

Included via Gradle Wrapper

Git

For cloning the repository

System Requirements

  • OS: Linux (any distribution)
  • Hardware: Lenovo laptop with ACPI support
  • Kernel Module: acpi_call loaded (lsmod | grep acpi_call)
  • Memory: At least 3GB RAM for Gradle builds
KVantage is designed specifically for Lenovo laptops. Running on other hardware may cause undefined behavior.

Getting Started

1

Clone the repository

git clone https://github.com/kosail/KVantage.git
cd KVantage
2

Verify Gradle setup

The project uses the Gradle Wrapper, so no separate Gradle installation is needed:
./gradlew --version
This will automatically download Gradle if needed.
3

Build the project

Build the entire project with:
./gradlew build
This compiles the Kotlin code, processes resources, and runs tests.
4

Run the application

Launch KVantage in development mode:
./gradlew run
The application will prompt for your sudo password to start the backend daemon with root privileges.

Compose Multiplatform Setup

KVantage is built with Compose Multiplatform for Desktop version 1.10.0.

Key Technologies

TechnologyVersionPurpose
Kotlin2.3.0Primary language
Compose Multiplatform1.10.0UI framework
Material 31.10.0-alpha05Design system
Compose Hot Reload1.0.0Fast development iterations
Kotlinx Serialization1.10.0JSON/data handling
Lifecycle ViewModel2.9.6State management

Project Configuration

The project uses Gradle’s version catalog (gradle/libs.versions.toml) to manage dependencies consistently.
plugins {
    alias(libs.plugins.kotlinMultiplatform)
    alias(libs.plugins.composeMultiplatform)
    alias(libs.plugins.composeCompiler)
    alias(libs.plugins.composeHotReload)
    alias(libs.plugins.kotlinxSerialization)
}

kotlin {
    jvm()
    
    sourceSets {
        commonMain.dependencies {
            // Compose runtime and UI
            implementation(libs.compose.runtime)
            implementation(libs.compose.foundation)
            implementation(libs.compose.material3)
            implementation(libs.compose.ui)
            implementation(libs.compose.components.resources)
            implementation(libs.compose.uiToolingPreview)
            
            // Lifecycle and state management
            implementation(libs.androidx.lifecycle.viewmodelCompose)
            implementation(libs.androidx.lifecycle.runtimeCompose)
            
            // Serialization
            implementation(libs.kotlinx.json.serializer)
        }
        
        jvmMain.dependencies {
            implementation(compose.desktop.currentOs)
            implementation(libs.kotlinx.coroutinesSwing)
        }
    }
}

Development Workflow

Hot Reload

The project includes Compose Hot Reload for faster development:
./gradlew run --continuous
This watches for file changes and automatically recompiles.

Building a Distribution

Create a distributable JAR:
./gradlew packageDistributionForCurrentOS
Or build for release:
./gradlew packageReleaseDistributionForCurrentOS
The output will be in composeApp/build/compose/binaries/main/.

Gradle Configuration

The project is configured with:
# kotlin.code.style=official
# kotlin.daemon.jvmargs=-Xmx3072M
# org.gradle.jvmargs=-Xmx3072M
# org.gradle.configuration-cache=true
# org.gradle.caching=true
These settings optimize build performance and enable Gradle caching.

Project Structure

KVantage/
├── composeApp/                 # Main application module
│   ├── src/
│   │   └── jvmMain/
│   │       ├── kotlin/         # Kotlin source code
│   │       │   └── com/korealm/kvantage/
│   │       │       ├── models/      # Data models
│   │       │       ├── state/       # State management
│   │       │       ├── ui/          # UI components
│   │       │       │   └── mainUI/  # Main screens
│   │       │       └── Main.kt      # Entry point
│   │       └── composeResources/    # Resources and i18n
│   │           ├── drawable/        # Images and icons
│   │           ├── values/          # English strings
│   │           ├── values-es/       # Spanish
│   │           ├── values-ja/       # Japanese
│   │           ├── values-de/       # German
│   │           ├── values-fr/       # French
│   │           ├── values-pt/       # Portuguese
│   │           ├── values-kr/       # Korean
│   │           └── values-zh/       # Chinese
│   ├── bin/                    # Backend daemon binary
│   └── build.gradle.kts        # App build configuration
├── gradle/                     # Gradle wrapper and config
│   └── libs.versions.toml      # Version catalog
├── build.gradle.kts            # Root build configuration
├── settings.gradle.kts         # Project settings
└── gradlew                     # Gradle wrapper script

Entry Point

The application entry point is composeApp/src/jvmMain/kotlin/com/korealm/kvantage/Main.kt:
package com.korealm.kvantage

fun main() {
    // Application initialization
}
Main class configuration in build.gradle.kts:
compose.desktop {
    application {
        mainClass = "com.korealm.kvantage.MainKt"
    }
}

Debugging Considerations

NEVER test as root! The GUI should always run as a normal user.

Debug Mode

Run with debug output:
./gradlew run --debug
Or attach a debugger to the Gradle process:
./gradlew run --debug-jvm
Then attach your IDE debugger to port 5005.

Common Issues

Ensure the kvand binary in composeApp/bin/ is executable:
chmod +x composeApp/bin/kvand
Verify the ACPI module is loaded:
sudo modprobe acpi_call
lsmod | grep acpi_call
Increase Gradle memory in gradle.properties:
org.gradle.jvmargs=-Xmx4096M
Ensure you have proper graphics drivers and X11/Wayland support.Check Java version:
java -version
Requires JDK 11 or higher.
The app needs root access for ACPI operations. Ensure:
  • Your user is in the sudo group
  • You can execute sudo commands
  • The backend daemon requests permissions properly

Logging

Use proper logging! The project maintainer emphasizes this after debugging challenges with root-level operations.
When debugging:
  • Add logging to track execution flow
  • Log ACPI interactions and responses
  • Include error context and stack traces
  • Use appropriate log levels (DEBUG, INFO, WARN, ERROR)

Backend Daemon Development

The backend daemon (kvand) is developed separately:

Why Go?

The daemon was reimplemented in Go due to:
  • JVM limitations for low-level system operations
  • Kotlin Native constraints with ACPI access
  • Better performance for system daemon operations
  • Static binary distribution (no runtime dependencies)

Backend Communication

The GUI communicates with the daemon via:
  • Local socket or IPC mechanism
  • JSON messages (using kotlinx-serialization)
  • Root isolation - only daemon runs with privileges
For backend modifications, clone the Kvand repository separately and rebuild the binary.

IDE Setup

  1. Open the project in IntelliJ IDEA
  2. IDEA will auto-detect the Gradle configuration
  3. Wait for Gradle sync to complete
  4. Run configurations will be automatically created

VS Code

  1. Install the Kotlin extension
  2. Install the Gradle extension
  3. Open the project folder
  4. Use terminal for Gradle commands

Next Steps

Now that your environment is set up:

Ready to contribute?

Review our contributing guidelines to get started with your first PR

Build docs developers (and LLMs) love