Skip to content

enhance: support tools installed via flatpak #1517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

NathanBaulch
Copy link
Contributor

This PR is a bit experimental.
I have various tools installed via Flatpak (Meld, VSCodium, etc) that I'd like sourcegit to integrate with. Currently all diff and merge tools must resolve to a known binary file, whereas Flatpak apps are launched via the flatpak binary (eg flatpak run org.gnome.meld). I've figured out some workarounds to get ExternalTool and ExternalMerger working but I'm reluctant to make any significant changes because I can only test on Linux.

@love-linger love-linger self-assigned this Jul 5, 2025
@love-linger love-linger added the not-planned It's not planned in the future label Jul 5, 2025
@love-linger
Copy link
Collaborator

love-linger commented Jul 5, 2025

I suggest directly creating a command-line tool for Flatpak applications, so it can be used as normal application. For example:

  1. Create /usr/bin/meld,and fill it with following contents:
#!/bin/bash

/usr/bin/flatpak run org.gnome.meld $@
  1. Change the file mode with chmod u+x /usr/bin/meld

@NathanBaulch
Copy link
Contributor Author

Digging deeper, it looks like Flatpak already does this for me! Specifying the following install path works for my per-user Meld installation: /home/nathan/.local/share/flatpak/exports/bin/org.gnome.meld 👍
It would be cool if sourcegit could figure this out automatically, but at least I have something workable.
It would also be cool if it could automatically detect these in ExternalTool, which is not something I can override in preferences.

@NathanBaulch NathanBaulch force-pushed the flatpak branch 2 times, most recently from 5563305 to cf819b8 Compare July 6, 2025 01:12
@NathanBaulch
Copy link
Contributor Author

I've updated this PR with much cleaner Flatpak external tool support based on inspecting the system-wide and per-user flatpak/exports/bin folders. Changes are limited to Linux.cs and ExternalMerger is no longer touched.

If sourcegit can have special support for JetBrains Toolbox then it seems reasonable that it can also support Flatpak on Linux.

@love-linger
Copy link
Collaborator

If sourcegit can have special support for JetBrains Toolbox then it seems reasonable that it can also support Flatpak on Linux.

It's because this is a cross-platform app, and there are so many JetBrains products (currently we support 16 JetBrains products), and their installation paths vary on different platforms. Also, different versions can coexist. To solve the startup problem, JetBrains itself provides the JetBrains Toolbox. This is not exactly the same as third-party package managers like Flatpak.

@NathanBaulch
Copy link
Contributor Author

I agree with everything you've said.
I still don't see any reason why the Linux backend can't search in a couple of extra places to find tools installed with a popular distro-agnostic package manager. The same goes for tools installed via Mac App Store or Microsoft Store if they can be handled by their respective IBackend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-planned It's not planned in the future
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants