Skip to content

Commit

Permalink
don't hardcode sort icons
Browse files Browse the repository at this point in the history
  • Loading branch information
micielski committed Aug 25, 2024
1 parent 01edca8 commit 1a90dde
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion rm-config/defaults/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ category_icon_insert_into_name = true
# provider_disabled = "⛔" # "󰪎"
# provider_category_general = "[G]" # ""
# provider_category_anime = "[A]" # "󰎁"

# sort_ascending = "↓" # "󰒼"
# sort_descending = "↑" # "󰒽""
14 changes: 14 additions & 0 deletions rm-config/src/main_config/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ pub struct Icons {
pub provider_category_general: String,
#[serde(default = "default_provider_category_anime")]
pub provider_category_anime: String,
#[serde(default = "default_sort_ascending")]
pub sort_ascending: String,
#[serde(default = "default_sort_descending")]
pub sort_descending: String,
}

impl Default for Icons {
Expand Down Expand Up @@ -73,6 +77,8 @@ impl Default for Icons {
provider_disabled: default_provider_disabled(),
provider_category_general: default_provider_category_general(),
provider_category_anime: default_provider_category_anime(),
sort_ascending: default_sort_ascending(),
sort_descending: default_sort_descending(),
}
}
}
Expand Down Expand Up @@ -163,3 +169,11 @@ fn default_provider_category_general() -> String {
fn default_provider_category_anime() -> String {
"󰎁".into()
}

fn default_sort_ascending() -> String {
"󰒼".into()
}

fn default_sort_descending() -> String {
"󰒽".into()
}
4 changes: 2 additions & 2 deletions rm-main/src/tui/tabs/torrents/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ impl TorrentsTab {
let sorted_header_name;
if let Some(sort_header) = self.table_manager.sort_header {
let icon = if self.table_manager.sort_reverse {
"󰒽"
&CONFIG.icons.sort_descending
} else {
"󰒼"
&CONFIG.icons.sort_ascending
};

sorted_header_name = format!("{icon} {}", text_headers[sort_header]);
Expand Down

0 comments on commit 1a90dde

Please sign in to comment.