Closed sgehrman closed 1 year ago
Adding a shared module from here isn't very hard, just git submodule add
this repo and follow the instructions in the main README. It wouldn't complicate a project much, just adds a folder you link to.
Alternatively, why can't your app just add the normal libappindicator module? If it can't do that, you can more or less copy-paste how WhatsAppForLinux uses libayatana-appindicator3:
It would be interesting to have a list of flatpaks that use this module.
It would be interesting to have a list of flatpaks that use this module.
Doing a quick index of Flathub using GitHub's search function, it's only WhatsAppForLinux that uses it.
https://github.com/search?q=org%3Aflathub+libayatana&type=code
If it is used by only one project with maybe a second on its way then I don't think it is reason enough for having a shared-module. Those projects can just add it to the manifest.
The reason I packaged appindicator here and not ayatana is because they are different libraries with different APIs.
Appindicator also being unmaintained meant it is hell to build and required patches, hacks, etc.
Hopefully Ayatana is easier to build but if a lot of projects need it then it could be added here too.
@sgehrman Also, you do have to learn how to build projects, on a basic level, to effectively maintain a flatpak. Nothing will change that.
Thanks for the info.
Tried to add
- name: ayatana-ido
buildsystem: cmake-ninja
sources:
- type: git
url: https://github.com/AyatanaIndicators/ayatana-ido.git
tag: 0.9.2
but getting:
CMake Error at /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Vala (missing: VALA_COMPILER)
Call Stack (most recent call first):
/usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
cmake/FindVala.cmake:52 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
src/CMakeLists.txt:164 (find_package)
I tried installing everything vala that I could find, but doesn't work. I'm on Debian.
I'm also confused about which platform I should use. I'm using org.freedesktop.Platform, but what's app is using org.gnome.Platform
How do I know which to use? What if someone isn't using gnome? I don't know how this affects other distros.
Please attach the full flatpak manifest, the markdown formatting here doesn't really help.
I copied that from whatsapp, but here it is (so far)
you probably need to disable vala when building it.
vala is part of the GNOME runtime but if you don't need it then you shouldn't be.
should I use gnome? I have no idea about linux distros and making sure my app will run on most of them.
How do I disable it?
my dev machine: $ vapigen --version Vala API Generator 0.48.17 $ vala --version Vala 0.48.17
You should use the org.gnome.Platform and org.gnome.Sdk rather than the freedesktop one; use the WhatsAppForLinux manifest as a reference: https://github.com/flathub/com.github.eneshecan.WhatsAppForLinux/blob/master/com.github.eneshecan.WhatsAppForLinux.yml
And be sure to change the runtime-version to 43, as that's the latest.
How do I know which to use? What if someone isn't using gnome? I don't know how this affects other distros.
They all work on any distro. The difference is bundled libraries. Some details are here: https://docs.flatpak.org/en/latest/available-runtimes.html
Not if you don't need it.
File a bug with that package as it seems to find_package(Vala REQUIRED QUIET)
but this is unreasonable requirement.
you probably need to disable vala when building it.
It looks like they expose no options to disable features. Disappointing.
I tried installing everything vala that I could find, but doesn't work. I'm on Debian.
@sgehrman Flatpak is a sandbox. Nothing you install on your host matters or does anything*.
ok, it built but I don't see the app indicator.
$ flatpak run com.cocoatech.Driftwood Gtk-Message: 15:39:12.063: Failed to load module "canberra-gtk-module" Gtk-Message: 15:39:12.063: Failed to load module "canberra-gtk-module"
(driftwood:2): CRITICAL : 15:39:12.358: Failed to read XDG desktop portal settings: GDBus.Error:org.freedesktop.portal.Error.NotFound: Requested setting not found
(driftwood:2): CRITICAL : 15:39:12.359: Failed to read XDG desktop portal settings: GDBus.Error:org.freedesktop.portal.Error.NotFound: Requested setting not found
oh, I got it kind of working by adding some finish args.
But the icon is '...' which is weird.
Dec 10 15:55:28 5950x ubuntu-appindicators@ubuntu.com[3237]: unable to update icon for fWoDQCmZt
Dec 10 15:55:28 5950x ubuntu-appindicators@ubuntu.com[3237]: fWoDQCmZt, Impossible to read image info from path '/app/Driftwood/data/flutter_assets/assets/images/appIcon.png': GdkPixbuf.PixbufError: Failed to recognize image>
Dec 10 15:55:28 5950x gnome-shell[3237]: Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x4600003
Dec 10 15:55:28 5950x ubuntu-appindicators@ubuntu.com[3237]: unable to update icon for fWoDQCmZt
Dec 10 15:55:28 5950x ubuntu-appindicators@ubuntu.com[3237]: fWoDQCmZt, Impossible to read image info from path '/app/Driftwood/data/flutter_assets/assets/images/appIcon.png': GdkPixbuf.PixbufError: Failed to recognize image>
All of these permissions are unrelated and many probably wrong.
You need to ensure your icon is properly named (prefixed by your app-id), installed to the correct directories, and referenced by that name. You cannot load by file path as you are trying.
The icon works fine on a normal build, but not in this flatpak build.
Any idea why not?
Because flatpak sandboxes applications. This provides security, portability, and prevents conflicts with other packages.
The image is part of my built app.
Yes but the system cannot see your apps files. You have to name them and place them in the correct icons directory for the system to access them.
got it, let me think about this. thanks. Is there a recommended icons directory to put this in? Docs on how to do this?
$PREFIX/share/icons/hicolor/$SIZE/apps/$APP_ID-anything.png
Where $PREFIX is /app
in flatpak. $SIZE is like 32x32
(there are specific size options), and $APP_ID would be org.example.App
in your flatpak manifest.
Thanks, I think I can get it working. One thing I noticed:
// running on flatpak my apps data is written here: /home/steve/.var/app/com.cocoatech.Driftwood/data/driftwood
// running normally it's here /home/steve/.local/share/re.distantfutu.dashboard
Is there a filesystem permission to get that to work the same?
And is there a way in my code to detect the sandbox?
if (runningInSandbox) { do something } else {}
@sgehrman You can read the XDG_DATA_HOME
env var to get that path, correct in both cases.
Thanks, I think I can get it working. One thing I noticed:
// running on flatpak my apps data is written here: /home/steve/.var/app/com.cocoatech.Driftwood/data/driftwood
// running normally it's here /home/steve/.local/share/re.distantfutu.dashboard
Is there a filesystem permission to get that to work the same?
Don't; trying to drag configurations from native packages into a flatpak isn't suggested, and can break apps. The flatpak having its own config directories also helps for security reasons.
To detect a flatpak env, check the root directory for .flatpak-info
.
Thanks, I think it's all working. Will post to flathub soon.
It would be nice if you did add libayatana-appindicator3 just since it's suppose to be maintained and newer.
Thanks, I think it's all working. Will post to flathub soon. It would be nice if you did add libayatana-appindicator3 just since it's suppose to be maintained and newer.
Maybe if there's more demand for it in the future, currently Flathub only has one app using it. (see https://github.com/flathub/shared-modules/issues/223#issuecomment-1345389128)
@TingPing is it safe to close this issue as not planned?
yeah, but one last problem. I"m putting my tar.gz on github releases, but can't get it working.
getting: gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
I'm trying to copy AppFlowy, but it doesn't work.
modules:
- name: driftwood
buildsystem: simple
only-arches:
- x86_64
build-commands:
# - mkdir -p Driftwood
# - tar -xf Driftwood-Linux-Portable.tar.gz -C Driftwood
- cp -r bundle /app/Driftwood
- chmod +x /app/Driftwood/driftwood
- mkdir -p /app/bin
- ln -s /app/Driftwood/driftwood /app/bin/driftwood
- mkdir -p /app/share/metainfo
- cp -r com.cocoatech.Driftwood.metainfo.xml /app/share/metainfo/
- mkdir -p /app/share/icons/hicolor/scalable/apps
- cp -r icon.svg /app/share/icons/hicolor/scalable/apps/com.cocoatech.Driftwood.svg
- mkdir -p /app/share/applications
- cp -r com.cocoatech.Driftwood.desktop /app/share/applications/
- mkdir -p /app/share/appdata
- cp -r com.cocoatech.Driftwood.metainfo.xml /app/share/appdata/
sources:
- type: archive
url: https://github.com/sgehrman/flatpak-assets/releases/download/v1.0.0-beta/Driftwood-Linux-Portable.tar.gz
sha256: 5a78ecd966768e39e0fd11439474cb340d35a438643671a074341373a10f32fe
dest: bundle
Downloading sources
Downloading https://github.com/sgehrman/flatpak-assets/releases/download/v1.0.0-beta/Driftwood-Linux-Portable.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 59.4M 100 59.4M 0 0 8642k 0 0:00:07 0:00:07 --:--:-- 9656k
Downloading https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 158k 100 158k 0 0 75271 0 0:00:02 0:00:02 --:--:-- 245k
Initialized empty Git repository in /home/steve/Documents/GitHub/dfc/dashboard/.flatpak-builder/git/https_github.com_AyatanaIndicators_ayatana-ido.git-0EITW1/
Fetching git repo https://github.com/AyatanaIndicators/ayatana-ido.git, ref refs/tags/0.9.2
remote: Enumerating objects: 94, done.
remote: Counting objects: 100% (94/94), done.
remote: Compressing objects: 100% (79/79), done.
remote: Total 94 (delta 19), reused 36 (delta 7), pack-reused 0
Unpacking objects: 100% (94/94), 144.30 KiB | 978.00 KiB/s, done.
From https://github.com/AyatanaIndicators/ayatana-ido
* [new tag] 0.9.2 -> 0.9.2
Initialized empty Git repository in /home/steve/Documents/GitHub/dfc/dashboard/.flatpak-builder/git/https_github.com_AyatanaIndicators_libayatana-indicator.git-PRI4W1/
Fetching git repo https://github.com/AyatanaIndicators/libayatana-indicator.git, ref refs/tags/0.9.3
remote: Enumerating objects: 97, done.
remote: Counting objects: 100% (97/97), done.
remote: Compressing objects: 100% (83/83), done.
remote: Total 97 (delta 24), reused 45 (delta 7), pack-reused 0
Unpacking objects: 100% (97/97), 164.48 KiB | 1.07 MiB/s, done.
From https://github.com/AyatanaIndicators/libayatana-indicator
* [new tag] 0.9.3 -> 0.9.3
Downloading https://launchpad.net/libdbusmenu/16.04/16.04.0/+download/libdbusmenu-16.04.0.tar.gz
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 742k 100 742k 0 0 895k 0 --:--:-- --:--:-- --:--:-- 1851k
Initialized empty Git repository in /home/steve/Documents/GitHub/dfc/dashboard/.flatpak-builder/git/https_github.com_AyatanaIndicators_libayatana-appindicator.git-9B9XW1/
Fetching git repo https://github.com/AyatanaIndicators/libayatana-appindicator.git, ref refs/tags/0.5.91
remote: Enumerating objects: 115, done.
remote: Counting objects: 100% (115/115), done.
remote: Compressing objects: 100% (94/94), done.
remote: Total 115 (delta 18), reused 58 (delta 10), pack-reused 0
Receiving objects: 100% (115/115), 172.56 KiB | 2.30 MiB/s, done.
Resolving deltas: 100% (18/18), done.
From https://github.com/AyatanaIndicators/libayatana-appindicator
* [new tag] 0.5.91 -> 0.5.91
Initializing build dir
Committing stage init to cache
Starting build of com.cocoatech.Driftwood
========================================================================
Building module driftwood in /home/steve/Documents/GitHub/dfc/dashboard/.flatpak-builder/build/driftwood-1
========================================================================
gzip: stdin: not in gzip format
tar: Child returned status 1
I figured it out. I copied the instructions to make a flutter app here: https://github.com/Merrit/flutter_flatpak_example
But the tar command is incorrect. It works now.
I'm building a flutter app, it uses libayatana-appindicator3 if it exists on my build machine, but I don't see that in here.
Is that simple to fix? I know very little about this, send hints.
Just spent a week trying to get snap working and it was a total disaster. I'm hoping flatpak is easier, but these submodules look super complex and would require deep linux knowledge. I would have no idea how to build these build steps.
Ideally I would just want to do an 'apt install libayatana-appindicator3" in my flatpak and be done with it. Is there anything simple like this? figuring out how to build the code and getting the hashes and all the steps seems near impossible for the non linux geek.
Also, adding a git submodule is something I would rather not do. I want to keep my project simple and don't want to complicate it just for an 'installer'. If there's a way to avoid that, that would be good.