fix(channels): use default_channel from config

This commit is contained in:
lalvarezt 2025-05-22 12:35:47 +02:00
parent 7bbf538898
commit 8e987e1cda
2 changed files with 8 additions and 9 deletions

View File

@ -4,6 +4,7 @@ use std::{
ops::Deref,
};
use crate::config::default_channel;
use crate::{cable::CableSpec, channels::preview::PreviewCommand};
/// A prototype for cable channels.
@ -110,11 +111,10 @@ impl Deref for Cable {
impl Cable {
pub fn default_channel(&self) -> ChannelPrototype {
self.get(DEFAULT_PROTOTYPE_NAME)
.cloned()
.unwrap_or_else(|| {
panic!("Default channel '{DEFAULT_PROTOTYPE_NAME}' not found")
})
let default_channel = &default_channel();
self.get(default_channel).cloned().unwrap_or_else(|| {
panic!("Default channel '{default_channel}' not found")
})
}
}

View File

@ -15,8 +15,6 @@ pub use themes::Theme;
use tracing::{debug, warn};
pub use ui::UiConfig;
use crate::channels::prototypes::DEFAULT_PROTOTYPE_NAME;
mod keybindings;
pub mod shell_integration;
mod themes;
@ -41,8 +39,9 @@ pub struct AppConfig {
pub default_channel: String,
}
fn default_channel() -> String {
DEFAULT_PROTOTYPE_NAME.to_string()
pub fn default_channel() -> String {
let config = Config::load_user_config(&get_config_dir()).unwrap();
config.application.default_channel.to_string()
}
impl Hash for AppConfig {