Add ability to toggle the terminal
This commit is contained in:
parent
a69f93d214
commit
acf2c2c6a5
2 changed files with 30 additions and 8 deletions
|
@ -166,7 +166,24 @@ impl<S: 'static + Send + Sync + Clone> StatusBar<S> {
|
||||||
.flex()
|
.flex()
|
||||||
.items_center()
|
.items_center()
|
||||||
.gap_1()
|
.gap_1()
|
||||||
.child(IconButton::new(Icon::Terminal))
|
.child(IconButton::new(Icon::Terminal).on_click(|_, cx| {
|
||||||
|
let workspace_state = get_workspace_state();
|
||||||
|
|
||||||
|
let is_showing_terminal =
|
||||||
|
workspace_state.show_terminal.load(Ordering::SeqCst);
|
||||||
|
|
||||||
|
workspace_state
|
||||||
|
.show_terminal
|
||||||
|
.compare_exchange(
|
||||||
|
is_showing_terminal,
|
||||||
|
!is_showing_terminal,
|
||||||
|
Ordering::SeqCst,
|
||||||
|
Ordering::SeqCst,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
cx.notify();
|
||||||
|
}))
|
||||||
.child(IconButton::new(Icon::MessageBubbles).on_click(|_, cx| {
|
.child(IconButton::new(Icon::MessageBubbles).on_click(|_, cx| {
|
||||||
let workspace_state = get_workspace_state();
|
let workspace_state = get_workspace_state();
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ use crate::{
|
||||||
pub struct WorkspaceState {
|
pub struct WorkspaceState {
|
||||||
pub show_project_panel: Arc<AtomicBool>,
|
pub show_project_panel: Arc<AtomicBool>,
|
||||||
pub show_chat_panel: Arc<AtomicBool>,
|
pub show_chat_panel: Arc<AtomicBool>,
|
||||||
|
pub show_terminal: Arc<AtomicBool>,
|
||||||
pub show_language_selector: Arc<AtomicBool>,
|
pub show_language_selector: Arc<AtomicBool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@ pub fn get_workspace_state() -> &'static WorkspaceState {
|
||||||
let state = WORKSPACE_STATE.get_or_init(|| WorkspaceState {
|
let state = WORKSPACE_STATE.get_or_init(|| WorkspaceState {
|
||||||
show_project_panel: Arc::new(AtomicBool::new(true)),
|
show_project_panel: Arc::new(AtomicBool::new(true)),
|
||||||
show_chat_panel: Arc::new(AtomicBool::new(true)),
|
show_chat_panel: Arc::new(AtomicBool::new(true)),
|
||||||
|
show_terminal: Arc::new(AtomicBool::new(true)),
|
||||||
show_language_selector: Arc::new(AtomicBool::new(false)),
|
show_language_selector: Arc::new(AtomicBool::new(false)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -168,14 +170,17 @@ impl<S: 'static + Send + Sync + Clone> WorkspaceElement<S> {
|
||||||
.h_px()
|
.h_px()
|
||||||
.child(root_group),
|
.child(root_group),
|
||||||
)
|
)
|
||||||
.child(
|
.children(
|
||||||
Panel::new(
|
Some(
|
||||||
self.bottom_panel_scroll_state.clone(),
|
Panel::new(
|
||||||
|_, _| vec![Terminal::new().into_any()],
|
self.bottom_panel_scroll_state.clone(),
|
||||||
Box::new(()),
|
|_, _| vec![Terminal::new().into_any()],
|
||||||
|
Box::new(()),
|
||||||
|
)
|
||||||
|
.allowed_sides(PanelAllowedSides::BottomOnly)
|
||||||
|
.side(PanelSide::Bottom),
|
||||||
)
|
)
|
||||||
.allowed_sides(PanelAllowedSides::BottomOnly)
|
.filter(|_| workspace_state.show_terminal.load(Ordering::SeqCst)),
|
||||||
.side(PanelSide::Bottom),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.children(
|
.children(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue