Comment out flags header in default config file + fix bug causing deprecated warnings if `[flags]` was uncommented even when the fields themselves were commented out.
This change moves some options to a more appropriate section for the config file. This only deprecates the old options for now, so they're still valid, but we will remove them later (maybe after the next stable release, to give warning).
One thing I want to do for the legend position options is maybe expand it, and now is the best time to do so, but for now I'm just copying it over verbatim.
The deprecated options will also emit a warning to stderr.
This PR also contains a driveby to alias `[network]` to `[network_graph]`.
<!-- Please use this template (unless you have a very good reason not
to). PRs that do not use the template may be closed. -->
## Description
_A description of the change, what it does, and why it was made. If
relevant (e.g. UI changes), **please also provide
screenshots/recordings**:_
Rename a bunch of code/struct field names to use "colour". Note this
should have no functional change to config settings as I was already
aliasing "colour" for "color" settings, this just flips it internally.
As for why, I'm Canadian, I grew up spelling it this way, sorry.
## Issue
_If applicable, what issue does this address?_
Closes: #<issue-number>
## Testing
_If relevant, please state how this was tested (including steps):_
_If this change affects the program, please also indicate which
platforms were tested:_
- [ ] _Windows_
- [ ] _macOS (specify version below)_
- [x] _Linux (specify distro below)_
- [ ] _Other (specify below)_
## Checklist
_Ensure **all** of these are met:_
- [x] _If this PR adds or changes a dependency, please justify this in
the description_
- [x] _If this is a code change, areas your change affects have been
linted using (`cargo fmt`)_
- [x] _If this is a code change, your changes pass `cargo clippy --all
-- -D warnings`_
- [x] _If this is a code change, new tests were added if relevant_
- [x] _If this is a code change, your changes pass `cargo test`_
- [x] _The change has been tested to work (see above) and doesn't appear
to break other things_
- [x] _Documentation has been updated if needed (`README.md`, help menu,
docs, configs, etc.)_
- [x] _There are no merge conflicts_
- [x] _You have reviewed your changes first_
- [x] _The pull request passes the provided CI pipeline_
## Other
_Anything else that maintainers should know about this PR:_
## Description
You can now tell bottom which column the process widget should be sorted
by at startup, instead of always falling back to CPU%.
It's settable in two places: a `default_sort` field under `[processes]`
in the config file, and a `--process_default_sort` CLI flag. The flag
accepts the same column-name aliases that already work in
`[processes].columns` (e.g. `cpu%`, `mem`, `pid`, `name`, `read`,
`t.write`, etc.), and the CLI flag wins over the config setting.
```toml
[processes]
default_sort = "mem"
```
```
btm --process_default_sort mem
```
This piggybacks on the same wiring that #2003 added for the disk and
temperature widgets, just routed through the existing `ProcTableConfig`
so the widget initializer can pick a non-default sort index without
touching any of the runtime sort code.
A few small things worth flagging:
- If the configured column is not actually present in the user's
`columns` list, the widget falls back to the existing default behaviour
(CPU% in normal/grouped mode, PID in tree mode) instead of silently
snapping to column 0. That keeps misconfiguration predictable.
- The deserializer for `ProcColumn` was refactored to share its parsing
with the CLI's value parser, so config-file and CLI accept the exact
same aliases. The set of accepted strings is unchanged from before.
I checked the `# columns =` workaround floating around in #810 and on
Stack Overflow; it changes layout but not the sort key, so it doesn't
actually solve the original ask.
## Issue
Closes: #810
## Testing
_If this change affects the program, please also indicate which
platforms were tested:_
- [ ] _Windows_
- [ ] _macOS (specify version below)_
- [x] _Linux (Kali, kernel 6.19)_
- [ ] _Other (specify below)_
Added unit tests for `ProcWidgetState::new` covering the happy path
(sort index actually lands on the configured column) and the fallback
path (configured column not in the column list). Also added valid +
invalid config integration tests under `tests/valid_configs/` and
`tests/invalid_configs/`, matching the pattern used for the disk/temp
default-sort tests.
`cargo test`, `cargo clippy --all -- -D warnings`, and `cargo fmt
--check` are all clean.
Manual smoke test: ran `btm --process_default_sort=mem` and `btm
--process_default_sort=garbage`. The first starts the widget sorted by
Mem%, the second exits early with `'garbage' is not a valid process
column for --process_default_sort` from the args layer. Also ran `btm -C
tests/valid_configs/proc_default_sort.toml` to confirm the config-file
path works the same way.
## Checklist
_Ensure **all** of these are met:_
- [x] _If this PR adds or changes a dependency, please justify this in
the description_ (no new deps)
- [x] _If this is a code change, areas your change affects have been
linted using (`cargo fmt`)_
- [x] _If this is a code change, your changes pass `cargo clippy --all
-- -D warnings`_
- [x] _If this is a code change, new tests were added if relevant_
- [x] _If this is a code change, your changes pass `cargo test`_
- [x] _The change has been tested to work (see above) and doesn't appear
to break other things_
- [x] _Documentation has been updated if needed (`README.md`, help menu,
docs, configs, etc.)_
- [x] _There are no merge conflicts_
- [x] _You have reviewed your changes first_
- [x] _The pull request passes the provided CI pipeline_
## Other
The schema under `schema/nightly/bottom.json` was regenerated via `cargo
run --features generate_schema --bin schema`; the only diff is the new
`default_sort` entry on `ProcessesConfig`, mirroring what's already
there on `DiskConfig` and `TemperatureConfig`.
---------
Co-authored-by: ClementTsang <dev@cjhtsang.ca>
Add support for a temperature graph widget. Quick-and-dirty implementation for now, will clean this up with other widgets later (maybe after adding a disk graph widget).
This PR replaces the `hide_table_gap` option with a new `table_gap` option that controls whether a space is drawn, a line is drawn, or nothing is drawn.
* feature: add global bg_color option
* period
* fmt
* oops, format again
* update default config + schema
* rename field + apply it to dialogs
* update dialog to just draw once
* handle basic
* add test + some small tweaks
---------
Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
This PR adds a vhs "tape" file to automatically do the demo gif
recording. The point of this is to make it more consistent/easy to do,
and this has the benefit of making a smaller gif file.
* hide k-threads init
comment
* add config for hide_k_threads
arg help
* update docs for hide_k_threads
* add test_toggle_k_thread for process_table
* update help text and schema
* add hide_k_threads to sample_configs default
* add Virt column to sample default config
* update sample demo config column name for schema ci
* force_rerender_and_update from toggle_k_threads for updates when frozen
* use is_kernel for ProcessType
* remove todo
* Apply suggestions from code review
Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
---------
Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
* add no key setting
* do it here instead of in main loop
* add a warning
* docs: update a bunch of docs with features
* linux-only test
* oop
* skip field check for other os
* oop
* easier way of doing it
* use dead code
* oop
* huh guess I don't need it
* docs: update things to reference 0.11.0 in prep for release
Things still missing:
- Update schema
- Release notes
- Any doc site updates?
- Any GIF updates?
- Take a pass over README?
* update schema with 0.11
* update schema with virt
* update
* update date
* an attempt and failure to update the gif
* bump freebsd
* bump
* I swear
* okay so no freebsd 15, got it
* fmt
* temp work
* get yes/no working
* cleanup
* fill out some more buttons
* conditional compilation
* update
* update docs
* wait this just works
* like 80% of the way there
* some stuff around the killing screen
* mouse works
* done!
* clippy
* more stuff
* fix some imports for windows
* android fixes
* oop
* ahh
* hmm
I had changed how this was parsed in-code but I forgot to update the default configs. This also adds some e2e tests to hopefully catch this all for real in the future, since the schema ones don't catch this stuff and the constants test doesn't actually run the binary for a proper e2e test.
Updates some outdated docs on filtering, and adds some tests as well. In particular, this also adds a cfg_attr on tests to try and catch unknown fields; we'll be more lenient in prod builds though and allow them.
* Add gpu util, power and procs.
Consolidated gpu calls into `data_harvester`.
Changed config flag from `enable_gpu_memory` to `enable_gpu`.
Added GPU utilization to the cpu widget.
Added GPU process memory usage and utilization percentage to the proc widget.
Added key binds for gpu process toggling.
Added GPU power usage to the battery widget.
Added bounds check to battery widget header.
Show battery widget header when `gpu_enable`.
Added feature flag `legacy-functions` to `nvml-wrapper`.
updated config file(s).
updated help text.
updated docs.
* Code Review:
Remove GPU util from cpu widget
Remove GPU power from battery widget
Use reference for gpu widgets_to_harvest
Extract match arm to function for feature gate
* Code Review: add gmem% toggle
* Do not poll gpu temp when filtered
* Code Review Two Changes:
adjust doc wordings
remove extra references
remove extra widget harvest checks
init proc gpu values
use convert_temp_unit for gpu temp
* update documentation and support either numerical times or human times for time_delta and default_time_value
* update docs
* give more human times on error
* First implementation of cache memory data collection, mostly copied from RAM and swap implementations
* First implementation of cache memory display, copied from RAM and swap implementations. placed cache as second in the list as it is more similar to the RAM than any other item in the list
* expanded comment to explain method.
* rustfmt
* all cache-related code excluded on windows, in the process refactored src/data_conversion.rs convert_mem_label() to convert a single label instead of all at once
* better factoring-out of cache memory logic to allow individual disabling
* added --enable_cache_memory flag, disabled cache memory collection by default
* renamed CCH to CHE
not sure how i messed that up
* changelog updated
* Added command line flag documentation
* updated config file documentation
* specified that buffer and cache memory display does not work on windows
* resolved merge conflicts
* added documentation to cache memory data collection
* capitalized Windows
* implemented missing canvas styling logic
* fixed misplaced no-windows flag
* reduced colour collisions, as cache colour was the same as the first GPU colour
* made FIFTH_COLOUR constant windows-only
* Revert "made FIFTH_COLOUR constant windows-only"
This reverts commit 72698f1dd7.
* made FIFTH_COLOUR constant non-windows-only
* minor fix for basic mode row count
* Update src/app/data_harvester/memory/sysinfo.rs
Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
* Update src/canvas/widgets/mem_basic.rs
Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
* updated default_config.toml
* formatting
---------
Co-authored-by: ClementTsang <34804052+ClementTsang@users.noreply.github.com>