Skip to content

Commit bca3fa2

Browse files
committed
initialize viuer supports in the main thread to avoid deadlock
1 parent c69186c commit bca3fa2

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

spotify_player/src/main.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@ fn init_logging(cache_folder: &std::path::Path) -> Result<()> {
133133

134134
#[tokio::main]
135135
async fn start_app(state: state::SharedState, is_daemon: bool) -> Result<()> {
136+
if !is_daemon {
137+
#[cfg(feature = "image")]
138+
{
139+
// initialize `viuer` supports for kitty, iterm2, and sixel
140+
viuer::get_kitty_support();
141+
viuer::is_iterm_supported();
142+
#[cfg(feature = "sixel")]
143+
viuer::is_sixel_supported();
144+
}
145+
}
146+
136147
// client channels
137148
let (client_pub, client_sub) = flume::unbounded::<event::ClientRequest>();
138149

spotify_player/src/ui/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ mod utils;
1212

1313
/// run the application UI
1414
pub fn run(state: SharedState) -> Result<()> {
15-
#[cfg(feature = "image")]
16-
{
17-
// initialize viuer supports for kitty and iterm2
18-
viuer::get_kitty_support();
19-
viuer::is_iterm_supported();
20-
#[cfg(feature = "sixel")]
21-
viuer::is_sixel_supported();
22-
}
23-
2415
let mut terminal = init_ui().context("failed to initialize the application's UI")?;
2516

2617
let ui_refresh_duration =

0 commit comments

Comments
 (0)