diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index 71c069a9f4..6974eb7fbd 100644 --- a/crates/gpui/src/platform/linux/platform.rs +++ b/crates/gpui/src/platform/linux/platform.rs @@ -34,7 +34,7 @@ use wayland_protocols::wp::cursor_shape::v1::client::wp_cursor_shape_device_v1:: use xkbcommon::xkb::{self, Keycode, Keysym, State}; use crate::platform::linux::wayland::WaylandClient; -use crate::platform::linux::xdg_desktop_portal::window_appearance; +use crate::platform::linux::xdg_desktop_portal::{should_auto_hide_scrollbars, window_appearance}; use crate::{ px, Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CosmicTextSystem, CursorStyle, DisplayId, ForegroundExecutor, Keymap, Keystroke, LinuxDispatcher, Menu, MenuItem, Modifiers, @@ -90,6 +90,7 @@ pub(crate) struct LinuxCommon { pub(crate) foreground_executor: ForegroundExecutor, pub(crate) text_system: Arc, pub(crate) appearance: WindowAppearance, + pub(crate) auto_hide_scrollbars: bool, pub(crate) callbacks: PlatformHandlers, pub(crate) signal: LoopSignal, } @@ -106,12 +107,15 @@ impl LinuxCommon { let appearance = window_appearance(&background_executor) .log_err() .unwrap_or(WindowAppearance::Light); + let auto_hide_scrollbars = + should_auto_hide_scrollbars(&background_executor).unwrap_or(false); let common = LinuxCommon { background_executor, foreground_executor: ForegroundExecutor::new(dispatcher.clone()), text_system, appearance, + auto_hide_scrollbars, callbacks, signal, }; @@ -402,9 +406,8 @@ impl Platform for P { self.set_cursor_style(style) } - // todo(linux) fn should_auto_hide_scrollbars(&self) -> bool { - false + self.with_common(|common| common.auto_hide_scrollbars) } fn write_credentials(&self, url: &str, username: &str, password: &[u8]) -> Task> { diff --git a/crates/gpui/src/platform/linux/xdg_desktop_portal.rs b/crates/gpui/src/platform/linux/xdg_desktop_portal.rs index e23af679b5..6711572793 100644 --- a/crates/gpui/src/platform/linux/xdg_desktop_portal.rs +++ b/crates/gpui/src/platform/linux/xdg_desktop_portal.rs @@ -131,3 +131,14 @@ pub fn window_appearance(executor: &BackgroundExecutor) -> Result Result { + executor.block(async { + let settings = Settings::new().await?; + let auto_hide = settings + .read::("org.gnome.desktop.interface", "overlay-scrolling") + .await?; + + Ok(auto_hide) + }) +}