Skip to content

Conversation

ClementTsang
Copy link
Owner

Description

A description of the change, what it does, and why it was made. If relevant (such as any change that modifies the UI), please provide screenshots of the changes:

(Supersedes #1627 due to issues with adding a change, credits to @Bucket-Bucket-Bucket)

Adds a command line option and config file option to have the process tree view have all entries collapsed by default.

Issue

If applicable, what issue does this address?

Closes: #1612

Testing

If relevant, please state how this was tested. All changes must be tested to work:

If this is a code change, please also indicate which platforms were tested:

  • Windows
  • macOS
  • Linux

Checklist

If relevant, ensure the following have been met:

  • Areas your change affects have been linted using rustfmt (cargo fmt)
  • The change has been tested and doesn't appear to cause any unintended breakage
  • Documentation has been added/updated if needed (README.md, help menu, doc pages, etc.)
  • The pull request passes the provided CI pipeline
  • There are no merge conflicts
  • If relevant, new tests were added (don't worry too much about coverage)

@ClementTsang ClementTsang requested a review from Copilot August 3, 2025 06:03
Copilot

This comment was marked as outdated.

@ClementTsang ClementTsang marked this pull request as ready for review August 3, 2025 06:04
Copy link

codecov bot commented Aug 3, 2025

Codecov Report

❌ Patch coverage is 75.25773% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.55%. Comparing base (51c67ee) to head (18d42e1).

Files with missing lines Patch % Lines
src/widgets/process_table.rs 76.92% 21 Missing ⚠️
src/app.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1770       +/-   ##
===========================================
+ Coverage   41.97%   53.55%   +11.57%     
===========================================
  Files         115      115               
  Lines       15960    16030       +70     
===========================================
+ Hits         6700     8585     +1885     
+ Misses       9260     7445     -1815     
Flag Coverage Δ
macos-14 37.40% <75.25%> (+0.29%) ⬆️
ubuntu-latest 55.73% <75.25%> (+12.17%) ⬆️
windows-2022 37.78% <75.25%> (+0.30%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ClementTsang ClementTsang requested a review from Copilot August 3, 2025 06:06
Copilot

This comment was marked as outdated.

@ClementTsang ClementTsang requested a review from Copilot August 3, 2025 06:27
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds functionality to collapse process tree entries by default, providing both command-line and configuration file options to control this behavior. The implementation introduces a new TreeCollapsed enum that handles both default-collapsed and default-expanded states, replacing the previous simple HashSet<Pid> approach.

Key changes:

  • Introduction of TreeCollapsed enum to manage collapse/expand state with different default behaviors
  • Addition of --tree_collapse command-line flag and tree_collapse config option
  • Refactoring of process tree logic to use the new state management system

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/widgets/process_table.rs Core implementation of TreeCollapsed enum and refactoring of tree mode logic
src/options/config/flags.rs Addition of tree_collapse config field
src/options/args.rs Addition of --tree_collapse command-line argument
src/options.rs Integration of tree collapse option into app configuration
src/app.rs Updates to use new tree collapse configuration when switching modes
docs/content/configuration/config-file/flags.md Documentation for new config option
docs/content/configuration/command-line-options.md Documentation for new command-line flag
CHANGELOG.md Entry documenting the new feature

@ClementTsang
Copy link
Owner Author

Note to self: update schema.

@ClementTsang
Copy link
Owner Author

Also, add @all-contributors please add @Bucket-Bucket-Bucket for code

Copy link
Contributor

@ClementTsang

I've put up a pull request to add @Bucket-Bucket-Bucket! 🎉

@ClementTsang ClementTsang enabled auto-merge (squash) August 4, 2025 23:29
@ClementTsang ClementTsang merged commit 2132da2 into main Aug 4, 2025
11 checks passed
@ClementTsang ClementTsang deleted the collapse-tree-by-default branch August 4, 2025 23:29
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Aug 6, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ClementTsang/bottom](https://github.com/ClementTsang/bottom) | minor | `0.10.2` -> `0.11.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>ClementTsang/bottom (ClementTsang/bottom)</summary>

### [`v0.11.0`](https://github.com/ClementTsang/bottom/blob/HEAD/CHANGELOG.md#0110---2025-08-05)

[Compare Source](ClementTsang/bottom@0.10.2...0.11.0)

##### Features

- [#&#8203;1625](ClementTsang/bottom#1625): Add the ability to configure the disk widget's table columns.
- [#&#8203;1641](ClementTsang/bottom#1641) + [#&#8203;1692](ClementTsang/bottom#1692): Support AMD GPU data collection on Linux.
- [#&#8203;1642](ClementTsang/bottom#1642): Support changing the widget borders.
- [#&#8203;1717](ClementTsang/bottom#1717): Support delete key (fn + delete on macOS) to kill processes.
- [#&#8203;1306](ClementTsang/bottom#1306): Support using left/right key to collapse/expand process trees respectively.
- [#&#8203;1767](ClementTsang/bottom#1767): Add a virtual memory column for processes.
- [#&#8203;1770](ClementTsang/bottom#1770) (originally [#&#8203;1627](ClementTsang/bottom#1627)): Add option to have process tree entries be collapsed by default.

##### Bug Fixes

- [#&#8203;1551](ClementTsang/bottom#1551): Fix missing parent section names in default config.
- [#&#8203;1552](ClementTsang/bottom#1552): Fix typo in default config.
- [#&#8203;1565](ClementTsang/bottom#1565): Fix issue where CPU usage in basic mode looks weird if core count isn't divisible by four.
- [#&#8203;1578](ClementTsang/bottom#1578): Fix missing selected text background colour in `default-light` theme.
- [#&#8203;1593](ClementTsang/bottom#1593): Fix using `"none"` for chart legend position in configs.
- [#&#8203;1594](ClementTsang/bottom#1594): Fix incorrect default config definitions for chart legends.
- [#&#8203;1596](ClementTsang/bottom#1596): Fix support for nilfs2 file system.
- [#&#8203;1660](ClementTsang/bottom#1660): Fix properly cleaning up the terminal if the program is terminated due to an `Err` bubbling to the top.
- [#&#8203;1663](ClementTsang/bottom#1663): Fix network graphs using log scaling having broken lines when a point was 0.
- [#&#8203;1667](ClementTsang/bottom#1667): Fix for ARC/SWAP not being hidden in basic mode after refactor.
- [#&#8203;1683](ClementTsang/bottom#1683): Fix graph lines potentially showing up behind legends.
- [#&#8203;1701](ClementTsang/bottom#1701): Fix process kill dialog occasionally causing panics.
- [#&#8203;1755](ClementTsang/bottom#1755): Fix missing stats/incorrect mount name for certain entries in the disk widget.
- [#&#8203;1759](ClementTsang/bottom#1759): Fix increment for data tables if the change is greater than the number of entries left.

##### Changes

- [#&#8203;1559](ClementTsang/bottom#1559): Rename `--enable_gpu` to `--disable_gpu`, and make GPU features enabled by default.
- [#&#8203;1570](ClementTsang/bottom#1570): Consider `$XDG_CONFIG_HOME` on macOS when looking for a default config path in a backwards-compatible fashion.
- [#&#8203;1686](ClementTsang/bottom#1686): Allow hyphenated arguments to work as well (e.g. `--autohide-time`).
- [#&#8203;1701](ClementTsang/bottom#1701): Redesign process kill dialog.
- [#&#8203;1706](ClementTsang/bottom#1706): Disable mouse capture when `disable_click` is set.
- [#&#8203;1769](ClementTsang/bottom#1769): Change how we calculate swap usage in Windows.

##### Other

- [#&#8203;1655](ClementTsang/bottom#1655): Better handle NVIDIA GPUs on Linux with only libnvidia-ml.so.1.
- [#&#8203;1658](ClementTsang/bottom#1658): Make it possible to override completion/manpage generation output directory via env.
- [#&#8203;1663](ClementTsang/bottom#1663): Rework how data is stored internally, reducing memory usage a bit.
- [#&#8203;1749](ClementTsang/bottom#1749): Fix invalid desktop file values.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS41My4xIiwidXBkYXRlZEluVmVyIjoiNDEuNTMuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collapse process tree view by default?
2 participants