refactor(help): enable help bar by default and add help keybinding (#122)

This commit is contained in:
Alexandre Pasmantier 2024-12-15 00:54:14 +01:00 committed by GitHub
parent 9809e742d8
commit 37b2dda729
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 23 additions and 16 deletions

View File

@ -37,7 +37,7 @@ use_nerd_font_icons = false
ui_scale = 100 ui_scale = 100
# Whether to show the top help bar in the UI by default # Whether to show the top help bar in the UI by default
# This option can be toggled with the (default) `ctrl-g` keybinding # This option can be toggled with the (default) `ctrl-g` keybinding
show_help_bar = false show_help_bar = true
# Where to place the input bar in the UI (top or bottom) # Where to place the input bar in the UI (top or bottom)
input_bar_position = "bottom" input_bar_position = "bottom"
# The theme to use for the UI # The theme to use for the UI

View File

@ -29,6 +29,7 @@ pub enum DisplayableAction {
ToggleRemoteControl, ToggleRemoteControl,
Cancel, Cancel,
Quit, Quit,
ToggleHelpBar,
} }
impl Display for DisplayableAction { impl Display for DisplayableAction {
@ -44,6 +45,7 @@ impl Display for DisplayableAction {
DisplayableAction::ToggleRemoteControl => "Toggle Remote control", DisplayableAction::ToggleRemoteControl => "Toggle Remote control",
DisplayableAction::Cancel => "Cancel", DisplayableAction::Cancel => "Cancel",
DisplayableAction::Quit => "Quit", DisplayableAction::Quit => "Quit",
DisplayableAction::ToggleHelpBar => "Toggle help bar",
}; };
write!(f, "{action}") write!(f, "{action}")
} }
@ -149,12 +151,14 @@ fn build_keybindings_table_for_channel<'a>(
)); ));
// MISC line (quit, help, etc.) // MISC line (quit, help, etc.)
// Quit ⏼ // Toggle help bar
let quit_keys = let toggle_help_bar_keys = keybindings
keybindings.bindings.get(&DisplayableAction::Quit).unwrap(); .bindings
let quit_row = Row::new(build_cells_for_group( .get(&DisplayableAction::ToggleHelpBar)
"Quit", .unwrap();
quit_keys, let toggle_help_bar_row = Row::new(build_cells_for_group(
"Toggle help bar",
toggle_help_bar_keys,
colorscheme.help.metadata_field_name_fg, colorscheme.help.metadata_field_name_fg,
colorscheme.mode.channel, colorscheme.mode.channel,
)); ));
@ -169,7 +173,7 @@ fn build_keybindings_table_for_channel<'a>(
copy_entry_row, copy_entry_row,
send_to_channel_row, send_to_channel_row,
switch_channels_row, switch_channels_row,
quit_row, toggle_help_bar_row,
], ],
widths, widths,
) )

View File

@ -10,10 +10,13 @@ lazy_static! {
include_str!("../../../../themes/gruvbox-dark.toml"), include_str!("../../../../themes/gruvbox-dark.toml"),
); );
m.insert( m.insert(
"catppuccin", "catppuccin-mocha",
include_str!("../../../../themes/catppuccin.toml"), include_str!("../../../../themes/catppuccin-mocha.toml"),
);
m.insert(
"nord-dark",
include_str!("../../../../themes/nord-dark.toml"),
); );
m.insert("nord", include_str!("../../../../themes/nord.toml"));
m.insert( m.insert(
"solarized-dark", "solarized-dark",
include_str!("../../../../themes/solarized-dark.toml"), include_str!("../../../../themes/solarized-dark.toml"),

View File

@ -587,8 +587,8 @@ impl KeyBindings {
), ),
), ),
( (
DisplayableAction::Quit, DisplayableAction::ToggleHelpBar,
serialized_keys_for_actions(self, &[Action::Quit]), serialized_keys_for_actions(self, &[Action::ToggleHelp]),
), ),
]); ]);

View File

@ -7,9 +7,9 @@ dimmed_text_fg = '#6c7086'
input_text_fg = '#f38ba8' input_text_fg = '#f38ba8'
result_count_fg = '#f38ba8' result_count_fg = '#f38ba8'
# results # results
result_name_fg = '#b4befe' result_name_fg = '#89b4fa'
result_line_number_fg = '#f9e2af' result_line_number_fg = '#f9e2af'
result_value_fg = '#a6adc8' result_value_fg = '#b4befe'
selection_bg = '#313244' selection_bg = '#313244'
match_fg = '#f38ba8' match_fg = '#f38ba8'
# preview # preview

View File

@ -1,6 +1,6 @@
# general # general
background = '#2e3440' background = '#2e3440'
border_fg = '#434c5e' border_fg = '#81a1c1'
text_fg = '#d8dee9' text_fg = '#d8dee9'
dimmed_text_fg = '#4c566a' dimmed_text_fg = '#4c566a'
# input # input