feat: use the desktop's file picker on linux
This commit is contained in:
1 parent
344d50e1f6
commit
3f81e125f1
3 files changed
+46
No files matched your search
@@ -27,6 +27,7 @@ works.
|
||||
| `0012-Launch-a-running-instance-...` | A running instance can be started again on another account, with a console per copy. |
|
||||
| `0013-Explain-what-went-wrong-...` | The Logs tab says what a crash was and offers a fix where there is one, without a connection. |
|
||||
| `0014-Browse-skins-from-...` | A Browse tab on the skin page: Ely.by's catalogue in the app, and NameMC, laby.net and crafty.gg in a window. |
|
||||
| `0015-Use-the-desktop-s-file-picker-...` | File pickers on Linux are the desktop's own, such as KDE's, through the XDG desktop portal. |
|
||||
|
||||
### Offline accounts
|
||||
|
||||
@@ -96,6 +97,10 @@ A click with the middle mouse button on anything that scrolls starts autoscroll:
|
||||
to scroll until the next click, or hold and drag to scroll until you let go. Links and text fields
|
||||
keep their middle-click. Windows is left alone, since WebView2 autoscrolls by itself.
|
||||
|
||||
File pickers on Linux go through the XDG desktop portal, so KDE shows its own dialog and GNOME its
|
||||
own, instead of a GTK dialog the AppImage themes as light Adwaita. Without a portal, GTK's dialog is
|
||||
used as before. Windows and macOS already use their native pickers.
|
||||
|
||||
### Skins
|
||||
|
||||
With an Ely.by account selected, the skin page shows the account's skins on Ely.by: apply one, add
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Modrinth Enhanced <patches@modrinth-enhanced.invalid>
|
||||
Date: Tue, 15 Sep 2026 14:25:43 +0200
|
||||
Subject: [PATCH] Use the desktop's file picker on Linux
|
||||
|
||||
File pickers - the webview's own, like the skin page's, and the dialog
|
||||
plugin's - are GtkFileChooserNative on Linux, which only uses the XDG
|
||||
desktop portal when asked. Unasked, it draws a GTK dialog, and inside the
|
||||
AppImage that dialog is themed as light Adwaita whatever the desktop
|
||||
looks like. GTK_USE_PORTAL is now set at startup, so KDE shows its own
|
||||
file dialog and GNOME its own. A player who set it already keeps their
|
||||
value, and without a portal GTK falls back to its own dialog as before.
|
||||
|
||||
Windows and macOS already use the native pickers.
|
||||
---
|
||||
apps/app/src/main.rs | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/apps/app/src/main.rs b/apps/app/src/main.rs
|
||||
index 04eedbd..4c269a3 100644
|
||||
--- a/apps/app/src/main.rs
|
||||
+++ b/apps/app/src/main.rs
|
||||
@@ -115,6 +115,16 @@ async fn set_restart_after_pending_update(
|
||||
// if Tauri app is called with arguments, then those arguments will be treated as commands
|
||||
// ie: deep links or filepaths for .mrpacks
|
||||
fn main() {
|
||||
+ // File pickers on Linux - the webview's own and the dialog plugin's, both
|
||||
+ // GtkFileChooserNative - go through the desktop portal, so KDE and GNOME
|
||||
+ // show their own dialog rather than a GTK one the AppImage themes as
|
||||
+ // Adwaita. Without a portal, GTK falls back to its own dialog.
|
||||
+ #[cfg(target_os = "linux")]
|
||||
+ if std::env::var_os("GTK_USE_PORTAL").is_none() {
|
||||
+ // SAFETY: nothing else is running yet.
|
||||
+ unsafe { std::env::set_var("GTK_USE_PORTAL", "1") };
|
||||
+ }
|
||||
+
|
||||
#[cfg(feature = "export-app-events")]
|
||||
theseus::export_app_event_bindings(
|
||||
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
@@ -156,6 +156,8 @@ check "its corners are rounded" \
|
||||
contains "$WORKTREE/apps/app-frontend/src/App.vue" "'rounded-window'"
|
||||
check "the middle button autoscrolls" \
|
||||
contains "$WORKTREE/apps/app-frontend/src/App.vue" 'installAutoscroll()'
|
||||
check "file pickers use the desktop portal on Linux" \
|
||||
contains "$WORKTREE/apps/app/src/main.rs" 'set_var("GTK_USE_PORTAL", "1")'
|
||||
|
||||
log "No advertising or upsells"
|
||||
check "no Modrinth+ upsell in the app" \
|
||||
|
||||
Reference in new issue
Block a user