Keep global actions visible and follow each platform's title bar
Phase 5-4. - The workspace button sits at the left end of the header. It shows the workspace name and opens the workspace list below it. - The left ribbon is always present: plugin views at the top, Help and Settings at the bottom. The left pane footer is gone. - Tabs keep 120 pixels and scroll. Fades show tabs out of view, and a list button names all tabs, with pinned and unsaved marks. The active tab now scrolls into view with its close button. - A drag area of 120 pixels follows the tabs. In a narrow header, the tabs shrink first, and the drag area keeps at least 48 pixels. - Caption buttons are square, 46 pixels wide, and full height. When the pointer rests on maximize, the new window_snap_layouts command opens Snap Layouts with Win+Z for the focused window. - macOS keeps its native traffic lights: tauri.macos.conf.json and the runtime window builders use an overlay title bar. Title bars leave --rs-titlebar-inset-start free for the traffic lights. - 3 new catalog rows and 1 removed row, in French, Japanese, and Simplified Chinese. - Docs: UI-050, the user guide, and ui-design.md. Tests: the new layout/titleBar. Tests that used the left pane footer, the rounded caption buttons, the 600-pixel theme editor pane, or a ribbon of no width now follow the new layout.
This commit is contained in:
@@ -25,6 +25,7 @@ fn main() {
|
||||
"spelling_menu_select",
|
||||
"spelling_menu_uninstall",
|
||||
"settings_open_window",
|
||||
"window_snap_layouts",
|
||||
"settings_read",
|
||||
"settings_write",
|
||||
"settings_migrate",
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"allow-browser-stop",
|
||||
"allow-plugins-snapshot",
|
||||
"allow-settings-read",
|
||||
"allow-window-snap-layouts",
|
||||
"allow-settings-write",
|
||||
"allow-settings-migrate",
|
||||
"allow-spelling-menu-install",
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"allow-spelling-menu-select",
|
||||
"allow-spelling-menu-uninstall",
|
||||
"allow-settings-open-window",
|
||||
"allow-window-snap-layouts",
|
||||
"allow-settings-read",
|
||||
"allow-settings-write",
|
||||
"allow-settings-migrate",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"permissions": [
|
||||
"allow-theme-export",
|
||||
"allow-settings-read",
|
||||
"allow-window-snap-layouts",
|
||||
"allow-settings-write",
|
||||
"allow-settings-migrate",
|
||||
"core:default",
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-window-snap-layouts"
|
||||
description = "Enables the window_snap_layouts command without any pre-configured scope."
|
||||
commands.allow = ["window_snap_layouts"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-window-snap-layouts"
|
||||
description = "Denies the window_snap_layouts command without any pre-configured scope."
|
||||
commands.deny = ["window_snap_layouts"]
|
||||
@@ -479,8 +479,8 @@ impl BrowserState {
|
||||
url.query_pairs_mut().append_pair("browserWindow", "true");
|
||||
url.query_pairs_mut().append_pair("browserTab", id);
|
||||
if args["pinned"] == true { url.query_pairs_mut().append_pair("browserPinned", "true"); }
|
||||
let result = tauri::WebviewWindowBuilder::new(app, &label, tauri::WebviewUrl::App(format!("?{}", url.query().unwrap_or_default()).into()))
|
||||
.title("RuneStone Browser").inner_size(1100.0, 750.0).min_inner_size(500.0, 300.0).decorations(false).disable_drag_drop_handler().build();
|
||||
let result = crate::window_frame::title_bar(tauri::WebviewWindowBuilder::new(app, &label, tauri::WebviewUrl::App(format!("?{}", url.query().unwrap_or_default()).into())))
|
||||
.title("RuneStone Browser").inner_size(1100.0, 750.0).min_inner_size(500.0, 300.0).disable_drag_drop_handler().build();
|
||||
if let Err(error) = result {
|
||||
worker.routing.lock()?.close(&label);
|
||||
return Err(Error::from(error));
|
||||
|
||||
@@ -15,6 +15,7 @@ mod spelling;
|
||||
mod theme;
|
||||
mod backgrounds;
|
||||
mod folders;
|
||||
mod window_frame;
|
||||
|
||||
use pty::PtyState;
|
||||
use tauri::Manager;
|
||||
@@ -54,6 +55,7 @@ pub fn run() {
|
||||
spelling::spelling_menu_select,
|
||||
spelling::spelling_menu_uninstall,
|
||||
settings::settings_open_window,
|
||||
window_frame::window_snap_layouts,
|
||||
preferences::settings_read,
|
||||
preferences::settings_write,
|
||||
preferences::settings_migrate,
|
||||
|
||||
@@ -86,13 +86,12 @@ pub async fn settings_open_window(
|
||||
let title = root.as_ref()
|
||||
.and_then(|root| root.file_name().map(|name| format!("Settings — {} — RuneStone", name.to_string_lossy())))
|
||||
.unwrap_or_else(|| "Settings — RuneStone".into());
|
||||
match tauri::WebviewWindowBuilder::new(
|
||||
match crate::window_frame::title_bar(tauri::WebviewWindowBuilder::new(
|
||||
&app, &label, tauri::WebviewUrl::App("?settingsWindow=true".into()),
|
||||
)
|
||||
))
|
||||
.title(title)
|
||||
.inner_size(920.0, 650.0)
|
||||
.min_inner_size(540.0, 420.0)
|
||||
.decorations(false)
|
||||
.resizable(true)
|
||||
.visible(false)
|
||||
.disable_drag_drop_handler()
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
//! The window frame: the title bar style of each platform, and Snap Layouts on Windows 11.
|
||||
use crate::error::Result;
|
||||
|
||||
/// Give a window that RuneStone builds at run time the title bar of its platform.
|
||||
/// Windows and Linux windows draw their own title bar. macOS keeps its native traffic lights over the web content.
|
||||
pub fn title_bar<'a, R: tauri::Runtime, M: tauri::Manager<R>>(builder: tauri::WebviewWindowBuilder<'a, R, M>) -> tauri::WebviewWindowBuilder<'a, R, M> {
|
||||
#[cfg(target_os = "macos")]
|
||||
{ builder.title_bar_style(tauri::TitleBarStyle::Overlay).hidden_title(true) }
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
{ builder.decorations(false) }
|
||||
}
|
||||
|
||||
/// Open the Snap Layouts flyout of the focused window, as a native maximize button does on hover.
|
||||
/// The custom title bar has no native caption buttons, so the host presses Win+Z. A window without focus does nothing.
|
||||
#[tauri::command]
|
||||
pub fn window_snap_layouts(window: tauri::Window) -> Result<()> {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use windows_sys::Win32::UI::Input::KeyboardAndMouse::{keybd_event, KEYEVENTF_KEYUP, VK_LWIN};
|
||||
if !window.is_focused().map_err(crate::error::Error::from_display)? { return Ok(()); }
|
||||
unsafe {
|
||||
keybd_event(VK_LWIN as u8, 0, 0, 0);
|
||||
keybd_event(b'Z', 0, 0, 0);
|
||||
keybd_event(b'Z', 0, KEYEVENTF_KEYUP, 0);
|
||||
keybd_event(VK_LWIN as u8, 0, KEYEVENTF_KEYUP, 0);
|
||||
}
|
||||
}
|
||||
#[cfg(not(windows))]
|
||||
{ let _ = window; }
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"title": "RuneStone",
|
||||
"width": 1400,
|
||||
"height": 900,
|
||||
"minWidth": 880,
|
||||
"minHeight": 560,
|
||||
"titleBarStyle": "Overlay",
|
||||
"hiddenTitle": true,
|
||||
"dragDropEnabled": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user