Merge pull request #307508 from Sigmanificient/tuifi-experimental-dnd

tuifimanager: Add experimental drag and drop support
This commit is contained in:
kirillrdy 2024-05-11 07:15:27 +10:00 committed by GitHub
commit 2a827b9393
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,8 +1,22 @@
{ lib
{ stdenv
, lib
, python3
, fetchFromGitHub
, kdePackages
, gnome
, qt6
, makeWrapper
, x11Support ? stdenv.isLinux
# pypinput is marked as broken for darwin
, pynputSupport ? stdenv.isLinux
# Experimental Drag & Drop support requires x11 & pyinput suport
, hasDndSupport ? x11Support && pynputSupport
, enableDragAndDrop ? false
}:
lib.throwIf (enableDragAndDrop && !hasDndSupport)
"Drag and drop support is only available for linux with xorg."
python3.pkgs.buildPythonApplication rec {
pname = "tuifimanager";
version = "4.0.6";
@ -18,12 +32,34 @@ python3.pkgs.buildPythonApplication rec {
nativeBuildInputs = [
python3.pkgs.setuptools
python3.pkgs.setuptools-scm
];
] ++ (lib.optionals enableDragAndDrop [
qt6.wrapQtAppsHook
makeWrapper
]);
propagatedBuildInputs = [
python3.pkgs.send2trash
python3.pkgs.unicurses
];
] ++ (lib.optionals enableDragAndDrop [
python3.pkgs.pynput
python3.pkgs.pyside6
python3.pkgs.requests
python3.pkgs.xlib
kdePackages.qtbase
kdePackages.qt6gtk2
]);
postFixup = let
# fix missing 'adwaita' warning missing with ncurses tui
# see: https://github.com/NixOS/nixpkgs/issues/60918
theme = gnome.gnome-themes-extra;
in
lib.optionalString enableDragAndDrop ''
wrapProgram $out/bin/tuifi \
--prefix GTK_PATH : "${theme}/lib/gtk-2.0" \
--set tuifi_synth_dnd True
'';
pythonImportsCheck = [ "TUIFIManager" ];
meta = with lib; {