# Standalone build of KDE's xembedsniproxy, which nixpkgs only ships inside # plasma-workspace (and so drags in most of Plasma). It bridges legacy XEmbed tray # icons (Wine/Proton apps such as Battle.net) to StatusNotifierItem so they show up # in Waybar's tray instead of as a stray floating window. # # Builds just the xembed-sni-proxy directory of the official plasma-workspace # tarball with our own CMakeLists.txt. The tarball is pinned to the release the # patches were written against. { lib, stdenv, fetchurl, cmake, pkg-config, qt6, kdePackages, libx11, libxtst, libxcb, libxcb-util, libxcb-image, libxcb-wm, }: stdenv.mkDerivation (finalAttrs: { pname = "xembedsniproxy"; version = "6.7.5"; src = fetchurl { url = "https://download.kde.org/stable/plasma/${finalAttrs.version}/plasma-workspace-${finalAttrs.version}.tar.xz"; sha256 = "94ab21e2243b7876f65c315f1e545081c6437f5bd0a041ca4fb6c2533ae874c9"; }; patches = [ # Crop the transparent margin Wine leaves around its icons, so they aren't shown # smaller than the other tray icons. ./trim-icon-margin.patch # Give icons without a window title (Wine again) their window class as ID instead # of a window number that changes every launch, so Waybar's "icons" can match them. ./window-class-id.patch # Translate click positions from Hyprland's monitor layout to Xwayland's, and move # them just outside the bar, so the menu a Wine app opens appears next to the tray # icon rather than offset by the layout difference or overlapping the bar. ./hyprland-layout-coords.patch ]; postPatch = '' cp ${./CMakeLists.txt} xembed-sni-proxy/CMakeLists.txt ''; cmakeDir = "../xembed-sni-proxy"; cmakeFlags = [ "-DWORKSPACE_VERSION=${finalAttrs.version}" ]; nativeBuildInputs = [ cmake pkg-config qt6.wrapQtAppsHook ]; buildInputs = [ qt6.qtbase kdePackages.kcoreaddons kdePackages.kcrash kdePackages.kdbusaddons kdePackages.kwindowsystem libx11 libxtst libxcb libxcb-util libxcb-image libxcb-wm ]; meta = { description = "Show legacy XEmbed tray icons in StatusNotifierItem trays (standalone build from plasma-workspace)"; homepage = "https://invent.kde.org/plasma/plasma-workspace/-/tree/master/xembed-sni-proxy"; license = lib.licenses.lgpl21Plus; mainProgram = "xembedsniproxy"; platforms = lib.platforms.linux; }; })