diff --git a/apps/solidcraft/src/main.rs b/apps/solidcraft/src/main.rs index 4cc2f5055..4f38b1bb0 100644 --- a/apps/solidcraft/src/main.rs +++ b/apps/solidcraft/src/main.rs @@ -289,6 +289,7 @@ fn services(cc: &eframe::CreationContext<'_>) -> Services { Box::pin(async move { future.await.map(|p| p.path().to_string_lossy().into_owned()) }) })), graphics_path: graphics_path().map(|p| p.to_string_lossy().to_string()), + window_system: window_system_now(), http_get: Some(std::sync::Arc::new(http_get)), http_download: Some(std::sync::Arc::new(http_download)), // Already an installed app: only the browser build offers to install. @@ -675,12 +676,24 @@ fn main() -> eframe::Result { #[cfg(all(unix, not(target_os = "macos")))] let mut options = options; #[cfg(all(unix, not(target_os = "macos")))] - if prefer_x11( - std::env::var_os("DISPLAY").is_some(), - std::env::var_os("WAYLAND_DISPLAY").is_some(), - std::env::var("XDG_CURRENT_DESKTOP").ok().as_deref(), - solidcraft_engine::geom::env::var("WAYLAND").as_deref(), - ) { + let x11 = { + // SOLIDCRAFT_WAYLAND wins over Preferences › Graphics › Window system (#3083). + let environment = solidcraft_engine::geom::env::var("WAYLAND"); + let preference = window_system_preference(); + let wayland_override = environment.as_deref().or(window_system_override(preference.as_deref())); + let wayland_display = std::env::var_os("WAYLAND_DISPLAY").is_some(); + let x11 = prefer_x11( + std::env::var_os("DISPLAY").is_some(), + wayland_display, + std::env::var("XDG_CURRENT_DESKTOP").ok().as_deref(), + wayland_override, + ); + // Without a Wayland socket winit opens on X11 anyway. + let _ = WINDOW_SYSTEM.set(if x11 || !wayland_display { "x11" } else { "wayland" }); + x11 + }; + #[cfg(all(unix, not(target_os = "macos")))] + if x11 { options.event_loop_builder = Some(Box::new(|b| { use winit::platform::x11::EventLoopBuilderExtX11; b.with_x11(); @@ -890,6 +903,36 @@ fn no_window(error: eframe::Error, tried_cpu: bool, settings: Option<&std::path: Err(error) } +/// Linux: the window system this run opened with (`wayland` or `x11`), for Preferences (#3083). +#[cfg(all(unix, not(target_os = "macos")))] +static WINDOW_SYSTEM: std::sync::OnceLock<&'static str> = std::sync::OnceLock::new(); + +/// The window system this run uses, where there is a choice (Linux). +fn window_system_now() -> Option<&'static str> { + #[cfg(all(unix, not(target_os = "macos")))] + return WINDOW_SYSTEM.get().copied(); + #[cfg(not(all(unix, not(target_os = "macos"))))] + None +} + +/// Preferences › Graphics › Window system (`graphics.json`'s `window_system`), read before the +/// window opens. +#[cfg(all(unix, not(target_os = "macos")))] +fn window_system_preference() -> Option { + graphics().and_then(|v| v.get("window_system").and_then(serde_json::Value::as_str).map(str::to_string)) +} + +/// The window system preference as the `SOLIDCRAFT_WAYLAND` value it stands for: `wayland` is +/// `1`, `x11` is `0`, and `auto` (or anything else) leaves the choice to [`prefer_x11`]. +#[cfg(all(unix, not(target_os = "macos")))] +fn window_system_override(preference: Option<&str>) -> Option<&'static str> { + match preference.map(str::trim) { + Some("wayland") => Some("1"), + Some("x11") => Some("0"), + _ => None, + } +} + /// Whether to run through XWayland rather than native Wayland. winit has no file drag-and-drop /// on Wayland (only on X11), so dropping files from the file manager showed a "no" cursor: use /// XWayland when it's there. Except on niri, whose XWayland (xwayland-satellite) breaks window @@ -927,6 +970,19 @@ mod backend_tests { assert!(prefer_x11(true, true, Some("niri"), Some("0"))); assert!(!prefer_x11(false, true, Some("niri"), Some("0"))); } + + /// Preferences › Graphics › Window system stands for the same values (#3083). + #[test] + fn the_window_system_preference_maps_to_the_override() { + use super::window_system_override as over; + assert_eq!( + (over(Some("wayland")), over(Some("x11")), over(Some("auto")), over(None), over(Some("junk"))), + (Some("1"), Some("0"), None, None, None) + ); + // Wayland chosen on GNOME keeps native Wayland; X11 chosen on niri goes through XWayland. + assert!(!prefer_x11(true, true, Some("GNOME"), over(Some("wayland")))); + assert!(prefer_x11(true, true, Some("niri"), over(Some("x11")))); + } } #[cfg(test)] diff --git a/assets/locales/en.json b/assets/locales/en.json index aa43f6d49..7f8a1e04e 100644 --- a/assets/locales/en.json +++ b/assets/locales/en.json @@ -1415,6 +1415,9 @@ "settings.reset_intro": "These settings don't work on this computer and would keep SolidCraft from starting, so they were changed:", "settings.reset_title": "Settings were changed", "settings.supersampling_note": "Draws the view at a higher resolution and filters it down: smoother edges, lines and grid on screens below 4K. It costs GPU time: about 2.25× the pixels at 1.5× and 4× at 2×.", + "settings.window_system_details": "Details", + "settings.window_system_note_now": "Applies after a restart. Now: {now}.", + "settings.window_system_wayland_limited": "Some features are limited on native Wayland.", "sheet.no_body": "there is no sheet metal body: start one with Flange > Base, or turn a plate into sheet metal with Convert to Sheet Metal (pick its large flat face)", "shortcut.json_error": "parameters must be JSON: {error}", "shortcut.no_command": "no command `{id}`; the text before the JSON must be a command id", @@ -2343,6 +2346,10 @@ "ui.visual_shaded_with_edges": "Shaded with edges", "ui.visual_style": "Visual style", "ui.visual_wireframe": "Wireframe", + "ui.window_system": "Window system", + "ui.window_system_auto": "Automatic", + "ui.window_system_wayland": "Wayland", + "ui.window_system_x11": "X11", "ui.workspace": "workspace", "ui.workspace_animation_description": "Exploded views, motion studies and storyboards", "ui.workspace_available": "Available", diff --git a/assets/locales/ja.json b/assets/locales/ja.json index 063ae9574..8143f215f 100644 --- a/assets/locales/ja.json +++ b/assets/locales/ja.json @@ -1415,6 +1415,9 @@ "settings.reset_intro": "次の設定はこのコンピューターでは使用できず、SolidCraft が起動できなくなるため変更されました:", "settings.reset_title": "設定が変更されました", "settings.supersampling_note": "ビューを高い解像度で描画してから縮小します。4K 未満の画面でエッジ、線、グリッドが滑らかになります。GPU の負荷が増えます(1.5× で約 2.25 倍、2× で 4 倍のピクセル)。", + "settings.window_system_details": "詳細", + "settings.window_system_note_now": "再起動後に適用されます。現在: {now}。", + "settings.window_system_wayland_limited": "ネイティブ Wayland では一部の機能が制限されます。", "sheet.no_body": "板金ボディがありません。フランジ > Base で作成するか、板金に変換でプレートを板金に変換してください(広い平面を選択)。", "shortcut.json_error": "パラメータはJSON形式で指定してください: {error}", "shortcut.no_command": "コマンド`{id}`がありません。JSONの前のテキストはコマンドIDである必要があります", @@ -2343,6 +2346,10 @@ "ui.visual_shaded_with_edges": "エッジ付きシェーディング", "ui.visual_style": "表示スタイル", "ui.visual_wireframe": "ワイヤーフレーム", + "ui.window_system": "ウィンドウシステム", + "ui.window_system_auto": "自動", + "ui.window_system_wayland": "Wayland", + "ui.window_system_x11": "X11", "ui.workspace": "ワークスペース", "ui.workspace_animation_description": "分解図、モーション スタディ、ストーリーボード", "ui.workspace_available": "利用可能", diff --git a/assets/locales/zh.json b/assets/locales/zh.json index 8797c06ca..a33132956 100644 --- a/assets/locales/zh.json +++ b/assets/locales/zh.json @@ -1415,6 +1415,9 @@ "settings.reset_intro": "这些设置在此计算机上无法正常工作,会导致 SolidCraft 无法启动,因此已更改:", "settings.reset_title": "设置已更改", "settings.supersampling_note": "以更高分辨率绘制视图再缩小:在低于 4K 的屏幕上边、线和网格更平滑。会消耗 GPU 时间:1.5× 时约 2.25 倍像素,2× 时 4 倍。", + "settings.window_system_details": "详情", + "settings.window_system_note_now": "重启后生效。当前:{now}。", + "settings.window_system_wayland_limited": "在原生 Wayland 下部分功能受限。", "sheet.no_body": "没有钣金实体:请使用法兰 > Base 创建,或使用转换为钣金将板材转换为钣金(选择其较大的平面)。", "shortcut.json_error": "参数必须采用 JSON 格式:{error}", "shortcut.no_command": "没有命令 `{id}`;JSON 前的文本必须是命令 ID", @@ -2343,6 +2346,10 @@ "ui.visual_shaded_with_edges": "带边着色", "ui.visual_style": "视觉样式", "ui.visual_wireframe": "线框", + "ui.window_system": "窗口系统", + "ui.window_system_auto": "自动", + "ui.window_system_wayland": "Wayland", + "ui.window_system_x11": "X11", "ui.workspace": "工作区", "ui.workspace_animation_description": "爆炸视图、运动研究和故事板", "ui.workspace_available": "可用", diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 0ceb1b21b..6683cba13 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -356,6 +356,8 @@ pub struct Services { pub show_in_folder: Option>, /// Where the host reads the anti-aliasing preference at start (a small JSON file). pub graphics_path: Option, + /// Linux: the window system this run uses, `wayland` or `x11` (Preferences shows it, #3083). + pub window_system: Option<&'static str>, /// HTTPS GET for the update check (`update`); None: never check (browser, tests). pub http_get: Option, /// HTTPS download to a file, with progress, for one-click updates (`update::install`). diff --git a/crates/ui-egui/src/prefs.rs b/crates/ui-egui/src/prefs.rs index f9c243fbd..f1dc7546a 100644 --- a/crates/ui-egui/src/prefs.rs +++ b/crates/ui-egui/src/prefs.rs @@ -508,6 +508,9 @@ preference_settings! { space_mouse_offered: std::collections::BTreeSet = Default::default(); /// Anti-aliasing samples (applies on restart). msaa: u32 = 4, PAGE_GRAPHICS; + /// Linux: the window system the app opens with at its next start (#3083): `auto` (XWayland + /// whenever there is an X display, native Wayland on niri), `wayland` or `x11`. + window_system: String = "auto".into(), PAGE_GRAPHICS; /// Soft contact shading in the GPU viewport; optional and applied immediately. ambient_occlusion: bool = false, PAGE_GRAPHICS; /// The grid turns to the upright origin plane facing a side view (#1470). Off by default: the @@ -744,7 +747,7 @@ impl Snapshot { } } fn restore(self, app: &mut SolveApp) { - let msaa = app.preferences.msaa; + let graphics = (app.preferences.msaa, app.preferences.window_system.clone()); let units_changed = app.preferences.default_units != self.prefs.default_units; // Update bookkeeping isn't a setting: a check that finished while the dialog was open stays. let update = std::mem::take(&mut app.preferences.update); @@ -765,7 +768,7 @@ impl Snapshot { set_autosave(app); app.session.auto_project = self.auto_project; app.keymap.custom = self.keys; - if app.preferences.msaa != msaa { + if (app.preferences.msaa, app.preferences.window_system.clone()) != graphics { save_graphics(app); } } @@ -920,7 +923,7 @@ fn ui_font_row(app: &mut SolveApp, ui: &mut egui::Ui) { /// Restore Defaults for one page. fn defaults(app: &mut SolveApp, page: usize) { - let msaa = app.preferences.msaa; + let (msaa, window_system) = (app.preferences.msaa, app.preferences.window_system.clone()); let units = app.preferences.default_units.clone(); reset_preferences(&mut app.preferences, page); if app.preferences.default_units != units { @@ -943,7 +946,7 @@ fn defaults(app: &mut SolveApp, page: usize) { app.ui.show_grid = true; app.ui.ground_shadow = true; app.ui.perspective = false; - if app.preferences.msaa != msaa { + if app.preferences.msaa != msaa || app.preferences.window_system != window_system { save_graphics(app); } } @@ -1133,8 +1136,46 @@ pub fn show_mm_bare(app: &SolveApp, v: f64) -> String { length_number(v, &app.session.doc.units, app.preferences.length_decimals) } -/// Write the anti-aliasing setting where the host reads it at start (the window's samples can't -/// change while it is open). +/// The window system choices (`Prefs::window_system`, #3083). +pub const WINDOW_SYSTEMS: [&str; 3] = ["auto", "wayland", "x11"]; +/// winit's issue for dropping files onto a window on native Wayland, which the note links to. +pub const WAYLAND_DROP_ISSUE: &str = "https://github.com/rust-windowing/winit/issues/1881"; + +/// Linux: Graphics › Window system (#3083). It applies at the next start; the note under it says +/// which one is running now, and when native Wayland is in use or chosen, that some features are +/// limited there, linking to [`WAYLAND_DROP_ISSUE`]. +#[cfg(target_os = "linux")] +fn window_system_row(app: &mut SolveApp, ui: &mut egui::Ui) { + let t = Tokens::get(); + let label = |id: &str| crate::i18n::tr(&format!("ui.window_system_{id}")).to_string(); + let labels = WINDOW_SYSTEMS.map(label); + // The note below says that it applies after a restart, and which one runs now. + let response = ui.allocate_ui_with_layout(egui::vec2(t.form_card_width, 0.0), egui::Layout::top_down(egui::Align::Min), |ui| { + let mut selected = WINDOW_SYSTEMS.iter().position(|id| *id == app.preferences.window_system).unwrap_or(0); + if ui_kit::segmented(ui, &mut selected, &labels.each_ref().map(String::as_str), ui_kit::Segments::default()) + && let Some(id) = WINDOW_SYSTEMS.get(selected) + { + app.preferences.window_system = (*id).into(); + } + }); + crate::scenario::publish_handle("prefs:window_system", response.response.rect.center()); + let now = app.services.window_system.map(label); + let text = match &now { + Some(now) => crate::i18n::format("settings.window_system_note_now", &[("now", now)]), + None => app.tr("settings.msaa_applies_on_restart").to_string(), + }; + ui_kit::text(ui, &text, ui_kit::Text::Hint("window_system")); + let choice = app.preferences.window_system.as_str(); + if choice == "wayland" || (choice == "auto" && app.services.window_system == Some("wayland")) { + ui.horizontal_wrapped(|ui| { + ui.label(egui::RichText::new(app.tr("settings.window_system_wayland_limited")).size(t.font_small).color(t.warning)); + ui.hyperlink_to(egui::RichText::new(app.tr("settings.window_system_details")).size(t.font_small), WAYLAND_DROP_ISSUE); + }); + } +} + +/// Write the anti-aliasing and window system settings where the host reads them at start (neither +/// can change while the window is open). fn save_graphics(app: &SolveApp) { if let Some(path) = &app.services.graphics_path { // Other settings in the file (the graphics `backend`) stay as they are. @@ -1144,6 +1185,7 @@ fn save_graphics(app: &SolveApp) { .filter(serde_json::Value::is_object) .unwrap_or_else(|| json!({})); graphics["msaa"] = json!(app.preferences.msaa); + graphics["window_system"] = json!(app.preferences.window_system); let _ = std::fs::write(path, graphics.to_string()); } } @@ -1256,7 +1298,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) { ui_kit::Action::Cancel => Some("cancel"), ui_kit::Action::None => button, }; - if app.preferences.msaa != before.msaa { + if app.preferences.msaa != before.msaa || app.preferences.window_system != before.window_system { save_graphics(app); } if app.preferences.up_axis != before.up_axis { @@ -2093,6 +2135,9 @@ pub fn set(app: &mut SolveApp, p: &serde_json::Value) -> Result>().join(", "))); } @@ -2137,7 +2182,7 @@ pub fn set(app: &mut SolveApp, p: &serde_json::Value) -> Result serde_json::Value { serde_json::from_str(&std::fs::read_to_string(&path).unwrap_or_default()).unwrap_or_default() }; + let mut h = crate::scenario::Harness::new(); + h.app.services.graphics_path = Some(path.to_string_lossy().to_string()); + h.app.services.window_system = Some("x11"); + assert_eq!(h.app.preferences.window_system, "auto"); + let out = h.call("ui.prefs", json!({"window_system": "wayland"})); + assert_eq!(out["result"]["window_system"], "wayland", "{out}"); + assert_eq!((saved()["window_system"].as_str(), saved()["backend"].as_str()), (Some("wayland"), Some("vulkan")), "the other settings stay"); + assert!(h.call("ui.prefs", json!({"window_system": "mir"}))["error"].as_str().is_some_and(|e| e.contains("window_system"))); + assert_eq!(h.app.preferences.window_system, "wayland", "a refused value changes nothing"); + + h.call("ui.prefs", json!({"open": "Graphics"})); + h.frames(2); + assert_eq!(crate::scenario::handle_at("prefs:window_system").is_some(), cfg!(target_os = "linux"), "the row is on Linux only"); + h.call("ui.prefs", json!({"window_system": "x11"})); + let out = h.call("ui.prefs", json!({"button": "cancel"})); + assert_eq!(out["result"]["window_system"], "wayland", "Cancel takes the change back"); + assert_eq!(saved()["window_system"], "wayland", "and the file with it"); + let _ = std::fs::remove_dir_all(&dir); + } + #[test] fn unsupported_saved_msaa_is_reset_to_the_default_with_a_notice() { let dir = std::env::temp_dir().join(format!("sc_msaa_reset_{}", std::process::id())); diff --git a/crates/ui-egui/src/prefs/graphics.rs b/crates/ui-egui/src/prefs/graphics.rs index 1ab40ec26..869a52599 100644 --- a/crates/ui-egui/src/prefs/graphics.rs +++ b/crates/ui-egui/src/prefs/graphics.rs @@ -143,6 +143,8 @@ pub(super) fn show(app: &mut SolveApp, ui: &mut egui::Ui) { }); }); }); + #[cfg(target_os = "linux")] + ui_kit::settings_section(ui, "window_system", app.tr("ui.window_system"), |ui| window_system_row(app, ui)); ui.horizontal(|ui| { ui_kit::text(ui, app.tr_label("Renderer"), ui_kit::Text::Inline); let renderer = match (&app.viewport.gpu, &app.help.gpu) { diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 59491bd13..df25c5ffb 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -236,7 +236,7 @@ labels; `prefs:measure_axis_distances` identifies the checkbox. | `ui.home` | `open?`: bool; `sample?`: index | the start page: show or hide it, open a built-in sample (once built); returns `open` and the recent designs | | `ui.shortcut` | `command`, `key?`, `replace?` | a command's key, or rebinds it (`""` clears; a key another command uses is refused unless `replace`) | | `ui.help` | `item?`: `about`, `shortcuts` (read only), `report` (opens a report draft for review), `crashes` (the Crash Reports window) | the version, commit, build date and diagnostic text | -| `ui.prefs` | any of `default_units`, `nav` (`fusion`, `solidworks`, `inventor`, `alias`, `blender`, `tinkercad`, `openscad`, `touchpad`), `zoom_reverse`, `pan_reverse_x` (default false: horizontal scrolling pans the other way), `zoom_to_cursor`, `smooth_wheel_zoom` (default true), `trackpad_pan` (default true: two-finger scroll pans, except Touchpad always zooms; pinch zooms), `orbit_around` (`view_centre` (default: what Pan moves and Fit frames), `origin` (the world origin stays still on screen), `cursor` (the model point under the pointer when the drag began); the older `orbit_cursor` boolean still sets `cursor` when true), `look_at_anim`, `look_at_speed`, `middle_double_click` (`home` (default), `fit`, `off`), `msaa`, `show_frame_rate` (default false: frames per second in the view's bottom-right corner, counting the frames the view draws anyway; it reads 0 FPS once the view is idle), `length_decimals`, `angle_decimals`, `theme` (`dark`, `light`, `system` or a theme file's id: a built-in one such as `gruvbox-dark`, or an imported one; the reply's `theme_ids` lists them), `theme_import` (a `solidcraft-theme/1` file's JSON or text: adds the theme and turns it on; the reply's `theme_imported` is its id), `theme_remove` (an imported theme's id), `theme_export: true` (the reply's `theme_file` is the theme on now as a complete file; see [colour themes](book/src/guide/ui-tour.md#colour-themes)), `language` (`en`, `ja`, `de`, `fr`, `ko`, `ms`, `ru`, `uk`, `zh`; see [localization](localization.md)), `ui_scale`, `ui_font` (an installed font family or a font file for the interface; empty for the built-in font), `up_axis` (`z`, `y`), `offer_stand_up`, `extrude_auto_to_object` (default false: in the Extrude dialog, with a profile picked, a face, vertex or parallel plane picked off its plane switches the extent to To Object; it applies to Extrude dialogs opened afterwards), `hole_snaps` (default false: a Single hole snaps to its face's middle and round edges' centres), `hole_moves` (default false: a placed Single hole has a drag handle (`hole:`), and a pick on a face that has a hole moves it there), `color_vision` (`off` (default), `protan`, `deutan`, `tritan`: colour vision modes, #778), `check_updates` (default true; [updates](book/src/guide/updates.md)); `open` (a page: General, Interface, Design, Navigation, Keyboard Shortcuts, Sketch, Graphics, AI, Plugins; Shortcuts, Assistant and Sketch & selection are aliases, and the former Selection page opens Sketch) opens the Preferences dialog there; `button`: `ok`, `cancel`, `apply`, `defaults`; `stand_up: true` stands up a just-opened Y-up file, `stand_up: false` leaves it as it is ("Leave it": the offer closes and `offer_stand_up` stays on); the offer's buttons are the handles `stand_up:stand`, `stand_up:leave` and `stand_up:never` | sets preferences (kept between runs), returns them all plus `dialog` (the open page or null), `dark` and `stand_up_offer` | +| `ui.prefs` | any of `default_units`, `nav` (`fusion`, `solidworks`, `inventor`, `alias`, `blender`, `tinkercad`, `openscad`, `touchpad`), `zoom_reverse`, `pan_reverse_x` (default false: horizontal scrolling pans the other way), `zoom_to_cursor`, `smooth_wheel_zoom` (default true), `trackpad_pan` (default true: two-finger scroll pans, except Touchpad always zooms; pinch zooms), `orbit_around` (`view_centre` (default: what Pan moves and Fit frames), `origin` (the world origin stays still on screen), `cursor` (the model point under the pointer when the drag began); the older `orbit_cursor` boolean still sets `cursor` when true), `look_at_anim`, `look_at_speed`, `middle_double_click` (`home` (default), `fit`, `off`), `msaa`, `show_frame_rate` (default false: frames per second in the view's bottom-right corner, counting the frames the view draws anyway; it reads 0 FPS once the view is idle), `window_system` (Linux: `auto` (default: XWayland whenever there is an X display, native Wayland on niri), `wayland`, `x11`; saved in `graphics.json`, applies at the next start; `SOLIDCRAFT_WAYLAND` overrides it), `length_decimals`, `angle_decimals`, `theme` (`dark`, `light`, `system` or a theme file's id: a built-in one such as `gruvbox-dark`, or an imported one; the reply's `theme_ids` lists them), `theme_import` (a `solidcraft-theme/1` file's JSON or text: adds the theme and turns it on; the reply's `theme_imported` is its id), `theme_remove` (an imported theme's id), `theme_export: true` (the reply's `theme_file` is the theme on now as a complete file; see [colour themes](book/src/guide/ui-tour.md#colour-themes)), `language` (`en`, `ja`, `de`, `fr`, `ko`, `ms`, `ru`, `uk`, `zh`; see [localization](localization.md)), `ui_scale`, `ui_font` (an installed font family or a font file for the interface; empty for the built-in font), `up_axis` (`z`, `y`), `offer_stand_up`, `extrude_auto_to_object` (default false: in the Extrude dialog, with a profile picked, a face, vertex or parallel plane picked off its plane switches the extent to To Object; it applies to Extrude dialogs opened afterwards), `hole_snaps` (default false: a Single hole snaps to its face's middle and round edges' centres), `hole_moves` (default false: a placed Single hole has a drag handle (`hole:`), and a pick on a face that has a hole moves it there), `color_vision` (`off` (default), `protan`, `deutan`, `tritan`: colour vision modes, #778), `check_updates` (default true; [updates](book/src/guide/updates.md)); `open` (a page: General, Interface, Design, Navigation, Keyboard Shortcuts, Sketch, Graphics, AI, Plugins; Shortcuts, Assistant and Sketch & selection are aliases, and the former Selection page opens Sketch) opens the Preferences dialog there; `button`: `ok`, `cancel`, `apply`, `defaults`; `stand_up: true` stands up a just-opened Y-up file, `stand_up: false` leaves it as it is ("Leave it": the offer closes and `offer_stand_up` stays on); the offer's buttons are the handles `stand_up:stand`, `stand_up:leave` and `stand_up:never` | sets preferences (kept between runs), returns them all plus `dialog` (the open page or null), `dark` and `stand_up_offer` | | `ui.capture` | `action?`: `capture`, `revert`, `cancel` | answers the Capture Position question (asked when a command starts or the design is saved while components were moved without capturing); without `action`, what waits | | `ui.window` | `action`: minimize, maximize, restore, toggle, close | what the title bar's caption buttons do (on Windows and Linux the application bar is the title bar); close asks about unsaved designs first | | `ui.agent_cursor` | `show` (bool), `speed`: a number from 1 to 5 (times the normal speed) or `"instant"` (no animation: the command runs at once and the pointer jumps to where it acted), `follow_camera` (bool); all optional | the settings. While the cursor is shown, `engine.execute` first glides to the command's toolbar button and to each pick, then runs and replies; later requests wait their turn. It also follows the pointer input sent with `ui.move`, `ui.click`, `ui.drag` and `ui.scroll`, as each event reaches the app, and a press leaves a ripple. `"animate": false` on a call skips it | diff --git a/docs/nix.md b/docs/nix.md index 9ae2d3fa8..265db81ac 100644 --- a/docs/nix.md +++ b/docs/nix.md @@ -97,7 +97,13 @@ under niri's XWayland. The trade-off: **on native Wayland, dropping files onto t window does not work**; use File > Open or pass the file on the command line. This applies to every build, not only the Nix package. -Override the choice with `SOLIDCRAFT_WAYLAND=1` (always native Wayland) or +Choose it in Preferences › Graphics › **Window system** (Automatic, Wayland or X11; it applies +at the next start). The pane says which one is running and, on native Wayland, links to +winit's issue about dropping files there. Native Wayland is the better choice with +**fractional scaling** (a monitor at 125 % or 140 %): XWayland windows are drawn at 100 % and +stretched by the compositor, so the interface looks soft and small. + +The environment overrides the preference: `SOLIDCRAFT_WAYLAND=1` (always native Wayland) or `SOLIDCRAFT_WAYLAND=0` (XWayland whenever an X display is available). ## Development shells