diff --git a/README.md b/README.md index 6f5b3cc..929fdb5 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,16 @@ Install TuhiGUI TuhiGui requires Python v3.6 or above. +Flatpak +------- + +``` + $> git clone http://github.com/tuhiproject/tuhigui + $> cd tuhigui + $> flatpak-builder flatpak_builddir org.freedesktop.TuhiGui.json --install --user --force-clean + $> flatpak run org.freedesktop.TuhiGui +``` + License ------- diff --git a/meson.build b/meson.build index 4664b90..72c2e22 100644 --- a/meson.build +++ b/meson.build @@ -104,3 +104,8 @@ if appstream_util.found() test('appstream-util validate-relax', appstream_util, args: ['validate-relax', appdata]) endif + +# A wrapper to start tuhi at the same time as tuhigui, used by the flatpak +configure_file(input: 'tools/tuhi-gui-flatpak.py', + output: 'tuhi-gui-flatpak.py', + copy: true) diff --git a/org.freedesktop.TuhiGui.json b/org.freedesktop.TuhiGui.json index f3b8bfe..4940392 100644 --- a/org.freedesktop.TuhiGui.json +++ b/org.freedesktop.TuhiGui.json @@ -3,11 +3,12 @@ "runtime": "org.gnome.Platform", "runtime-version": "3.30", "sdk": "org.gnome.Sdk", - "command": "tuhigui", + "command": "tuhi-gui", "finish-args": [ "--share=ipc", "--socket=x11", "--talk-name=org.freedesktop.tuhi1", + "--own-name=org.freedesktop.tuhi1", "--system-talk-name=org.bluez" ], "modules": [ @@ -51,6 +52,19 @@ "pip3 install --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} ." ] }, + { + "name": "tuhi", + "buildsystem": "simple", + "sources": [ + { + "type": "git", + "url": "https://github.com/tuhiproject/tuhi" + } + ], + "build-commands": [ + "pip3 install --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} ." + ] + }, { "name": "tuhigui", "buildsystem": "meson", @@ -59,6 +73,10 @@ "type": "git", "url": "." } + ], + "post-install": [ + "cp tuhi-gui-flatpak.py /app/bin/tuhi-gui", + "chmod +x /app/bin/tuhi-gui" ] } ] diff --git a/tools/tuhi-gui-flatpak.py b/tools/tuhi-gui-flatpak.py new file mode 100755 index 0000000..255ec90 --- /dev/null +++ b/tools/tuhi-gui-flatpak.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + +import subprocess +from multiprocessing import Process + +def start_tuhi(): + subprocess.run('tuhi') + +def start_tuhigui(): + subprocess.run('tuhigui') + +if __name__ == '__main__': + tuhi = Process(target=start_tuhi) + tuhi.daemon = True + tuhi.start() + tuhigui = Process(target=start_tuhigui) + tuhigui.start() + tuhigui.join()