Run through XWayland by default on Wayland so file-manager drops work

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
astar76 2026-10-24 18:31:14 -05:00
commit 0838c0ea61
3 changed files with 9 additions and 0 deletions

View file

@ -92,6 +92,7 @@ fn defaults() -> BTreeMap<&'static str, Value> {
("appearance/font", json!("")),
("appearance/notifications", json!(true)),
("appearance/tray", json!(true)),
("appearance/use_x11", json!(true)),
("appearance/floating_shape", json!(true)),
("appearance/max_fps", json!(30)),
("lastfm/enabled", json!(false)),

View file

@ -38,6 +38,10 @@ fn main() -> eframe::Result {
if win_w < 860.0 || win_h < 560.0 {
(win_w, win_h) = (1380.0, 880.0);
}
// winit cannot receive file drops from file managers on Wayland; through XWayland it can
if config::settings().get_bool("appearance/use_x11") && std::env::var_os("DISPLAY").is_some() && std::env::var_os("WAYLAND_DISPLAY").is_some() {
std::env::remove_var("WAYLAND_DISPLAY");
}
let viewport = egui::ViewportBuilder::default()
.with_title(config::APP_NAME)
.with_app_id("mulberry")

View file

@ -130,6 +130,7 @@ pub struct SettingsState {
notif: bool,
shape: bool,
tray: bool,
x11: bool,
fps: i64,
lfm_on: bool,
lfm_own: bool,
@ -210,6 +211,7 @@ impl Dialog {
notif: s.get_bool("appearance/notifications"),
shape: s.get_bool("appearance/floating_shape"),
tray: s.get_bool("appearance/tray"),
x11: s.get_bool("appearance/use_x11"),
fps: s.get_i64("appearance/max_fps"),
lfm_on: s.get_bool("lastfm/enabled"),
lfm_own: s.get_bool("lastfm/use_own_key"),
@ -1593,6 +1595,7 @@ fn settings_page(app: &mut App, ui: &mut Ui, s: &mut SettingsState) {
checkbox(ui, g, &mut s.artbg, "Album art behind the playlist");
checkbox(ui, g, &mut s.notif, "Desktop notification on track change");
checkbox(ui, g, &mut s.tray, "System tray icon (close to tray)");
checkbox(ui, g, &mut s.x11, "Use XWayland on Wayland (needed to drop files from a file manager; restart to apply)");
row(ui, theme.on_surface_variant, "Animation frame rate", |ui| {
let cur = s.fps.to_string();
if let Some(k) = combo(ui, g, Id::new("set-fps"), &cur, &kv(&[("15", "15 fps (lowest CPU)"), ("24", "24 fps"), ("30", "30 fps (default)"), ("60", "60 fps"), ("0", "Match display refresh rate")]), 260.0) {
@ -1709,6 +1712,7 @@ fn apply_settings(app: &mut App, s: &SettingsState) {
st.set("appearance/playlist_art_bg", s.artbg);
st.set("appearance/notifications", s.notif);
st.set("appearance/tray", s.tray);
st.set("appearance/use_x11", s.x11);
st.set("appearance/floating_shape", s.shape);
st.set("appearance/max_fps", s.fps);
st.set("lastfm/enabled", s.lfm_on);