diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 5eb473f2..85c79338 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -79,7 +79,7 @@ body: It would also be helpful if you are not running [the latest version](https://github.com/ClementTsang/bottom/releases/latest) to try that as well to see if the issue has already been resolved. - placeholder: 0.9.7 + placeholder: 0.10.0 - type: textarea id: install diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f3bdb4e..568be5d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.10.0] - Unreleased +## [0.10.0] - 2024-08-01 ### Features @@ -47,7 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#1355](https://github.com/ClementTsang/bottom/pull/1355): Reduce chances of non-D0 devices waking up due to temperature checks on Linux. - [#1410](https://github.com/ClementTsang/bottom/pull/1410): Fix uptime calculation for Linux. -## [0.9.7] - 2023-08-26 +## [0.9.7] - 2024-07-26 ## Bug Fixes diff --git a/Cargo.lock b/Cargo.lock index fc2f75b1..d41e3825 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -243,9 +243,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" +checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" [[package]] name = "cfg-if" @@ -267,9 +267,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "clap" -version = "4.5.11" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3" +checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc" dependencies = [ "clap_builder", "clap_derive", @@ -277,9 +277,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.11" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa" +checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" dependencies = [ "anstream", "anstyle", @@ -290,9 +290,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.11" +version = "4.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ae69fbb0833c6fcd5a8d4b8609f108c7ad95fc11e248d853ff2c42a90df26a" +checksum = "a8670053e87c316345e384ca1f3eba3006fc6355ed8b8a1140d104e109e3df34" dependencies = [ "clap", ] @@ -319,9 +319,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.11" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -657,9 +657,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "indexmap" -version = "2.2.6" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" dependencies = [ "equivalent", "hashbrown", @@ -763,9 +763,9 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "lru" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" dependencies = [ "hashbrown", ] @@ -1267,11 +1267,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "4ab380d7d9f22ef3f21ad3e6c1ebe8e4fc7a2000ccba2e4d71fc96f15b2cb609" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -1355,9 +1356,9 @@ dependencies = [ [[package]] name = "signal-hook-mio" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" +checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" dependencies = [ "libc", "mio", @@ -1561,18 +1562,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.17" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9f8729f5aea9562aac1cc0441f5d6de3cff1ee0c5d67293eeca5eb36ee7c16" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ "indexmap", "serde", @@ -1928,9 +1929,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.16" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b480ae9340fc261e6be3e95a1ba86d54ae3f9171132a73ce8d4bbaf68339507c" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 9f269318..f15c4452 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,7 +82,7 @@ generate_schema = ["schemars", "serde_json", "strum"] anyhow = "1.0.86" backtrace = "0.3.73" cfg-if = "1.0.0" -clap = { version = "4.5.11", features = ["default", "cargo", "wrap_help", "derive"] } +clap = { version = "4.5.13", features = ["default", "cargo", "wrap_help", "derive"] } concat-string = "1.0.1" crossterm = "0.27.0" ctrlc = { version = "3.4.4", features = ["termination"] } @@ -148,8 +148,8 @@ predicates = "3.1.0" portable-pty = "0.8.1" [build-dependencies] -clap = { version = "4.5.11", features = ["default", "cargo", "wrap_help", "derive"] } -clap_complete = "4.5.11" +clap = { version = "4.5.13", features = ["default", "cargo", "wrap_help", "derive"] } +clap_complete = "4.5.12" clap_complete_nushell = "4.5.3" clap_complete_fig = "4.5.2" clap_mangen = "0.2.23" diff --git a/README.md b/README.md index 6392958e..d8e02c41 100644 --- a/README.md +++ b/README.md @@ -175,16 +175,16 @@ A `.deb` file is provided on each [stable release](https://github.com/ClementTsa ```bash # x86-64 -curl -LO https://github.com/ClementTsang/bottom/releases/download/0.9.7/bottom_0.9.7_amd64.deb -sudo dpkg -i bottom_0.9.7_amd64.deb +curl -LO https://github.com/ClementTsang/bottom/releases/download/0.10.0/bottom_0.10.0_amd64.deb +sudo dpkg -i bottom_0.10.0_amd64.deb # ARM64 -curl -LO https://github.com/ClementTsang/bottom/releases/download/0.9.7/bottom_0.9.7_arm64.deb -sudo dpkg -i bottom_0.9.7_arm64.deb +curl -LO https://github.com/ClementTsang/bottom/releases/download/0.10.0/bottom_0.10.0_arm64.deb +sudo dpkg -i bottom_0.10.0_arm64.deb # ARM -curl -LO https://github.com/ClementTsang/bottom/releases/download/0.9.7/bottom_0.9.7_armhf.deb -sudo dpkg -i bottom_0.9.7_armhf.deb +curl -LO https://github.com/ClementTsang/bottom/releases/download/0.10.0/bottom_0.10.0_armhf.deb +sudo dpkg -i bottom_0.10.0_armhf.deb ``` ### Exherbo Linux @@ -210,12 +210,12 @@ something like: ```bash # x86-64 -curl -LO https://github.com/ClementTsang/bottom/releases/download/0.9.7/bottom-0.9.7-1.x86_64.rpm -sudo rpm -i bottom-0.9.7-1.x86_64.rpm +curl -LO https://github.com/ClementTsang/bottom/releases/download/0.10.0/bottom-0.10.0-1.x86_64.rpm +sudo rpm -i bottom-0.10.0-1.x86_64.rpm # Nightly x86-64 -curl -LO https://github.com/ClementTsang/bottom/releases/download/nightly/bottom-0.9.7-1.x86_64.rpm -sudo rpm -i bottom-0.9.7-1.x86_64.rpm +curl -LO https://github.com/ClementTsang/bottom/releases/download/nightly/bottom-0.10.0-1.x86_64.rpm +sudo rpm -i bottom-0.10.0-1.x86_64.rpm ``` ### Gentoo @@ -326,8 +326,8 @@ to do so using the most recent version of stable Rust, which is how the binaries rustup update stable # Option 1 - Download from releases and install -curl -LO https://github.com/ClementTsang/bottom/archive/0.9.7.tar.gz -tar -xzvf 0.9.7.tar.gz +curl -LO https://github.com/ClementTsang/bottom/archive/0.10.0.tar.gz +tar -xzvf 0.10.0.tar.gz cargo install --path . --locked # Option 2 - Clone the repo and install manually diff --git a/schema/README.md b/schema/README.md index 2f767f8b..b365e4f0 100644 --- a/schema/README.md +++ b/schema/README.md @@ -1,7 +1,18 @@ -# Config Schema +# Config JSON Schema -## Usage +## Generation -## Development +These are automatically generated from code using [`schemars`](https://github.com/GREsau/schemars). They're locked +behind a feature flag to avoid building unnecessary code for release builds, and you can generate them like so: -### How to add a new version +```bash +cargo run --features="generate_schema" -- --generate_schema > schema/nightly/bottom.json +``` + +## Publication + +To publish these schemas, cut a new version by copying `nightly` to a new folder with a version number matching bottom's +(e.g. v0.10 if bottom is on v0.10.x bottom). Then, make a PR to [schemastore](https://github.com/SchemaStore/schemastore) +updating the catalog. + +For more info, see the schemastore repo. An example PR can be found [here](https://github.com/SchemaStore/schemastore/pull/3571). diff --git a/schema/v0.10/bottom.json b/schema/v0.10/bottom.json new file mode 100644 index 00000000..d109e011 --- /dev/null +++ b/schema/v0.10/bottom.json @@ -0,0 +1,1023 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://github.com/ClementTsang/bottom/blob/main/schema/nightly/bottom.json", + "title": "Schema for bottom's configs (nightly)", + "description": "https://clementtsang.github.io/bottom/nightly/configuration/config-file", + "type": "object", + "properties": { + "cpu": { + "anyOf": [ + { + "$ref": "#/definitions/CpuConfig" + }, + { + "type": "null" + } + ] + }, + "disk": { + "anyOf": [ + { + "$ref": "#/definitions/DiskConfig" + }, + { + "type": "null" + } + ] + }, + "flags": { + "anyOf": [ + { + "$ref": "#/definitions/FlagConfig" + }, + { + "type": "null" + } + ] + }, + "network": { + "anyOf": [ + { + "$ref": "#/definitions/NetworkConfig" + }, + { + "type": "null" + } + ] + }, + "processes": { + "anyOf": [ + { + "$ref": "#/definitions/ProcessesConfig" + }, + { + "type": "null" + } + ] + }, + "row": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/row" + } + }, + "styles": { + "anyOf": [ + { + "$ref": "#/definitions/StyleConfig" + }, + { + "type": "null" + } + ] + }, + "temperature": { + "anyOf": [ + { + "$ref": "#/definitions/TempConfig" + }, + { + "type": "null" + } + ] + } + }, + "definitions": { + "BatteryStyle": { + "description": "Styling specific to the battery widget.", + "type": "object", + "properties": { + "high_battery_color": { + "description": "The colour of the battery widget bar when the battery is over 50%.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "low_battery_color": { + "description": "The colour of the battery widget bar when the battery is under 10%.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "medium_battery_color": { + "description": "The colour of the battery widget bar when the battery between 10% to 50%.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + } + } + }, + "ColorStr": { + "type": "string" + }, + "CpuConfig": { + "description": "CPU column settings.", + "type": "object", + "properties": { + "default": { + "$ref": "#/definitions/CpuDefault" + } + } + }, + "CpuDefault": { + "description": "The default selection of the CPU widget. If the given selection is invalid, we will fall back to all.", + "type": "string", + "enum": [ + "all", + "average" + ] + }, + "CpuStyle": { + "description": "Styling specific to the CPU widget.", + "type": "object", + "properties": { + "all_entry_color": { + "description": "The colour of the \"All\" CPU label.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "avg_entry_color": { + "description": "The colour of the average CPU label and graph line.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "cpu_core_colors": { + "description": "Colour of each CPU threads' label and graph line. Read in order.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/ColorStr" + } + } + } + }, + "DiskConfig": { + "description": "Disk configuration.", + "type": "object", + "properties": { + "mount_filter": { + "description": "A filter over the mount names.", + "anyOf": [ + { + "$ref": "#/definitions/IgnoreList" + }, + { + "type": "null" + } + ] + }, + "name_filter": { + "description": "A filter over the disk names.", + "anyOf": [ + { + "$ref": "#/definitions/IgnoreList" + }, + { + "type": "null" + } + ] + } + } + }, + "FinalWidget": { + "description": "Represents a widget.", + "type": "object", + "required": [ + "type" + ], + "properties": { + "default": { + "type": [ + "boolean", + "null" + ] + }, + "ratio": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "type": { + "type": "string" + } + } + }, + "FlagConfig": { + "type": "object", + "properties": { + "autohide_time": { + "type": [ + "boolean", + "null" + ] + }, + "basic": { + "type": [ + "boolean", + "null" + ] + }, + "battery": { + "type": [ + "boolean", + "null" + ] + }, + "case_sensitive": { + "type": [ + "boolean", + "null" + ] + }, + "cpu_left_legend": { + "type": [ + "boolean", + "null" + ] + }, + "current_usage": { + "type": [ + "boolean", + "null" + ] + }, + "default_time_value": { + "anyOf": [ + { + "$ref": "#/definitions/StringOrNum" + }, + { + "type": "null" + } + ] + }, + "default_widget_count": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "default_widget_type": { + "type": [ + "string", + "null" + ] + }, + "disable_advanced_kill": { + "type": [ + "boolean", + "null" + ] + }, + "disable_click": { + "type": [ + "boolean", + "null" + ] + }, + "dot_marker": { + "type": [ + "boolean", + "null" + ] + }, + "enable_cache_memory": { + "type": [ + "boolean", + "null" + ] + }, + "enable_gpu": { + "type": [ + "boolean", + "null" + ] + }, + "expanded": { + "type": [ + "boolean", + "null" + ] + }, + "group_processes": { + "type": [ + "boolean", + "null" + ] + }, + "hide_avg_cpu": { + "type": [ + "boolean", + "null" + ] + }, + "hide_table_gap": { + "type": [ + "boolean", + "null" + ] + }, + "hide_time": { + "type": [ + "boolean", + "null" + ] + }, + "memory_legend": { + "type": [ + "string", + "null" + ] + }, + "network_legend": { + "type": [ + "string", + "null" + ] + }, + "network_use_binary_prefix": { + "type": [ + "boolean", + "null" + ] + }, + "network_use_bytes": { + "type": [ + "boolean", + "null" + ] + }, + "network_use_log": { + "type": [ + "boolean", + "null" + ] + }, + "no_write": { + "type": [ + "boolean", + "null" + ] + }, + "process_command": { + "type": [ + "boolean", + "null" + ] + }, + "process_memory_as_value": { + "type": [ + "boolean", + "null" + ] + }, + "rate": { + "anyOf": [ + { + "$ref": "#/definitions/StringOrNum" + }, + { + "type": "null" + } + ] + }, + "regex": { + "type": [ + "boolean", + "null" + ] + }, + "retention": { + "anyOf": [ + { + "$ref": "#/definitions/StringOrNum" + }, + { + "type": "null" + } + ] + }, + "show_table_scroll_position": { + "type": [ + "boolean", + "null" + ] + }, + "temperature_type": { + "type": [ + "string", + "null" + ] + }, + "time_delta": { + "anyOf": [ + { + "$ref": "#/definitions/StringOrNum" + }, + { + "type": "null" + } + ] + }, + "tree": { + "type": [ + "boolean", + "null" + ] + }, + "unnormalized_cpu": { + "type": [ + "boolean", + "null" + ] + }, + "use_old_network_legend": { + "type": [ + "boolean", + "null" + ] + }, + "whole_word": { + "type": [ + "boolean", + "null" + ] + } + } + }, + "GraphStyle": { + "description": "General styling for graph widgets.", + "type": "object", + "properties": { + "graph_color": { + "description": "The general colour of the parts of the graph.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "legend_text": { + "description": "Text styling for graph's legend text.", + "anyOf": [ + { + "$ref": "#/definitions/TextStyleConfig" + }, + { + "type": "null" + } + ] + } + } + }, + "IgnoreList": { + "type": "object", + "required": [ + "list" + ], + "properties": { + "case_sensitive": { + "default": false, + "type": "boolean" + }, + "is_list_ignored": { + "default": true, + "type": "boolean" + }, + "list": { + "type": "array", + "items": { + "type": "string" + } + }, + "regex": { + "default": false, + "type": "boolean" + }, + "whole_word": { + "default": false, + "type": "boolean" + } + } + }, + "MemoryStyle": { + "description": "Styling specific to the memory widget.", + "type": "object", + "properties": { + "arc_color": { + "description": "The colour of the ARC label and graph line.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "cache_color": { + "description": "The colour of the cache label and graph line. Does not do anything on Windows.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "gpu_colors": { + "description": "Colour of each GPU's memory label and graph line. Read in order.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/ColorStr" + } + }, + "ram_color": { + "description": "The colour of the RAM label and graph line.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "swap_color": { + "description": "The colour of the swap label and graph line.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + } + } + }, + "NetworkConfig": { + "description": "Network configuration.", + "type": "object", + "properties": { + "interface_filter": { + "description": "A filter over the network interface names.", + "anyOf": [ + { + "$ref": "#/definitions/IgnoreList" + }, + { + "type": "null" + } + ] + } + } + }, + "NetworkStyle": { + "description": "Styling specific to the network widget.", + "type": "object", + "properties": { + "rx_color": { + "description": "The colour of the RX (download) label and graph line.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "rx_total_color": { + "description": "he colour of the total RX (download) label in basic mode.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "tx_color": { + "description": "The colour of the TX (upload) label and graph line.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "tx_total_color": { + "description": "The colour of the total TX (upload) label in basic mode.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + } + } + }, + "ProcColumn": { + "description": "A column in the process widget.", + "type": "string", + "enum": [ + "PID", + "Count", + "Name", + "Command", + "CPU%", + "Mem", + "Mem%", + "R/s", + "Read", + "Rps", + "W/s", + "Write", + "Wps", + "T.Read", + "TWrite", + "T.Write", + "TRead", + "State", + "User", + "Time", + "GMem", + "GMem%", + "GPU%" + ] + }, + "ProcessesConfig": { + "description": "Process configuration.", + "type": "object", + "properties": { + "columns": { + "description": "A list of process widget columns.", + "type": "array", + "items": { + "$ref": "#/definitions/ProcColumn" + } + } + } + }, + "RowChildren": { + "description": "Represents a child of a Row - either a Col (column) or a FinalWidget.\n\nA Col can also have an optional length and children. We only allow columns to have FinalWidgets as children, lest we get some amount of mutual recursion between Row and Col.", + "anyOf": [ + { + "$ref": "#/definitions/FinalWidget" + }, + { + "type": "object", + "required": [ + "child" + ], + "properties": { + "child": { + "type": "array", + "items": { + "$ref": "#/definitions/FinalWidget" + } + }, + "ratio": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + } + } + ] + }, + "StringOrNum": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + ] + }, + "StyleConfig": { + "description": "Style-related configs.", + "type": "object", + "properties": { + "battery": { + "description": "Styling for the battery widget.", + "anyOf": [ + { + "$ref": "#/definitions/BatteryStyle" + }, + { + "type": "null" + } + ] + }, + "cpu": { + "description": "Styling for the CPU widget.", + "anyOf": [ + { + "$ref": "#/definitions/CpuStyle" + }, + { + "type": "null" + } + ] + }, + "graphs": { + "description": "Styling for graph widgets.", + "anyOf": [ + { + "$ref": "#/definitions/GraphStyle" + }, + { + "type": "null" + } + ] + }, + "memory": { + "description": "Styling for the memory widget.", + "anyOf": [ + { + "$ref": "#/definitions/MemoryStyle" + }, + { + "type": "null" + } + ] + }, + "network": { + "description": "Styling for the network widget.", + "anyOf": [ + { + "$ref": "#/definitions/NetworkStyle" + }, + { + "type": "null" + } + ] + }, + "tables": { + "description": "Styling for table widgets.", + "anyOf": [ + { + "$ref": "#/definitions/TableStyle" + }, + { + "type": "null" + } + ] + }, + "theme": { + "description": "A built-in theme.\n\nIf this is and a custom colour are both set, in the config file, the custom colour scheme will be prioritized first. If a theme is set in the command-line args, however, it will always be prioritized first.", + "type": [ + "string", + "null" + ] + }, + "widgets": { + "description": "Styling for general widgets.", + "anyOf": [ + { + "$ref": "#/definitions/WidgetStyle" + }, + { + "type": "null" + } + ] + } + } + }, + "TableStyle": { + "description": "General styling for table widgets.", + "type": "object", + "properties": { + "headers": { + "description": "Text styling for table headers.", + "anyOf": [ + { + "$ref": "#/definitions/TextStyleConfig" + }, + { + "type": "null" + } + ] + } + } + }, + "TempConfig": { + "description": "Temperature configuration.", + "type": "object", + "properties": { + "sensor_filter": { + "description": "A filter over the sensor names.", + "anyOf": [ + { + "$ref": "#/definitions/IgnoreList" + }, + { + "type": "null" + } + ] + } + } + }, + "TextStyleConfig": { + "description": "A style for text.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "object", + "properties": { + "bg_color": { + "description": "A built-in ANSI colour, RGB hex, or RGB colour code.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "bold": { + "description": "Whether to make this text bolded or not. If not set, will default to built-in defaults.", + "type": [ + "boolean", + "null" + ] + }, + "color": { + "description": "A built-in ANSI colour, RGB hex, or RGB colour code.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "italics": { + "description": "Whether to make this text italicized or not. If not set, will default to built-in defaults.", + "type": [ + "boolean", + "null" + ] + } + } + } + ] + }, + "WidgetStyle": { + "description": "General styling for generic widgets.", + "type": "object", + "properties": { + "border_color": { + "description": "The colour of the widgets' borders.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "disabled_text": { + "description": "Text styling for text when representing something that is disabled.", + "anyOf": [ + { + "$ref": "#/definitions/TextStyleConfig" + }, + { + "type": "null" + } + ] + }, + "selected_border_color": { + "description": "The colour of a widget's borders when the widget is selected.", + "anyOf": [ + { + "$ref": "#/definitions/ColorStr" + }, + { + "type": "null" + } + ] + }, + "selected_text": { + "description": "Text styling for text when representing something that is selected.", + "anyOf": [ + { + "$ref": "#/definitions/TextStyleConfig" + }, + { + "type": "null" + } + ] + }, + "text": { + "description": "Text styling for text in general.", + "anyOf": [ + { + "$ref": "#/definitions/TextStyleConfig" + }, + { + "type": "null" + } + ] + }, + "widget_title": { + "description": "Text styling for a widget's title.", + "anyOf": [ + { + "$ref": "#/definitions/TextStyleConfig" + }, + { + "type": "null" + } + ] + } + } + }, + "row": { + "description": "Represents a row. This has a length of some sort (optional) and a vector of children.", + "type": "object", + "properties": { + "child": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RowChildren" + } + }, + "ratio": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + } + } + } +} diff --git a/schema/v0.9/bottom.json b/schema/v0.9/bottom.json new file mode 100644 index 00000000..04322645 --- /dev/null +++ b/schema/v0.9/bottom.json @@ -0,0 +1,385 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://github.com/ClementTsang/bottom/blob/main/schema/v1.0/bottom.json", + "$comment": "https://clementtsang.github.io/bottom/0.9.6/configuration/config-file/default-config/", + "title": "Schema for bottom's configs (v1.0)", + "type": "object", + "definitions": { + "row": { + "items": { + "properties": { + "ratio": { + "default": 1, + "type": "integer" + }, + "type": { + "enum": ["cpu", "mem", "proc", "net", "temp", "disk", "empty"], + "type": "string" + }, + "default": { + "default": true, + "type": "boolean" + } + }, + "patternProperties": { + "row(.child)+": { + "$ref": "#/definitions/row" + } + }, + "type": "object" + }, + "type": "array" + }, + "filter": { + "description": "hide specific temperature sensors, network interfaces, and disks using filters", + "properties": { + "is_list_ignored": { + "default": true, + "type": "boolean" + }, + "list": { + "type": "array" + }, + "regex": { + "default": true, + "type": "boolean" + }, + "case_sensitive": { + "default": false, + "type": "boolean" + }, + "whole_word": { + "default": false, + "type": "boolean" + } + }, + "type": "object" + } + }, + "properties": { + "flags": { + "description": "This group of options represents a command-line flag/option. Flags explicitly added when running (ie: btm -a) will override this config file if an option is also set here", + "properties": { + "hide_avg_cpu": { + "default": false, + "description": "Whether to hide the average cpu entry", + "type": "boolean" + }, + "dot_marker": { + "default": false, + "description": "Whether to use dot markers rather than braille", + "type": "boolean" + }, + "rate": { + "default": 1000, + "description": "The update rate of the application", + "type": "integer" + }, + "left_legend": { + "default": false, + "description": "Whether to put the CPU legend to the left", + "type": "boolean" + }, + "current_usage": { + "default": false, + "description": "Whether to set CPU% on a process to be based on the total CPU or just current usage", + "type": "boolean" + }, + "unnormalized_cpu": { + "default": false, + "description": "Whether to set CPU% on a process to be based on the total CPU or per-core CPU% (not divided by the number of cpus)", + "type": "boolean" + }, + "group_processes": { + "default": false, + "description": "Whether to group processes with the same name together by default", + "type": "boolean" + }, + "case_sensitive": { + "default": false, + "description": "Whether to make process searching case sensitive by default", + "type": "boolean" + }, + "whole_word": { + "default": false, + "description": "Whether to make process searching look for matching the entire word by default", + "type": "boolean" + }, + "regex": { + "default": false, + "description": "Whether to make process searching use regex by default", + "type": "boolean" + }, + "temperature_type": { + "default": "k", + "enum": ["k", "f", "c", "kelvin", "fahrenheit", "celsius"], + "description": "Defaults to Celsius", + "type": "string" + }, + "default_time_value": { + "default": 60000, + "description": "The default time interval in milliseconds", + "type": "integer" + }, + "time_delta": { + "default": 15000, + "description": "The time delta on each zoom in/out action in milliseconds", + "type": "integer" + }, + "hide_time": { + "default": false, + "description": "Hides the time scale", + "type": "boolean" + }, + "default_widget_type": { + "default": "proc", + "description": "Override layout default widget", + "type": "string" + }, + "default_widget_count": { + "default": 1, + "description": "Override layout default widget", + "type": "integer" + }, + "expanded_on_startup": { + "default": true, + "description": "Expand selected widget upon starting the app", + "type": "boolean" + }, + "basic": { + "default": false, + "description": "Use basic mode", + "type": "boolean" + }, + "use_old_network_legend": { + "default": false, + "description": "Use the old network legend style", + "type": "boolean" + }, + "hide_table_gap": { + "default": false, + "description": "Remove space in tables", + "type": "boolean" + }, + "battery": { + "default": false, + "description": "Show the battery widgets", + "type": "boolean" + }, + "disable_click": { + "default": false, + "description": "Disable mouse clicks", + "type": "boolean" + }, + "color": { + "default": "default", + "enum": [ + "default", + "default-light", + "gruvbox", + "gruvbox-light", + "nord", + "nord-light" + ], + "description": "Built-in themes", + "type": "string" + }, + "process_memory_as_value": { + "default": false, + "description": "Show memory values in the processes widget as values by default", + "type": "boolean" + }, + "tree": { + "default": false, + "description": "Show tree mode by default in the processes widget", + "type": "boolean" + }, + "show_table_scroll_position": { + "default": false, + "description": "Shows an indicator in table widgets tracking where in the list you are", + "type": "boolean" + }, + "process_command": { + "default": false, + "description": "Show processes as their commands by default in the process widget", + "type": "boolean" + }, + "network_use_binary_prefix": { + "default": false, + "description": "Displays the network widget with binary prefixes", + "type": "boolean" + }, + "network_use_bytes": { + "default": false, + "description": "Displays the network widget using bytes", + "type": "boolean" + }, + "network_use_log": { + "default": false, + "description": "Displays the network widget with a log scale", + "type": "boolean" + }, + "disable_advanced_kill": { + "default": false, + "description": "Hides advanced options to stop a process on Unix-like systems", + "type": "boolean" + }, + "enable_gpu_memory": { + "default": false, + "description": "Shows GPU(s) memory", + "type": "boolean" + }, + "retention": { + "default": "10m", + "description": "How much data is stored at once in terms of time", + "type": "string" + } + }, + "type": "object" + }, + "colors": { + "description": "These are all the components that support custom theming. Note that colour support will depend on terminal support", + "properties": { + "table_header_color": { + "default": "LightBlue", + "description": "Represents the colour of table headers (processes, CPU, disks, temperature)", + "type": "string" + }, + "widget_title_color": { + "default": "Gray", + "description": "Represents the colour of the label each widget has", + "type": "string" + }, + "avg_cpu_color": { + "default": "Red", + "description": "Represents the average CPU color", + "type": "string" + }, + "cpu_core_colors": { + "items": { + "uniqueItems": true, + "minItems": 1, + "type": "string" + }, + "default": [ + "LightMagenta", + "LightYellow", + "LightCyan", + "LightGreen", + "LightBlue", + "LightRed", + "Cyan", + "Green", + "Blue", + "Red" + ], + "description": "Represents the colour the core will use in the CPU legend and graph", + "type": "array" + }, + "ram_color": { + "default": "LightMagenta", + "description": "Represents the colour RAM will use in the memory legend and graph", + "type": "string" + }, + "swap_color": { + "default": "LightYellow", + "description": "Represents the colour SWAP will use in the memory legend and graph", + "type": "string" + }, + "arc_color": { + "default": "LightCyan", + "description": "Represents the colour ARC will use in the memory legend and graph", + "type": "string" + }, + "gpu_core_colors": { + "items": { + "uniqueItems": true, + "minItems": 1, + "type": "string" + }, + "default": [ + "LightGreen", + "LightBlue", + "LightRed", + "Cyan", + "Green", + "Blue", + "Red" + ], + "description": "Represents the colour the GPU will use in the memory legend and graph", + "type": "array" + }, + "rx_color": { + "default": "LightCyan", + "description": "Represents the colour rx will use in the network legend and graph", + "type": "string" + }, + "tx_color": { + "default": "LightGreen", + "description": "Represents the colour tx will use in the network legend and graph", + "type": "string" + }, + "border_color": { + "default": "Gray", + "description": "Represents the colour of the border of unselected widgets", + "type": "string" + }, + "highlighted_border_color": { + "default": "LightBlue", + "description": "Represents the colour of the border of selected widgets", + "type": "string" + }, + "text_color": { + "default": "Gray", + "description": "Represents the colour of most text", + "type": "string" + }, + "selected_text_color": { + "default": "Black", + "description": "Represents the colour of text that is selected", + "type": "string" + }, + "selected_bg_color": { + "default": "LightBlue", + "description": "Represents the background colour of text that is selected", + "type": "string" + }, + "graph_color": { + "default": "Gray", + "description": "Represents the colour of the lines and text of the graph", + "type": "string" + }, + "high_battery_color": { + "default": "green", + "description": "Represents the colours of the battery based on charge", + "type": "string" + }, + "medium_battery_color": { + "default": "yellow", + "description": "Represents the colours of the battery based on charge", + "type": "string" + }, + "low_battery_color": { + "default": "red", + "description": "Represents the colours of the battery based on charge", + "type": "string" + } + } + }, + "row": { + "$ref": "#/definitions/row" + }, + "disk_filter": { + "$ref": "#/definitions/filter" + }, + "mount_filter": { + "$ref": "#/definitions/filter" + }, + "temp_filter": { + "$ref": "#/definitions/filter" + }, + "net_filter": { + "$ref": "#/definitions/filter" + } + } +} diff --git a/schema/v1.0/README.md b/schema/v1.0/README.md new file mode 100644 index 00000000..dc6433fd --- /dev/null +++ b/schema/v1.0/README.md @@ -0,0 +1,3 @@ +# v1.0 + +Note - this will be deleted soon in favour of moving to a schema versioning that matches bottom's. diff --git a/src/main.rs b/src/main.rs index c7c979ce..bc319518 100644 --- a/src/main.rs +++ b/src/main.rs @@ -308,6 +308,8 @@ fn generate_schema() -> anyhow::Result<()> { } fn main() -> anyhow::Result<()> { + // TODO: If there is any panic in any thread, send a cancellation token (or similar) to shut down everything. + // let _profiler = dhat::Profiler::new_heap(); let args = args::get_args(); @@ -328,7 +330,6 @@ fn main() -> anyhow::Result<()> { } // Read from config file. - let config = get_or_create_config(args.general.config_location.as_deref())?; // Create the "app" and initialize a bunch of stuff.