Use Zenity GTK4 on GNOME in Flatpak

This switches the runtime to org.gnome.Platform/Sdk 47, there is a wrapper script which will show a GTK4 dialog on GNOME only (unless the env CC_DIALOG_FORCE_ZENITY_GTK4 is set), and GTK3 on other DEs.
This commit is contained in:
Dexter Reed 2024-09-21 00:30:53 +01:00
parent 1f8d946de4
commit efc52ab1ea
No known key found for this signature in database
GPG key ID: A107897231BE5854
2 changed files with 46 additions and 3 deletions

View file

@ -1,8 +1,8 @@
{ {
"id": "net.classicube.flatpak.client", "id": "net.classicube.flatpak.client",
"runtime": "org.freedesktop.Platform", "runtime": "org.gnome.Platform",
"runtime-version": "24.08", "runtime-version": "47",
"sdk": "org.freedesktop.Sdk", "sdk": "org.gnome.Sdk",
"command": "ClassiCubeLauncher", "command": "ClassiCubeLauncher",
"finish-args": [ "finish-args": [
"--socket=wayland", "--socket=wayland",
@ -56,6 +56,41 @@
} }
] ]
}, },
{
"name": "zenity-gtk3",
"buildsystem": "meson",
"build-commands": [
"mkdir -p ${FLATPAK_DEST}/share/icons/hicolor"
],
"sources": [
{
"type": "archive",
"url": "https://gitlab.gnome.org/GNOME/zenity/-/archive/3.44.4/zenity-3.44.4.tar.gz",
"sha256": "e7b334867d4e11053e6e52e5d51b7a983dc549f93cb3fda757e40309b16bc57b"
}
],
"post-install": [
"mv ${FLATPAK_DEST}/bin/zenity ${FLATPAK_DEST}/bin/zenity-gtk3"
]
},
{
"name": "zenity-gtk4",
"buildsystem": "meson",
"sources": [
{
"type": "archive",
"url": "https://gitlab.gnome.org/GNOME/zenity/-/archive/4.0.2/zenity-4.0.2.tar.gz",
"sha256": "fdbb74e882a6a56bb2f1a2381b81e08b06c627cc7e944edb71d107092c70dd80",
"x-checker-data": {
"type": "gnome",
"name": "zenity"
}
}
],
"post-install": [
"mv ${FLATPAK_DEST}/bin/zenity ${FLATPAK_DEST}/bin/zenity-gtk4"
]
},
{ {
"name": "ClassiCubeAssets", "name": "ClassiCubeAssets",
"buildsystem": "simple", "buildsystem": "simple",
@ -85,6 +120,7 @@
"gcc -fno-math-errno src/*.c -o src/ClassiCube -rdynamic -lpthread -lGL -DCC_WIN_BACKEND=CC_WIN_BACKEND_SDL3 -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -DCC_BUILD_FLATPAK -L /app/lib -lSDL3", "gcc -fno-math-errno src/*.c -o src/ClassiCube -rdynamic -lpthread -lGL -DCC_WIN_BACKEND=CC_WIN_BACKEND_SDL3 -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -DCC_BUILD_FLATPAK -L /app/lib -lSDL3",
"install -Dm755 src/ClassiCube -t ${FLATPAK_DEST}/bin", "install -Dm755 src/ClassiCube -t ${FLATPAK_DEST}/bin",
"install -Dm755 misc/flatpak/ClassiCubeLauncher -t ${FLATPAK_DEST}/bin", "install -Dm755 misc/flatpak/ClassiCubeLauncher -t ${FLATPAK_DEST}/bin",
"install -Dm755 misc/flatpak/zenity-wrapper ${FLATPAK_DEST}/bin/zenity",
"install -Dm644 misc/flatpak/net.classicube.flatpak.client.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.classicube.flatpak.client.svg", "install -Dm644 misc/flatpak/net.classicube.flatpak.client.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.classicube.flatpak.client.svg",
"install -Dm644 misc/flatpak/net.classicube.flatpak.client.desktop ${FLATPAK_DEST}/share/applications/net.classicube.flatpak.client.desktop", "install -Dm644 misc/flatpak/net.classicube.flatpak.client.desktop ${FLATPAK_DEST}/share/applications/net.classicube.flatpak.client.desktop",
"install -Dm644 misc/flatpak/net.classicube.flatpak.client.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.classicube.flatpak.client.metainfo.xml" "install -Dm644 misc/flatpak/net.classicube.flatpak.client.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.classicube.flatpak.client.metainfo.xml"

7
misc/flatpak/zenity-wrapper Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
# Allow forcing GTK3/4 through $CC_DIALOG_FORCE_ZENITY_GTK{3,4}
if [[ -z "${CC_DIALOG_FORCE_ZENITY_GTK3}" && "${XDG_CURRENT_DESKTOP}" == "GNOME" || ! -z "${CC_DIALOG_FORCE_ZENITY_GTK4}" ]]; then
zenity-gtk4 "$@"
else
zenity-gtk3 "$@"
fi