about summary refs log tree commit diff
path: root/pkgs/applications/video
diff options
context:
space:
mode:
authorMats <mats@mats.sh>2022-11-21 21:38:04 +0100
committerMats <mats@mats.sh>2022-12-02 12:17:36 +0100
commit64f6033a03c05389f3f790b917973a2ead9f3329 (patch)
tree892a31f25dca91ea8077a3d04e709b6a8fb550cb /pkgs/applications/video
parentb68bd2ee52051aaf983a268494cb4fc6c485b646 (diff)
jellyfin-mpv-shim: add desktop item
Diffstat (limited to 'pkgs/applications/video')
-rw-r--r--pkgs/applications/video/jellyfin-mpv-shim/default.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/applications/video/jellyfin-mpv-shim/default.nix b/pkgs/applications/video/jellyfin-mpv-shim/default.nix
index 69248dc75301c..02c58925558e6 100644
--- a/pkgs/applications/video/jellyfin-mpv-shim/default.nix
+++ b/pkgs/applications/video/jellyfin-mpv-shim/default.nix
@@ -1,12 +1,15 @@
 { lib
 , buildPythonApplication
+, copyDesktopItems
 , fetchPypi
 , gobject-introspection
 , jellyfin-apiclient-python
 , jinja2
+, makeDesktopItem
 , mpv
 , pillow
 , pystray
+, python
 , python-mpv-jsonipc
 , pywebview
 , tkinter
@@ -23,6 +26,7 @@ buildPythonApplication rec {
   };
 
   nativeBuildInputs = [
+    copyDesktopItems
     wrapGAppsHook
     gobject-introspection
   ];
@@ -59,6 +63,15 @@ buildPythonApplication rec {
       --replace "notify_updates: bool = True" "notify_updates: bool = False"
   '';
 
+  # Install all the icons for the desktop item
+  postInstall = ''
+    for s in 16 32 48 64 128 256; do
+      mkdir -p $out/share/icons/hicolor/''${s}x''${s}/apps
+      ln -s $out/${python.sitePackages}/jellyfin_mpv_shim/integration/jellyfin-''${s}.png \
+        $out/share/icons/hicolor/''${s}x''${s}/apps/${pname}.png
+    done
+  '';
+
   # needed for pystray to access appindicator using GI
   preFixup = ''
     makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
@@ -69,6 +82,16 @@ buildPythonApplication rec {
   doCheck = false;
   pythonImportsCheck = [ "jellyfin_mpv_shim" ];
 
+  desktopItems = [
+    (makeDesktopItem {
+      name = pname;
+      exec = pname;
+      icon = pname;
+      desktopName = "Jellyfin MPV Shim";
+      categories = [ "Video" "AudioVideo" "TV" "Player" ];
+    })
+  ];
+
   meta = with lib; {
     homepage = "https://github.com/jellyfin/jellyfin-mpv-shim";
     description = "Allows casting of videos to MPV via the jellyfin mobile and web app";