From f35aa87714a44c79fd7775a8f2f20103fc60fc5c Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Sun, 25 May 2025 11:36:37 +0200 Subject: [PATCH] add desktop file and install it with unison-gui Originally based on the Fedora rpm source. Also install icons referenced in the desktop file. --- data/unison-gui.desktop | 11 +++++++++++ src/make_tools.ml | 12 ++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 data/unison-gui.desktop diff --git a/data/unison-gui.desktop b/data/unison-gui.desktop new file mode 100644 index 000000000..eba6b2209 --- /dev/null +++ b/data/unison-gui.desktop @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: MIT-0 +[Desktop Entry] +Type=Application +Exec=unison-gui +Name=Unison +GenericName=File Synchronizer +Comment=GUI for Unison file synchronizer +Terminal=false +Icon=unison-gui +StartupNotify=true +Categories=Utility; diff --git a/src/make_tools.ml b/src/make_tools.ml index a5792b6d5..7563771b4 100644 --- a/src/make_tools.ml +++ b/src/make_tools.ml @@ -644,6 +644,8 @@ let install () = let mandir = "MANDIR" <--? datarootdir ^ "/man" in let man1dir = "MAN1DIR" <--? mandir ^ "/man1" in let manext = "MANEXT" <--? ".1" in + let desktopdir = "DESKTOPDIR" <--? datarootdir ^ "/applications" in + let iconthemedir = "ICONTHEMEDIR" <--? datarootdir ^ "/icons/hicolor" in let install_if_exists dir name dest = if exists dir name then exec @@ -660,6 +662,16 @@ let install () = exec [install; "-d"; destdir ^ man1dir]; exec [install_data; "man/unison.1"; destdir ^ man1dir ^ "/unison" ^ manext] end; + if exists "src" "unison-gui" then begin + exec [install; "-d"; destdir ^ desktopdir]; + exec [install_data; "data/unison-gui.desktop"; destdir ^ desktopdir ^ "/unison-gui.desktop"]; + let installpng size = + exec [install; "-d"; destdir ^ iconthemedir ^ "/" ^ size ^ "x" ^ size ^ "/apps"]; + exec [install_data; "icons/U." ^ size ^ "x" ^ size ^ "x16m.png"; destdir ^ iconthemedir ^ "/" ^ size ^ "x" ^ size ^ "/apps/unison-gui.png"] + in List.iter installpng ["16"; "24"; "32"; "48"; "256"]; + exec [install; "-d"; destdir ^ iconthemedir ^ "/scalable/apps"]; + exec [install_data; "icons/U.svg"; destdir ^ iconthemedir ^ "/scalable/apps/unison-gui.svg"] + end; if exists "src/uimac/build/Default" "Unison.app" then begin print_endline ("!!! The GUI for macOS has been built but will NOT be \ installed automatically. You can find the built GUI package at " ^