Linux: session-native GDK/WebKit mitigations and in-page browse scroll (#731)

* feat(linux): session GDK defaults, nvidia-quirk, optional x11-legacy wrap

Ship PSYSONIC_ALLOW_NATIVE_GDK from Nix/AUR instead of pinning WEBKIT_DISABLE_*
and GDK x11. Add flake psysonic-x11-legacy for the old wrap; alias gdk-session
to psysonic. Startup uses webkit2gtk-nvidia-quirk and Wayland-aware compositing;
refresh Help (a45) and nixos-install docs.

* fix(linux): session GDK and nvidia-quirk only; drop wrapper env heuristics

Remove PSYSONIC_ALLOW_NATIVE_GDK and devShell GDK/WEBKIT exports; stop
synthesizing GDK/WebKit vars in main.rs. Update Nix/AUR wrappers, install
docs, CHANGELOG, and help FAQ with practical user-facing workarounds.

* fix(linux): X11-pinned GDK uses DMABUF quirk path, not Wayland explicit-sync

When GDK_BACKEND is forced to x11 on a wayland user session, webkit2gtk-nvidia-quirk
would still apply __NV_DISABLE_EXPLICIT_SYNC and gray out the webview. Map that case
to WEBKIT_DISABLE_DMABUF_RENDERER like native X11.

* fix(ui): stabilize WebKitGTK/Wayland hover paint for nav and media cards

Sidebar nav links avoid transition:all and promote icons with translateZ(0).
Artist rows and album/artist/song cards use compositing hints; card shadows
and borders no longer interpolate so cover zoom can stay smooth without jitter.

* fix(ui): isolate artist/album card text and cover paint on WebKitGTK

Promote cover blocks with contain/paint and text stacks with translateZ(0);
use artist-card-info on the artists grid for the same layout as other cards.

* feat(artists): in-page overlay scroll and locked main viewport

Move list/grid into an inner OverlayScrollArea, stop sticky toolbar from
owning the route scroll, align the rail with the main panel edge, and skip
the main-route overlay thumb when the viewport cannot scroll vertically.

* feat(browse): extend in-page overlay scroll to more library routes

Reuse the locked main viewport pattern from Artists for Albums, Composers,
Lossless albums, and New releases; wire VirtualCardGrid and scroll chrome
to the matching in-page viewport ids.

* fix(linux): improve Wayland GPU compositing text clarity in WebKitGTK

Use on-demand hardware acceleration on main and mini webviews when the
session is Wayland and compositing stays on; gate subpixel body AA on the
same conditions via new Tauri probes. Document PSYSONIC_SKIP_WAYLAND_FONT_TUNING
for opt-out and changelog.

* fix(rust): satisfy clippy needless_return in Linux webkit helpers

* fix(linux): tune Wayland text rendering with HW policy env and CSS

Allow PSYSONIC_WEBKIT_WAYLAND_HW_POLICY to select WebKit hardware
acceleration policy (never/always vs default on-demand). Extend Wayland
font CSS to #root with geometricPrecision and text-size-adjust on html.

* feat(linux): Wayland text presets in settings, safe WebKit apply, CPU default

Persist profile to app config; apply WebKit policy at startup/mini only to
avoid WebKitGTK hangs on live toggles. UI + CSS preview stays live; default
preset is sharp (CPU-friendly).

* fix(linux): map Wayland sharp preset to OnDemand WebKit policy

HardwareAccelerationPolicy::Never at startup broke main-viewport wheel
scrolling on WebKitGTK+Wayland; sharp vs balanced remains a CSS AA path.
Use PSYSONIC_WEBKIT_WAYLAND_HW_POLICY for a true Never policy.

* fix(rust): gate Linux-only Wayland WebKit helpers for Windows builds

Re-export startup helpers only under cfg(linux) and drop non-Linux stubs so
Windows compiles without unused-import and dead-code warnings.

* chore(release): CHANGELOG + credits for Linux session/WebKit work (PR #731)

Consolidate scattered incremental changelog notes into two [1.47.0]
entries with PR link; remove duplicate Linux blocks from [1.46.0] Fixed.
Append settings credit line for cucadmuh.
This commit is contained in:
cucadmuh
2026-05-18 21:00:46 +03:00
committed by GitHub
parent b4782aeedb
commit 70c2fdfbf9
61 changed files with 1602 additions and 712 deletions
+20 -5
View File
@@ -1,4 +1,4 @@
import React, { useRef } from 'react';
import React, { useCallback, useRef } from 'react';
import { useVirtualizer } from '@tanstack/react-virtual';
import { APP_MAIN_SCROLL_VIEWPORT_ID } from '../constants/appScroll';
import { useElementClientHeightById } from '../hooks/useResizeClientHeight';
@@ -20,11 +20,14 @@ export type VirtualCardGridProps<T> = {
wrapStyle?: React.CSSProperties;
/** Defaults to `var(--space-4)`; composer grid uses `var(--space-2)`. */
gridGap?: string;
/** When set, row virtualization uses this scroll container instead of the main route viewport. */
scrollRootId?: string;
};
/**
* Album-/playlist-style card grids: at most six columns, proportional stretch,
* optional row virtualization with scroll root `#APP_MAIN_SCROLL_VIEWPORT_ID`.
* optional row virtualization with scroll root `#APP_MAIN_SCROLL_VIEWPORT_ID`
* (or `scrollRootId` when the grid lives in an in-page overlay viewport).
*/
export function VirtualCardGrid<T>({
items,
@@ -36,13 +39,25 @@ export function VirtualCardGrid<T>({
wrapClassName = 'album-grid-wrap',
wrapStyle,
gridGap = 'var(--space-4)',
scrollRootId,
}: VirtualCardGridProps<T>): React.JSX.Element {
const wrapRef = useRef<HTMLDivElement>(null);
const { gridCols, rowHeightEst } = useCardGridMetrics(wrapRef, true, rowVariant, layoutSignal);
const cols = Math.max(1, gridCols);
const virtualRowCount = Math.max(0, Math.ceil(items.length / cols));
const mainScrollViewportHeight = useElementClientHeightById(APP_MAIN_SCROLL_VIEWPORT_ID);
const overscan = Math.max(2, Math.ceil(mainScrollViewportHeight / Math.max(1, rowHeightEst)));
const scrollMetricsElementId = scrollRootId ?? APP_MAIN_SCROLL_VIEWPORT_ID;
const scrollViewportClientHeight = useElementClientHeightById(scrollMetricsElementId);
const overscan = Math.max(2, Math.ceil(scrollViewportClientHeight / Math.max(1, rowHeightEst)));
const getScrollElement = useCallback((): HTMLElement | null => {
if (scrollRootId) {
return (
document.getElementById(scrollRootId) as HTMLElement | null
?? (document.getElementById(APP_MAIN_SCROLL_VIEWPORT_ID) as HTMLElement | null)
);
}
return document.getElementById(APP_MAIN_SCROLL_VIEWPORT_ID) as HTMLElement | null;
}, [scrollRootId]);
const scrollMargin = useVirtualizerScrollMargin(
wrapRef,
@@ -55,7 +70,7 @@ export function VirtualCardGrid<T>({
const virtualizer = useVirtualizer({
count: disableVirtualization ? 0 : virtualRowCount,
getScrollElement: () => document.getElementById(APP_MAIN_SCROLL_VIEWPORT_ID),
getScrollElement,
estimateSize: () => rowHeightEst,
overscan,
scrollMargin,
+1 -1
View File
@@ -57,7 +57,7 @@ function ArtistGridTile({ artist, ...rest }: TileProps) {
</div>
)}
<ArtistCardAvatar artist={artist} showImages={rest.showArtistImages} />
<div style={{ textAlign: 'center' }}>
<div className="artist-card-info artist-card-info--center">
<div className="artist-card-name">{artist.name}</div>
{artist.albumCount != null && (
<div className="artist-card-meta">{rest.t('artists.albumCount', { count: artist.albumCount })}</div>
+31 -1
View File
@@ -1,3 +1,4 @@
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { invoke } from '@tauri-apps/api/core';
@@ -7,7 +8,7 @@ import { AppWindow, ChevronDown, Download, ExternalLink, Globe, HardDrive, Info,
import { version as appVersion } from '../../../package.json';
import i18n from '../../i18n';
import { useAuthStore } from '../../store/authStore';
import type { ClockFormat, LoggingMode } from '../../store/authStoreTypes';
import type { ClockFormat, LinuxWaylandTextRenderProfile, LoggingMode } from '../../store/authStoreTypes';
import { IS_LINUX } from '../../utils/platform';
import { showToast } from '../../utils/ui/toast';
import { AboutPsysonicBrandHeader } from '../AboutPsysonicLol';
@@ -21,6 +22,14 @@ export function SystemTab() {
const { t } = useTranslation();
const navigate = useNavigate();
const auth = useAuthStore();
const [waylandTextRenderAvailable, setWaylandTextRenderAvailable] = useState(false);
useEffect(() => {
if (!IS_LINUX) return;
invoke<boolean>('linux_wayland_text_render_settings_available')
.then(setWaylandTextRenderAvailable)
.catch(() => {});
}, []);
const exportRuntimeLogs = async () => {
const suggestedName = `psysonic-logs-${new Date().toISOString().replace(/[:.]/g, '-')}.log`;
@@ -110,6 +119,27 @@ export function SystemTab() {
<span className="toggle-track" />
</label>
</div>
{waylandTextRenderAvailable && (
<>
<div className="settings-section-divider" />
<div className="form-group" style={{ maxWidth: '420px' }}>
<div style={{ fontWeight: 500 }}>{t('settings.linuxWaylandTextRender')}</div>
<div style={{ fontSize: 12, color: 'var(--text-muted)', marginBottom: '0.5rem' }}>
{t('settings.linuxWaylandTextRenderDesc')}
</div>
<CustomSelect
value={auth.linuxWaylandTextRenderProfile}
onChange={v => auth.setLinuxWaylandTextRenderProfile(v as LinuxWaylandTextRenderProfile)}
options={[
{ value: 'balanced', label: t('settings.linuxWaylandTextRenderBalanced') },
{ value: 'sharp', label: t('settings.linuxWaylandTextRenderSharp') },
{ value: 'gpu', label: t('settings.linuxWaylandTextRenderGpu') },
{ value: 'minimal', label: t('settings.linuxWaylandTextRenderMinimal') },
]}
/>
</div>
</>
)}
</>
)}
<div className="settings-section-divider" />