diff options
Diffstat (limited to 'src/constants.rs')
-rw-r--r-- | src/constants.rs | 296 |
1 files changed, 165 insertions, 131 deletions
diff --git a/src/constants.rs b/src/constants.rs index 636616c7..5db55def 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -227,159 +227,193 @@ pub static NORD_LIGHT_COLOUR_PALETTE: Lazy<ConfigColours> = Lazy::new(|| ConfigC // Help text pub const HELP_CONTENTS_TEXT: [&str; 8] = [ - "Press the corresponding numbers to jump to the section, or scroll:", - "1 - General", - "2 - CPU widget", - "3 - Process widget", - "4 - Process search widget", - "5 - Process sort widget", - "6 - Battery widget", - "7 - Basic memory widget", + "Press the corresponding numbers to jump to that section, or just scroll down:", + "[1] General", + "[2] CPU widget", + "[3] Process widget", + "[4] Process search widget", + "[5] Process sort widget", + "[6] Battery widget", + "[7] Basic memory widget", ]; -// TODO [Help]: Search in help? -// TODO [Help]: Move to using tables for easier formatting? -pub const GENERAL_HELP_TEXT: [&str; 30] = [ - "1 - General", - "q, Ctrl-c Quit", - "Esc Close dialog windows, search, widgets, or exit expanded mode", - "Ctrl-r Resets any collected data", - "f Toggles freezing, which stops new data from being shown", - "Ctrl-Left, ", - "Shift-Left, Move widget selection left", - "H, A ", - "Ctrl-Right, ", - "Shift-Right, Move widget selection right", - "L, D ", - "Ctrl-Up, ", - "Shift-Up, Move widget selection up", - "K, W ", - "Ctrl-Down, ", - "Shift-Down, Move widget selection down", - "J, S ", - "Left, h Move left within widget", - "Down, j Move down within widget", - "Up, k Move up within widget", - "Right, l Move right within widget", - "? Open help menu", - "gg Jump to the first entry", - "G Jump to the last entry", - "e Toggle expanding the currently selected widget", - "+ Zoom in on chart (decrease time range)", - "- Zoom out on chart (increase time range)", - "= Reset zoom", - "Mouse scroll Scroll through the tables or zoom in/out of charts by scrolling up/down", - "Mouse click Selects the clicked widget, table entry, dialog option, or tab", +pub const GENERAL_HELP_TITLE: &str = "General"; +pub const GENERAL_HELP_TEXT: [[&str; 2]; 21] = [ + ["q, Ctrl-c", "Quit"], + [ + "Esc", + "Close dialog windows, search, widgets, or exit expanded mode", + ], + ["Ctrl-r", "Resets any collected data"], + ["f", "Toggles freezing, stopping new data from being shown"], + ["Ctrl-Left\nShift-Left\nH, A", "Move widget selection left"], + [ + "Ctrl-Right\nShift-Right\nL, D", + "Move widget selection right", + ], + ["Ctrl-Up\nShift-Up\nK, W", "Move widget selection up"], + ["Ctrl-Down\nShift-Dow\nJ, S", "Move widget selection down"], + ["Left, h", "Move left within widget"], + ["Down, j", "Move down within widget"], + ["Up, k", "Move up within widget"], + ["Right, l", "Move right within widget"], + ["?", "Open help menu"], + ["gg", "Jump to the first entry"], + ["G", "Jump to the last entry"], + ["e", "Toggle expanding the currently selected widget"], + ["+", "Zoom in on chart (decrease time range)"], + ["-", "Zoom out on chart (increase time range)"], + ["=", "Reset zoom"], + [ + "Mouse scroll", + "Scroll through the tables or zoom in/out of charts by scrolling up/down", + ], + [ + "Mouse click", + "Selects the clicked widget, table entry, dialog option, or tab", + ], ]; -pub const CPU_HELP_TEXT: [&str; 2] = [ - "2 - CPU widget\n", - "Mouse scroll Scrolling over an CPU core/average shows only that entry on the chart", +pub const CPU_HELP_TITLE: &str = "CPU Widget"; +pub const CPU_HELP_TEXT: [[&str; 2]; 1] = [[ + "Mouse scroll", + "Scrolling over an CPU core/average shows only that entry on the chart", +]]; + +pub const PROCESS_HELP_TITLE: &str = "Process Widget"; +pub const PROCESS_HELP_TEXT: [[&str; 2]; 14] = [ + ["dd, F9", "Kill the selected process"], + [ + "c", + "Sort by CPU usage, press again to reverse sorting order", + ], + [ + "m", + "Sort by memory usage, press again to reverse sorting order", + ], + [ + "p", + "Sort by PID name, press again to reverse sorting order", + ], + [ + "n", + "Sort by process name, press again to reverse sorting order", + ], + ["Tab", "Group/un-group processes with the same name"], + ["Ctrl-f, /", "Open process search widget"], + [ + "P", + "Toggle between showing the full command or just the process name", + ], + ["s, F6", "Open process sort widget"], + ["I", "Invert current sort"], + [ + "%", + "Toggle between values and percentages for memory usage", + ], + ["t, F5", "Toggle tree mode"], + ["+, -, click", "Collapse/expand a branch while in tree mode"], + [ + "click on header", + "Sorts the entries by that column, click again to invert the sort", + ], ]; -pub const PROCESS_HELP_TEXT: [&str; 15] = [ - "3 - Process widget", - "dd, F9 Kill the selected process", - "c Sort by CPU usage, press again to reverse sorting order", - "m Sort by memory usage, press again to reverse sorting order", - "p Sort by PID name, press again to reverse sorting order", - "n Sort by process name, press again to reverse sorting order", - "Tab Group/un-group processes with the same name", - "Ctrl-f, / Open process search widget", - "P Toggle between showing the full command or just the process name", - "s, F6 Open process sort widget", - "I Invert current sort", - "% Toggle between values and percentages for memory usage", - "t, F5 Toggle tree mode", - "+, -, click Collapse/expand a branch while in tree mode", - "click on header Sorts the entries by that column, click again to invert the sort", +pub const SEARCH_TEXT_HELP_TITLE: &str = "Process Search"; +pub const SEARCH_HELP_TEXT: [[&str; 2]; 48] = [ + ["Tab", "Toggle between searching for PID and name"], + ["Esc", "Close the search widget (retains the filter)"], + ["Ctrl-a", "Skip to the start of the search query"], + ["Ctrl-e", "Skip to the end of the search query"], + ["Ctrl-u", "Clear the current search query"], + ["Ctrl-w", "Delete a word behind the cursor"], + ["Ctrl-h", "Delete the character behind the cursor"], + ["Backspace", "Delete the character behind the cursor"], + ["Delete", "Delete the character at the cursor"], + ["Alt-c, F1", "Toggle matching case"], + ["Alt-w, F2", "Toggle matching the entire word"], + ["Alt-r, F3", "Toggle using regex"], + ["Left, Alt-h", "Move cursor left"], + ["Right, Alt-l", "Move cursor right"], + ["\n", "\n"], + ["Supported search types:", ""], + ["<by name/cmd>", "ex: btm"], + ["pid", "ex: pid 825"], + ["cpu, cpu%", "ex: cpu > 4.2"], + ["mem, mem%", "ex: mem < 4.2"], + ["memb", "ex: memb < 100 kb"], + ["read, r/s", "ex: read >= 1 b"], + ["write, w/s", "ex: write <= 1 tb"], + ["tread, t.read", "ex: tread = 1"], + ["twrite, t.write", "ex: twrite = 1"], + ["user", "ex: user = root"], + ["state", "ex: state = running"], + ["\n", "\n"], + ["Comparison operators:", ""], + ["=", "ex: cpu = 1"], + [">", "ex: cpu > 1"], + ["<", "ex: cpu < 1"], + [">=", "ex: cpu >= 1"], + ["<=", "ex: cpu <= 1"], + ["\n", "\n"], + ["Logical operators:", ""], + ["and, &&, <Space> ", ": btm and cpu > 1 and mem > 1"], + ["or, ||", "ex: btm or firefox"], + ["\n", "\n"], + ["Supported units:", ""], + ["B", "ex: read > 1 b"], + ["KB", "ex: read > 1 kb"], + ["MB", "ex: read > 1 mb"], + ["TB", "ex: read > 1 tb"], + ["KiB", "ex: read > 1 kib"], + ["MiB", "ex: read > 1 mib"], + ["GiB", "ex: read > 1 gib"], + ["TiB", "ex: read > 1 tib"], ]; -pub const SEARCH_HELP_TEXT: [&str; 49] = [ - "4 - Process search widget", - "Tab Toggle between searching for PID and name", - "Esc Close the search widget (retains the filter)", - "Ctrl-a Skip to the start of the search query", - "Ctrl-e Skip to the end of the search query", - "Ctrl-u Clear the current search query", - "Ctrl-w Delete a word behind the cursor", - "Ctrl-h Delete the character behind the cursor", - "Backspace Delete the character behind the cursor", - "Delete Delete the character at the cursor", - "Alt-c, F1 Toggle matching case", - "Alt-w, F2 Toggle matching the entire word", - "Alt-r, F3 Toggle using regex", - "Left, Alt-h Move cursor left", - "Right, Alt-l Move cursor right", - "", - "Supported search types:", - "<by name/cmd> ex: btm", - "pid ex: pid 825", - "cpu, cpu% ex: cpu > 4.2", - "mem, mem% ex: mem < 4.2", - "memb ex: memb < 100 kb", - "read, r/s ex: read >= 1 b", - "write, w/s ex: write <= 1 tb", - "tread, t.read ex: tread = 1", - "twrite, t.write ex: twrite = 1", - "user ex: user = root", - "state ex: state = running", - "", - "Comparison operators:", - "= ex: cpu = 1", - "> ex: cpu > 1", - "< ex: cpu < 1", - ">= ex: cpu >= 1", - "<= ex: cpu <= 1", - "", - "Logical operators:", - "and, &&, <Space> ex: btm and cpu > 1 and mem > 1", - "or, || ex: btm or firefox", - "", - "Supported units:", - "B ex: read > 1 b", - "KB ex: read > 1 kb", - "MB ex: read > 1 mb", - "TB ex: read > 1 tb", - "KiB ex: read > 1 kib", - "MiB ex: read > 1 mib", - "GiB ex: read > 1 gib", - "TiB ex: read > 1 tib", +pub const PROCESS_SORT_HELP_TITLE: &str = "Process Sort"; +pub const PROCESS_SORT_HELP_TEXT: [[&str; 2]; 5] = [ + ["Down, 'j'", "Scroll down in list"], + ["Up, 'k'", "Scroll up in list"], + ["Mouse scroll", "Scroll through sort widget"], + ["Esc", "Close the sort widget"], + ["Enter", "Sort by current selected column"], ]; -pub const SORT_HELP_TEXT: [&str; 6] = [ - "5 - Sort widget\n", - "Down, 'j' Scroll down in list", - "Up, 'k' Scroll up in list", - "Mouse scroll Scroll through sort widget", - "Esc Close the sort widget", - "Enter Sort by current selected column", +pub const BATTERY_HELP_TITLE: &str = "Battery Widget"; +pub const BATTERY_HELP_TEXT: [[&str; 2]; 2] = [ + ["Left", "Go to previous battery"], + ["Right", "Go to next battery"], ]; -pub const BATTERY_HELP_TEXT: [&str; 3] = [ - "6 - Battery widget", - "Left Go to previous battery", - "Right Go to next battery", -]; - -pub const BASIC_MEM_HELP_TEXT: [&str; 2] = [ - "7 - Basic memory widget", - "% Toggle between values and percentages for memory usage", -]; +pub const BASIC_MEM_HELP_TITLE: &str = "Basic Memory Widget"; +pub const BASIC_MEM_HELP_TEXT: [[&str; 2]; 1] = [[ + "%", + "Toggle between values and percentages for memory usage", +]]; -pub static HELP_TEXT: Lazy<Vec<Vec<&'static str>>> = Lazy::new(|| { - vec![ - HELP_CONTENTS_TEXT.to_vec(), +pub static HELP_TEXT: Lazy<[Vec<[&'static str; 2]>; 7]> = Lazy::new(|| { + [ GENERAL_HELP_TEXT.to_vec(), CPU_HELP_TEXT.to_vec(), PROCESS_HELP_TEXT.to_vec(), SEARCH_HELP_TEXT.to_vec(), - SORT_HELP_TEXT.to_vec(), + PROCESS_SORT_HELP_TEXT.to_vec(), BATTERY_HELP_TEXT.to_vec(), BASIC_MEM_HELP_TEXT.to_vec(), ] }); +pub const HELP_TITLES: [&'static str; 7] = [ + GENERAL_HELP_TITLE, + CPU_HELP_TITLE, + PROCESS_HELP_TITLE, + SEARCH_TEXT_HELP_TITLE, + PROCESS_SORT_HELP_TITLE, + BATTERY_HELP_TITLE, + BASIC_MEM_HELP_TITLE, +]; + // Default layouts pub const DEFAULT_LAYOUT: &str = r##" [[row]] |