diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cc74a93..320b46d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,10 @@ That said, these are more guidelines rather than hardset rules, though the proje - [#1551](https://github.com/ClementTsang/bottom/pull/1551): Fix missing parent section names in default config. - [#1552](https://github.com/ClementTsang/bottom/pull/1552): Fix typo in default config. +### Changes + +- [#1559](https://github.com/ClementTsang/bottom/pull/1559): Rename `--enable_gpu` to `--disable_gpu`, and make GPU features enabled by default. + ## [0.10.2] - 2024-08-05 ### Features diff --git a/docs/content/configuration/command-line-options.md b/docs/content/configuration/command-line-options.md index 7f792315..04c8f774 100644 --- a/docs/content/configuration/command-line-options.md +++ b/docs/content/configuration/command-line-options.md @@ -79,9 +79,9 @@ see information on these options by running `btm -h`, or run `btm --help` to dis ## GPU Options -| Option | Behaviour | -| -------------- | ------------------------------------------- | -| `--enable_gpu` | Enable collecting and displaying GPU usage. | +| Option | Behaviour | +| --------------- | --------------------------------------------------------- | +| `--disable_gpu` | Disable collecting and displaying NVIDIA GPU information. | ## Style Options diff --git a/docs/content/configuration/config-file/flags.md b/docs/content/configuration/config-file/flags.md index 18d3ee2c..9dd3edd0 100644 --- a/docs/content/configuration/config-file/flags.md +++ b/docs/content/configuration/config-file/flags.md @@ -44,7 +44,7 @@ each time: | `network_use_binary_prefix` | Boolean | Displays the network widget with binary prefixes. | | `network_use_bytes` | Boolean | Displays the network widget using bytes. | | `network_use_log` | Boolean | Displays the network widget with a log scale. | -| `enable_gpu` | Boolean | Shows the GPU widgets. | +| `disable_gpu` | Boolean | Disable NVIDIA GPU data collection. | | `retention` | String (human readable time, such as "10m", "1h", etc.) | How much data is stored at once in terms of time. | | `unnormalized_cpu` | Boolean | Show process CPU% without normalizing over the number of cores. | | `expanded` | Boolean | Expand the default widget upon starting the app. | diff --git a/docs/content/usage/widgets/memory.md b/docs/content/usage/widgets/memory.md index 4304a3f7..edc8a407 100644 --- a/docs/content/usage/widgets/memory.md +++ b/docs/content/usage/widgets/memory.md @@ -13,7 +13,7 @@ If the total RAM or swap available is 0, then it is automatically hidden from th One can also adjust the displayed time range through either the keyboard or mouse, with a range of 30s to 600s. -This widget can also be configured to display Nvidia GPU memory usage (`--enable_gpu` on Linux/Windows) or cache memory usage (`--enable_cache_memory`). +This widget can also be configured to display Nvidia GPU memory usage (`--disable_gpu` on Linux/Windows to disable) or cache memory usage (`--enable_cache_memory`). ## Key bindings diff --git a/docs/content/usage/widgets/process.md b/docs/content/usage/widgets/process.md index 0c16dc02..485a785f 100644 --- a/docs/content/usage/widgets/process.md +++ b/docs/content/usage/widgets/process.md @@ -36,7 +36,7 @@ By default, the main process table displays the following information for each p [here](https://docs.rs/sysinfo/latest/sysinfo/struct.Process.html#method.disk_usage) for more details. -With the feature flag (`--enable_gpu` on Linux/Windows) and gpu process columns enabled in the configuration: +With the feature flag (`--disable_gpu` on Linux/Windows to disable) and gpu process columns enabled in the configuration: - GPU memory use percentage - GPU core utilization percentage diff --git a/docs/content/usage/widgets/temperature.md b/docs/content/usage/widgets/temperature.md index 3cadc9a8..dfb90f0b 100644 --- a/docs/content/usage/widgets/temperature.md +++ b/docs/content/usage/widgets/temperature.md @@ -10,7 +10,7 @@ The temperature widget provides a table of temperature sensors and their current The temperature widget provides the sensor name as well as its current temperature. -This widget can also be configured to display Nvidia GPU temperatures (`--enable_gpu` on Linux/Windows). +This widget can also be configured to display Nvidia GPU temperatures (`--disable_gpu` on Linux/Windows to disable). ## Key bindings diff --git a/sample_configs/default_config.toml b/sample_configs/default_config.toml index 4db7acde..8621bdf7 100644 --- a/sample_configs/default_config.toml +++ b/sample_configs/default_config.toml @@ -74,7 +74,7 @@ # Hides advanced options to stop a process on Unix-like systems. #disable_advanced_kill = false # Shows GPU(s) memory -#enable_gpu = false +#disable_gpu = false # Shows cache and buffer memory #enable_cache_memory = false # How much data is stored at once in terms of time. diff --git a/schema/README.md b/schema/README.md index b365e4f0..140cd095 100644 --- a/schema/README.md +++ b/schema/README.md @@ -9,6 +9,8 @@ behind a feature flag to avoid building unnecessary code for release builds, and cargo run --features="generate_schema" -- --generate_schema > schema/nightly/bottom.json ``` +Alternatively, run the script in `scripts/schema/generate.sh`, which does this for you. + ## Publication To publish these schemas, cut a new version by copying `nightly` to a new folder with a version number matching bottom's diff --git a/schema/nightly/bottom.json b/schema/nightly/bottom.json index 0e1f4b59..492078ed 100644 --- a/schema/nightly/bottom.json +++ b/schema/nightly/bottom.json @@ -318,6 +318,12 @@ "null" ] }, + "disable_gpu": { + "type": [ + "boolean", + "null" + ] + }, "dot_marker": { "type": [ "boolean", @@ -330,12 +336,6 @@ "null" ] }, - "disable_gpu": { - "type": [ - "boolean", - "null" - ] - }, "expanded": { "type": [ "boolean", diff --git a/scripts/schema/generate.sh b/scripts/schema/generate.sh new file mode 100755 index 00000000..656b51bb --- /dev/null +++ b/scripts/schema/generate.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +cd "$(dirname "$0")"; +cd ../.. + +cargo run --features="generate_schema" -- --generate_schema > schema/nightly/bottom.json diff --git a/src/options.rs b/src/options.rs index b75dd3ac..7e9b4cb5 100644 --- a/src/options.rs +++ b/src/options.rs @@ -811,6 +811,7 @@ fn get_enable_gpu(args: &BottomArgs, config: &Config) -> bool { if args.gpu.disable_gpu { return false; } + !config .flags .as_ref() diff --git a/src/options/args.rs b/src/options/args.rs index d6c554ee..e49cf16d 100644 --- a/src/options/args.rs +++ b/src/options/args.rs @@ -520,7 +520,7 @@ pub struct BatteryArgs { #[derive(Args, Clone, Debug, Default)] #[command(next_help_heading = "GPU Options", rename_all = "snake_case")] pub struct GpuArgs { - #[arg(long, action = ArgAction::SetTrue, help = "Disable collecting and displaying GPU usage.")] + #[arg(long, action = ArgAction::SetTrue, help = "Disable collecting and displaying NVIDIA GPU information.")] pub disable_gpu: bool, }