update
This commit is contained in:
@@ -4,20 +4,17 @@ use gpui::{Context, Entity, KeyBinding, Render, Subscription, Window, actions, d
|
||||
use gpui_component::{Root, StyledExt, Theme};
|
||||
use gpui_fps::{FpsMonitor, FpsOverlay};
|
||||
use signed_state::{Backend, BackendEvent};
|
||||
use signed_ui::image_cache::{MAX_IMAGES, image_cache};
|
||||
|
||||
use crate::views::SidebarPanel;
|
||||
use crate::views::sidebar::passphrase_dialog;
|
||||
|
||||
actions!(workspace, [ToggleFps]);
|
||||
actions!(workspace, [ToggleMonitor]);
|
||||
|
||||
/// Root view of the app: dock area (whose center tab bar doubles as the
|
||||
/// window title bar), overlays.
|
||||
pub struct Workspace {
|
||||
dock: Entity<DockArea>,
|
||||
/// Debug HUD, toggled with `cmd-alt-f`.
|
||||
show_fps: bool,
|
||||
fps: Entity<FpsMonitor>,
|
||||
/// Debug HUD, toggled with `cmd-shift-f`.
|
||||
show_fps: bool,
|
||||
_subscriptions: Vec<Subscription>,
|
||||
_passphrase_subscription: Subscription,
|
||||
}
|
||||
@@ -25,7 +22,7 @@ pub struct Workspace {
|
||||
impl Workspace {
|
||||
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
|
||||
let fps = cx.new(|cx| FpsMonitor::new(window, cx).continuous(false));
|
||||
cx.bind_keys([KeyBinding::new("cmd-alt-f", ToggleFps, None)]);
|
||||
cx.bind_keys([KeyBinding::new("cmd-shift-f", ToggleMonitor, None)]);
|
||||
|
||||
let dock = cx.new(|cx| {
|
||||
let skin = SignedDockSkin::new(cx);
|
||||
@@ -123,15 +120,16 @@ impl Render for Workspace {
|
||||
let notification_layer = Root::render_notification_layer(window, cx);
|
||||
|
||||
div()
|
||||
.image_cache(image_cache("workspace", MAX_IMAGES))
|
||||
.id("workspace")
|
||||
.on_action(
|
||||
cx.listener(|this: &mut Self, _ev: &ToggleMonitor, _window, cx| {
|
||||
this.show_fps = !this.show_fps;
|
||||
cx.notify();
|
||||
}),
|
||||
)
|
||||
.v_flex()
|
||||
.size_full()
|
||||
.relative()
|
||||
.on_action(cx.listener(|this: &mut Self, _: &ToggleFps, _, cx| {
|
||||
this.show_fps = !this.show_fps;
|
||||
cx.notify();
|
||||
}))
|
||||
.child(self.dock.clone())
|
||||
// Notifications
|
||||
.children(notification_layer)
|
||||
|
||||
Reference in New Issue
Block a user