Sleep for 50ms before sending first Message::TabNew
This fixes the issue of two tabs being created at startup. Should fix #36. Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
This commit is contained in:
parent
4bde45bcdc
commit
9b185c9610
1 changed files with 5 additions and 1 deletions
|
|
@ -21,7 +21,7 @@ use cosmic::{
|
||||||
Application, ApplicationExt, Element,
|
Application, ApplicationExt, Element,
|
||||||
};
|
};
|
||||||
use cosmic_text::{Family, Weight, Stretch, fontdb::FaceInfo};
|
use cosmic_text::{Family, Weight, Stretch, fontdb::FaceInfo};
|
||||||
use std::{any::TypeId, collections::{HashMap, BTreeMap, BTreeSet}, env, process, sync::Mutex};
|
use std::{any::TypeId, collections::{HashMap, BTreeMap, BTreeSet}, env, process, sync::Mutex, time::Duration};
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
|
|
||||||
use config::{AppTheme, Config, CONFIG_VERSION};
|
use config::{AppTheme, Config, CONFIG_VERSION};
|
||||||
|
|
@ -1085,6 +1085,10 @@ impl Application for App {
|
||||||
let (event_tx, mut event_rx) = mpsc::channel(100);
|
let (event_tx, mut event_rx) = mpsc::channel(100);
|
||||||
output.send(Message::TermEventTx(event_tx)).await.unwrap();
|
output.send(Message::TermEventTx(event_tx)).await.unwrap();
|
||||||
|
|
||||||
|
|
||||||
|
// Avoid creating two tabs at startup
|
||||||
|
tokio::time::sleep(Duration::from_millis(50)).await;
|
||||||
|
|
||||||
// Create first terminal tab
|
// Create first terminal tab
|
||||||
output.send(Message::TabNew).await.unwrap();
|
output.send(Message::TabNew).await.unwrap();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue