1
Fork 0
mirror of https://github.com/RGBCube/superfreq synced 2025-07-27 17:07:44 +00:00

treewide: finish renaming to Watt (#36)

This commit is contained in:
raf 2025-06-06 16:15:41 +03:00 committed by GitHub
commit d33659209e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 132 additions and 132 deletions

View file

@ -30,11 +30,11 @@ jobs:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
target: x86_64-unknown-linux-gnu target: x86_64-unknown-linux-gnu
name: superfreq-linux-amd64 name: watt-linux-amd64
cross: false cross: false
- os: ubuntu-latest - os: ubuntu-latest
target: aarch64-unknown-linux-gnu target: aarch64-unknown-linux-gnu
name: superfreq-linux-arm64 name: watt-linux-arm64
cross: true cross: true
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -88,12 +88,12 @@ jobs:
uses: robinraju/release-downloader@v1 uses: robinraju/release-downloader@v1
with: with:
tag: ${{ github.ref_name }} tag: ${{ github.ref_name }}
fileName: "superfreq-*" fileName: "watt-*"
out-file-path: "." out-file-path: "."
- name: Generate checksums - name: Generate checksums
run: | run: |
sha256sum superfreq-* > SHA256SUMS sha256sum watt-* > SHA256SUMS
- name: Upload Checksums - name: Upload Checksums
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2

98
Cargo.lock generated
View file

@ -13,9 +13,9 @@ dependencies = [
[[package]] [[package]]
name = "anstream" name = "anstream"
version = "0.6.18" version = "0.6.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"anstyle-parse", "anstyle-parse",
@ -28,36 +28,36 @@ dependencies = [
[[package]] [[package]]
name = "anstyle" name = "anstyle"
version = "1.0.10" version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
[[package]] [[package]]
name = "anstyle-parse" name = "anstyle-parse"
version = "0.2.6" version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
dependencies = [ dependencies = [
"utf8parse", "utf8parse",
] ]
[[package]] [[package]]
name = "anstyle-query" name = "anstyle-query"
version = "1.1.2" version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9"
dependencies = [ dependencies = [
"windows-sys", "windows-sys",
] ]
[[package]] [[package]]
name = "anstyle-wincon" name = "anstyle-wincon"
version = "3.0.7" version = "3.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"once_cell", "once_cell_polyfill",
"windows-sys", "windows-sys",
] ]
@ -69,9 +69,9 @@ checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.9.0" version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@ -87,9 +87,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.38" version = "4.5.39"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed93b9805f8ba930df42c2590f05453d5ec36cbb85d018868a5b24d31f6ac000" checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -97,9 +97,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.38" version = "4.5.39"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "379026ff283facf611b0ea629334361c4211d1b12ee01024eec1591133b04120" checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -127,9 +127,9 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
[[package]] [[package]]
name = "colorchoice" name = "colorchoice"
version = "1.0.3" version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
[[package]] [[package]]
name = "ctrlc" name = "ctrlc"
@ -216,9 +216,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.3.9" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08"
[[package]] [[package]]
name = "indexmap" name = "indexmap"
@ -238,9 +238,9 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]] [[package]]
name = "jiff" name = "jiff"
version = "0.2.13" version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f02000660d30638906021176af16b17498bd0d12813dbfe7b276d8bc7f3c0806" checksum = "a194df1107f33c79f4f93d02c80798520551949d59dfad22b6157048a88cca93"
dependencies = [ dependencies = [
"jiff-static", "jiff-static",
"jiff-tzdb-platform", "jiff-tzdb-platform",
@ -253,9 +253,9 @@ dependencies = [
[[package]] [[package]]
name = "jiff-static" name = "jiff-static"
version = "0.2.13" version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3c30758ddd7188629c6713fc45d1188af4f44c90582311d0c8d8c9907f60c48" checksum = "6c6e1db7ed32c6c71b759497fae34bf7933636f75a251b9e736555da426f6442"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -319,19 +319,19 @@ dependencies = [
[[package]] [[package]]
name = "num_cpus" name = "num_cpus"
version = "1.16.0" version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b"
dependencies = [ dependencies = [
"hermit-abi", "hermit-abi",
"libc", "libc",
] ]
[[package]] [[package]]
name = "once_cell" name = "once_cell_polyfill"
version = "1.21.3" version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
[[package]] [[package]]
name = "option-ext" name = "option-ext"
@ -341,9 +341,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]] [[package]]
name = "portable-atomic" name = "portable-atomic"
version = "1.11.0" version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
[[package]] [[package]]
name = "portable-atomic-util" name = "portable-atomic-util"
@ -447,23 +447,6 @@ version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "superfreq"
version = "0.3.2"
dependencies = [
"anyhow",
"clap",
"ctrlc",
"dirs",
"env_logger",
"jiff",
"log",
"num_cpus",
"serde",
"thiserror",
"toml",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.101" version = "2.0.101"
@ -554,6 +537,23 @@ version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "watt"
version = "0.3.2"
dependencies = [
"anyhow",
"clap",
"ctrlc",
"dirs",
"env_logger",
"jiff",
"log",
"num_cpus",
"serde",
"thiserror",
"toml",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.59.0" version = "0.59.0"

View file

@ -1,5 +1,5 @@
[package] [package]
name = "superfreq" name = "watt"
description = "Modern CPU frequency and power management utility for Linux" description = "Modern CPU frequency and power management utility for Linux"
version = "0.3.2" version = "0.3.2"
edition = "2024" edition = "2024"

View file

@ -1,5 +1,5 @@
<h1 id="header" align="center"> <h1 id="header" align="center">
Superfreq Watt
</h1> </h1>
<div align="center"> <div align="center">
@ -8,15 +8,15 @@
<div align="center"> <div align="center">
<br/> <br/>
<a href="#what-is-superfreq">Synopsis</a><br/> <a href="#what-is-watt">Synopsis</a><br/>
<a href="#features">Features</a> | <a href="#usage">Usage</a><br/> <a href="#features">Features</a> | <a href="#usage">Usage</a><br/>
<a href="#contributing">Contributing</a> <a href="#contributing">Contributing</a>
<br/> <br/>
</div> </div>
## What is Superfreq ## What is Watt
Superfreq is a modern CPU frequency and power management utility for Linux Watt is a modern CPU frequency and power management utility for Linux
systems. It provides intelligent control of CPU governors, frequencies, and systems. It provides intelligent control of CPU governors, frequencies, and
power-saving features, helping optimize both performance and battery life. power-saving features, helping optimize both performance and battery life.
@ -48,81 +48,81 @@ but most common usecases are already implemented.
```bash ```bash
# Show current system information # Show current system information
superfreq info watt info
# Run as a daemon in the background # Run as a daemon in the background
sudo superfreq daemon sudo watt daemon
# Run with verbose logging # Run with verbose logging
sudo superfreq daemon --verbose sudo watt daemon --verbose
# Display comprehensive debug information # Display comprehensive debug information
superfreq debug watt debug
``` ```
### CPU Governor Control ### CPU Governor Control
```bash ```bash
# Set CPU governor for all cores # Set CPU governor for all cores
sudo superfreq set-governor performance sudo watt set-governor performance
# Set CPU governor for a specific core # Set CPU governor for a specific core
sudo superfreq set-governor powersave --core-id 0 sudo watt set-governor powersave --core-id 0
# Force a specific governor mode persistently # Force a specific governor mode persistently
sudo superfreq force-governor performance sudo watt force-governor performance
``` ```
### Turbo Boost Management ### Turbo Boost Management
```bash ```bash
# Always enable turbo boost # Always enable turbo boost
sudo superfreq set-turbo always sudo watt set-turbo always
# Disable turbo boost # Disable turbo boost
sudo superfreq set-turbo never sudo watt set-turbo never
# Let Superfreq manage turbo boost based on conditions # Let Watt manage turbo boost based on conditions
sudo superfreq set-turbo auto sudo watt set-turbo auto
``` ```
### Power and Performance Settings ### Power and Performance Settings
```bash ```bash
# Set Energy Performance Preference (EPP) # Set Energy Performance Preference (EPP)
sudo superfreq set-epp performance sudo watt set-epp performance
# Set Energy Performance Bias (EPB) # Set Energy Performance Bias (EPB)
sudo superfreq set-epb 4 sudo watt set-epb 4
# Set ACPI platform profile # Set ACPI platform profile
sudo superfreq set-platform-profile balanced sudo watt set-platform-profile balanced
``` ```
### Frequency Control ### Frequency Control
```bash ```bash
# Set minimum CPU frequency (in MHz) # Set minimum CPU frequency (in MHz)
sudo superfreq set-min-freq 800 sudo watt set-min-freq 800
# Set maximum CPU frequency (in MHz) # Set maximum CPU frequency (in MHz)
sudo superfreq set-max-freq 3000 sudo watt set-max-freq 3000
# Set per-core frequency limits # Set per-core frequency limits
sudo superfreq set-min-freq 1200 --core-id 0 sudo watt set-min-freq 1200 --core-id 0
sudo superfreq set-max-freq 2800 --core-id 1 sudo watt set-max-freq 2800 --core-id 1
``` ```
### Battery Management ### Battery Management
```bash ```bash
# Set battery charging thresholds to extend battery lifespan # Set battery charging thresholds to extend battery lifespan
sudo superfreq set-battery-thresholds 40 80 # Start charging at 40%, stop at 80% sudo watt set-battery-thresholds 40 80 # Start charging at 40%, stop at 80%
``` ```
Battery charging thresholds help extend battery longevity by preventing constant Battery charging thresholds help extend battery longevity by preventing constant
charging to 100%. Different laptop vendors implement this feature differently, charging to 100%. Different laptop vendors implement this feature differently,
but Superfreq attempts to support multiple vendor implementations including: but Watt attempts to support multiple vendor implementations including:
- Lenovo ThinkPad/IdeaPad (Standard implementation) - Lenovo ThinkPad/IdeaPad (Standard implementation)
- ASUS laptops - ASUS laptops
@ -135,12 +135,12 @@ more than issue reports, as supporting hardware _needs_ hardware.
## Configuration ## Configuration
Superfreq uses TOML configuration files. Default locations: Watt uses TOML configuration files. Default locations:
- `/etc/xdg/superfreq/config.toml` - `/etc/xdg/watt/config.toml`
- `/etc/superfreq.toml` - `/etc/watt.toml`
You can also specify a custom path by setting the `SUPERFREQ_CONFIG` environment You can also specify a custom path by setting the `WATT_CONFIG` environment
variable. variable.
### Sample Configuration ### Sample Configuration
@ -214,7 +214,7 @@ throttle_on_battery = true
# Logging level: Error, Warning, Info, Debug # Logging level: Error, Warning, Info, Debug
log_level = "Info" log_level = "Info"
# Optional stats file path # Optional stats file path
stats_file_path = "/var/run/superfreq-stats" stats_file_path = "/var/run/watt-stats"
# Optional: List of power supplies to ignore # Optional: List of power supplies to ignore
[power_supply_ignore_list] [power_supply_ignore_list]
@ -224,13 +224,13 @@ mouse_battery = "hid-12:34:56:78:90:ab-battery"
## Advanced Features ## Advanced Features
Those are the more advanced features of Superfreq that some users might be more Those are the more advanced features of Watt that some users might be more
inclined to use than others. If you have a use-case that is not covered, please inclined to use than others. If you have a use-case that is not covered, please
create an issue. create an issue.
### Dynamic Turbo Boost Management ### Dynamic Turbo Boost Management
When using `turbo = "auto"` with `enable_auto_turbo = true`, Superfreq When using `turbo = "auto"` with `enable_auto_turbo = true`, Watt
dynamically controls CPU turbo boost based on: dynamically controls CPU turbo boost based on:
- **CPU Load Thresholds**: Enables turbo when load exceeds `load_threshold_high` - **CPU Load Thresholds**: Enables turbo when load exceeds `load_threshold_high`
@ -260,16 +260,16 @@ The table below explains how different combinations of `turbo` and
| ------------------ | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | | ------------------ | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `turbo = "always"` | **Always enabled**<br>Turbo is always active regardless of CPU load or temperature | **Always enabled**<br>Turbo is always active regardless of CPU load or temperature | | `turbo = "always"` | **Always enabled**<br>Turbo is always active regardless of CPU load or temperature | **Always enabled**<br>Turbo is always active regardless of CPU load or temperature |
| `turbo = "never"` | **Always disabled**<br>Turbo is always disabled regardless of CPU load or temperature | **Always disabled**<br>Turbo is always disabled regardless of CPU load or temperature | | `turbo = "never"` | **Always disabled**<br>Turbo is always disabled regardless of CPU load or temperature | **Always disabled**<br>Turbo is always disabled regardless of CPU load or temperature |
| `turbo = "auto"` | **Dynamically managed**<br>Superfreq enables/disables turbo based on CPU load and temperature thresholds | **System default**<br>Turbo is reset to system's default enabled state and is managed by the hardware/kernel | | `turbo = "auto"` | **Dynamically managed**<br>Watt enables/disables turbo based on CPU load and temperature thresholds | **System default**<br>Turbo is reset to system's default enabled state and is managed by the hardware/kernel |
> [!NOTE] > [!NOTE]
> When `turbo = "auto"` and `enable_auto_turbo = false`, Superfreq ensures that > When `turbo = "auto"` and `enable_auto_turbo = false`, Watt ensures that
> any previous turbo state restrictions are removed, allowing the > any previous turbo state restrictions are removed, allowing the
> hardware/kernel to manage turbo behavior according to its default algorithms. > hardware/kernel to manage turbo behavior according to its default algorithms.
### Adaptive Polling ### Adaptive Polling
Superfreq includes a "sophisticated" (euphemism for complicated) adaptive Watt includes a "sophisticated" (euphemism for complicated) adaptive
polling system to try and maximize power efficiency polling system to try and maximize power efficiency
- **Battery Discharge Analysis** - Automatically adjusts polling frequency based - **Battery Discharge Analysis** - Automatically adjusts polling frequency based
@ -294,7 +294,7 @@ idle periods, while maintaining responsiveness when needed.
### Power Supply Filtering ### Power Supply Filtering
Configure Superfreq to ignore certain power supplies (like peripheral batteries) Configure Watt to ignore certain power supplies (like peripheral batteries)
that might interfere with power state detection. that might interfere with power state detection.
## Troubleshooting ## Troubleshooting
@ -319,11 +319,11 @@ Not all features are available on all hardware:
2. **CPU frequencies fluctuating**: May be due to thermal throttling 2. **CPU frequencies fluctuating**: May be due to thermal throttling
3. **Missing CPU information**: Verify kernel module support for your CPU 3. **Missing CPU information**: Verify kernel module support for your CPU
While reporting issues, please attach the results from `superfreq debug`. While reporting issues, please attach the results from `watt debug`.
## Contributing ## Contributing
Contributions to Superfreq are always welcome! Whether it's bug reports, feature Contributions to Watt are always welcome! Whether it's bug reports, feature
requests, or code contributions, please feel free to contribute. requests, or code contributions, please feel free to contribute.
> [!NOTE] > [!NOTE]
@ -357,5 +357,5 @@ before committing to catch possible code smell early.
## License ## License
Superfreq is available under [Mozilla Public License v2.0](LICENSE) for your Watt is available under [Mozilla Public License v2.0](LICENSE) for your
convenience, and at our expense. Please see the license file for more details. convenience, and at our expense. Please see the license file for more details.

View file

@ -14,16 +14,16 @@
}); });
in { in {
overlays = { overlays = {
superfreq = final: _: { watt = final: _: {
superfreq = final.callPackage ./nix/package.nix {}; watt = final.callPackage ./nix/package.nix {};
}; };
default = self.overlays.superfreq; default = self.overlays.watt;
}; };
packages = packages =
nixpkgs.lib.mapAttrs (system: pkgs: { nixpkgs.lib.mapAttrs (system: pkgs: {
inherit (pkgs) superfreq; inherit (pkgs) watt;
default = self.packages.${system}.superfreq; default = self.packages.${system}.watt;
}) })
pkgsForEach; pkgsForEach;
@ -34,8 +34,8 @@
pkgsForEach; pkgsForEach;
nixosModules = { nixosModules = {
superfreq = import ./nix/module.nix inputs; watt = import ./nix/module.nix inputs;
default = self.nixosModules.superfreq; default = self.nixosModules.watt;
}; };
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);

View file

@ -10,32 +10,32 @@ inputs: {
inherit (lib.lists) optional; inherit (lib.lists) optional;
inherit (lib.meta) getExe; inherit (lib.meta) getExe;
cfg = config.services.superfreq; cfg = config.services.watt;
format = pkgs.formats.toml {}; format = pkgs.formats.toml {};
cfgFile = format.generate "superfreq-config.toml" cfg.settings; cfgFile = format.generate "watt-config.toml" cfg.settings;
in { in {
options.services.superfreq = { options.services.watt = {
enable = mkEnableOption "Automatic CPU speed & power optimizer for Linux"; enable = mkEnableOption "Automatic CPU speed & power optimizer for Linux";
package = mkPackageOption inputs.self.packages.${pkgs.stdenv.system} "superfreq" { package = mkPackageOption inputs.self.packages.${pkgs.stdenv.system} "watt" {
pkgsText = "self.packages.\${pkgs.stdenv.system}"; pkgsText = "self.packages.\${pkgs.stdenv.system}";
}; };
settings = mkOption { settings = mkOption {
default = {}; default = {};
type = submodule {freeformType = format.type;}; type = submodule {freeformType = format.type;};
description = "Configuration for Superfreq."; description = "Configuration for Watt.";
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [cfg.package]; environment.systemPackages = [cfg.package];
# This is necessary for the Superfreq CLI. The environment variable # This is necessary for the Watt CLI. The environment variable
# passed to the systemd service will take priority in read order. # passed to the systemd service will take priority in read order.
environment.etc."superfreq.toml".source = cfgFile; environment.etc."watt.toml".source = cfgFile;
systemd.services.superfreq = { systemd.services.watt = {
wantedBy = ["multi-user.target"]; wantedBy = ["multi-user.target"];
conflicts = [ conflicts = [
"auto-cpufreq.service" "auto-cpufreq.service"
@ -45,12 +45,12 @@ in {
"thermald.service" "thermald.service"
]; ];
serviceConfig = { serviceConfig = {
Environment = optional (cfg.settings != {}) ["SUPERFREQ_CONFIG=${cfgFile}"]; Environment = optional (cfg.settings != {}) ["WATT_CONFIG=${cfgFile}"];
WorkingDirectory = ""; WorkingDirectory = "";
ExecStart = "${getExe cfg.package} daemon --verbose"; ExecStart = "${getExe cfg.package} daemon --verbose";
Restart = "on-failure"; Restart = "on-failure";
RuntimeDirectory = "superfreq"; RuntimeDirectory = "watt";
RuntimeDirectoryMode = "0755"; RuntimeDirectoryMode = "0755";
}; };
}; };
@ -60,14 +60,14 @@ in {
assertion = !config.services.power-profiles-daemon.enable; assertion = !config.services.power-profiles-daemon.enable;
message = '' message = ''
You have set services.power-profiles-daemon.enable = true; You have set services.power-profiles-daemon.enable = true;
which conflicts with Superfreq. which conflicts with Watt.
''; '';
} }
{ {
assertion = !config.services.auto-cpufreq.enable; assertion = !config.services.auto-cpufreq.enable;
message = '' message = ''
You have set services.auto-cpufreq.enable = true; You have set services.auto-cpufreq.enable = true;
which conflicts with Superfreq. which conflicts with Watt.
''; '';
} }
]; ];

View file

@ -5,7 +5,7 @@
fs = lib.fileset; fs = lib.fileset;
in in
rustPlatform.buildRustPackage (finalAttrs: { rustPlatform.buildRustPackage (finalAttrs: {
pname = "superfreq"; pname = "watt";
version = "0.1.0"; version = "0.1.0";
src = fs.toSource { src = fs.toSource {
@ -24,14 +24,14 @@ in
meta = { meta = {
description = "Automatic CPU speed & power optimizer for Linux"; description = "Automatic CPU speed & power optimizer for Linux";
longDescription = '' longDescription = ''
Superfreq is a CPU speed & power optimizer for Linux. It uses Watt is a CPU speed & power optimizer for Linux. It uses
the CPU frequency scaling driver to set the CPU frequency the CPU frequency scaling driver to set the CPU frequency
governor and the CPU power management driver to set the CPU governor and the CPU power management driver to set the CPU
power management mode. power management mode.
''; '';
homepage = "https://github.com/NotAShelf/superfreq"; homepage = "https://github.com/NotAShelf/watt";
mainProgram = "superfreq"; mainProgram = "watt";
license = lib.licenses.mpl20; license = lib.licenses.mpl20;
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
}; };

View file

@ -8,7 +8,7 @@ use std::time::Duration;
/// Prints comprehensive debug information about the system /// Prints comprehensive debug information about the system
pub fn run_debug(config: &AppConfig) -> Result<(), AppError> { pub fn run_debug(config: &AppConfig) -> Result<(), AppError> {
println!("=== SUPERFREQ DEBUG INFORMATION ==="); println!("=== WATT DEBUG INFORMATION ===");
println!("Version: {}", env!("CARGO_PKG_VERSION")); println!("Version: {}", env!("CARGO_PKG_VERSION"));
// Current date and time // Current date and time
@ -190,11 +190,11 @@ pub fn run_debug(config: &AppConfig) -> Result<(), AppError> {
println!("\n--- DAEMON STATUS ---"); println!("\n--- DAEMON STATUS ---");
// Simple check for daemon status - can be expanded later // Simple check for daemon status - can be expanded later
let daemon_status = fs::metadata("/var/run/superfreq.pid").is_ok(); let daemon_status = fs::metadata("/var/run/watt.pid").is_ok();
println!("Daemon Running: {daemon_status}"); println!("Daemon Running: {daemon_status}");
// Check for systemd service status // Check for systemd service status
if let Ok(systemd_status) = is_systemd_service_active("superfreq") { if let Ok(systemd_status) = is_systemd_service_active("watt") {
println!("Systemd Service Active: {systemd_status}"); println!("Systemd Service Active: {systemd_status}");
} }

View file

@ -32,26 +32,26 @@ pub fn load_config_from_path(specific_path: Option<&str>) -> Result<AppConfig, C
))); )));
} }
// Check for SUPERFREQ_CONFIG environment variable // Check for WATT_CONFIG environment variable
if let Ok(env_path) = std::env::var("SUPERFREQ_CONFIG") { if let Ok(env_path) = std::env::var("WATT_CONFIG") {
let env_path = Path::new(&env_path); let env_path = Path::new(&env_path);
if env_path.exists() { if env_path.exists() {
println!( println!(
"Loading config from SUPERFREQ_CONFIG: {}", "Loading config from WATT_CONFIG: {}",
env_path.display() env_path.display()
); );
return load_and_parse_config(env_path); return load_and_parse_config(env_path);
} }
eprintln!( eprintln!(
"Warning: Config file specified by SUPERFREQ_CONFIG not found: {}", "Warning: Config file specified by WATT_CONFIG not found: {}",
env_path.display() env_path.display()
); );
} }
// System-wide paths // System-wide paths
let config_paths = vec![ let config_paths = vec![
PathBuf::from("/etc/xdg/superfreq/config.toml"), PathBuf::from("/etc/xdg/watt/config.toml"),
PathBuf::from("/etc/superfreq.toml"), PathBuf::from("/etc/watt.toml"),
]; ];
for path in config_paths { for path in config_paths {

View file

@ -1,4 +1,4 @@
// Configuration types and structures for superfreq // Configuration types and structures for Watt
use crate::core::TurboSetting; use crate::core::TurboSetting;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::convert::TryFrom; use std::convert::TryFrom;

View file

@ -152,7 +152,7 @@ fn get_available_governors() -> Result<Vec<String>> {
// First try the traditional path with cpu0. This is the most common case // First try the traditional path with cpu0. This is the most common case
// and will usually catch early, but we should try to keep the code to handle // and will usually catch early, but we should try to keep the code to handle
// "edge" cases lightweight, for the (albeit smaller) number of users that // "edge" cases lightweight, for the (albeit smaller) number of users that
// run Superfreq on unusual systems. // run Watt on unusual systems.
let cpu0_path = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors"; let cpu0_path = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors";
if Path::new(cpu0_path).exists() { if Path::new(cpu0_path).exists() {
let content = fs::read_to_string(cpu0_path).map_err(|e| { let content = fs::read_to_string(cpu0_path).map_err(|e| {
@ -546,12 +546,12 @@ pub fn get_platform_profiles() -> Result<Vec<String>> {
} }
/// Path for storing the governor override state /// Path for storing the governor override state
const GOVERNOR_OVERRIDE_PATH: &str = "/etc/xdg/superfreq/governor_override"; const GOVERNOR_OVERRIDE_PATH: &str = "/etc/xdg/watt/governor_override";
/// Force a specific CPU governor or reset to automatic mode /// Force a specific CPU governor or reset to automatic mode
pub fn force_governor(mode: GovernorOverrideMode) -> Result<()> { pub fn force_governor(mode: GovernorOverrideMode) -> Result<()> {
// Create directory if it doesn't exist // Create directory if it doesn't exist
let dir_path = Path::new("/etc/xdg/superfreq"); let dir_path = Path::new("/etc/xdg/watt");
if !dir_path.exists() { if !dir_path.exists() {
fs::create_dir_all(dir_path).map_err(|e| { fs::create_dir_all(dir_path).map_err(|e| {
if e.kind() == io::ErrorKind::PermissionDenied { if e.kind() == io::ErrorKind::PermissionDenied {
@ -605,7 +605,7 @@ pub fn force_governor(mode: GovernorOverrideMode) -> Result<()> {
println!( println!(
"Governor override set to '{governor}'. This setting will persist across reboots." "Governor override set to '{governor}'. This setting will persist across reboots."
); );
println!("To reset, use: superfreq force-governor reset"); println!("To reset, use: watt force-governor reset");
Ok(()) Ok(())
} }
} }

View file

@ -421,7 +421,7 @@ pub fn run_daemon(config: AppConfig, verbose: bool) -> Result<(), AppError> {
// Update the log level filter if needed, without re-initializing the logger // Update the log level filter if needed, without re-initializing the logger
log::set_max_level(level_filter); log::set_max_level(level_filter);
info!("Starting superfreq daemon..."); info!("Starting Watt daemon...");
// Validate critical configuration values before proceeding // Validate critical configuration values before proceeding
if let Err(err) = validate_poll_intervals( if let Err(err) = validate_poll_intervals(

View file

@ -228,7 +228,7 @@ pub fn determine_and_apply_settings(
manage_auto_turbo(report, selected_profile_config, on_ac_power)?; manage_auto_turbo(report, selected_profile_config, on_ac_power)?;
} else { } else {
debug!( debug!(
"Superfreq's dynamic turbo management is disabled by configuration. Ensuring system uses its default behavior for automatic turbo control." "Watt's dynamic turbo management is disabled by configuration. Ensuring system uses its default behavior for automatic turbo control."
); );
// Make sure the system is set to its default automatic turbo mode. // Make sure the system is set to its default automatic turbo mode.
// This is important if turbo was previously forced off. // This is important if turbo was previously forced off.

View file

@ -413,7 +413,7 @@ fn main() -> Result<(), AppError> {
Some(Commands::Daemon { verbose }) => daemon::run_daemon(config, verbose), Some(Commands::Daemon { verbose }) => daemon::run_daemon(config, verbose),
Some(Commands::Debug) => cli::debug::run_debug(&config), Some(Commands::Debug) => cli::debug::run_debug(&config),
None => { None => {
info!("Welcome to superfreq! Use --help for commands."); info!("Welcome to Watt! Use --help for commands.");
debug!("Current effective configuration: {config:?}"); debug!("Current effective configuration: {config:?}");
Ok(()) Ok(())
} }