Jun's Blog

Output, activities, memo and etc.

Install Slack on Flatpak on Fedora 36

I referred to the [1].

Install Slack

First, you need to install Flatpak if you don't have it.

$ sudo dnf install flatpak

Install the flathub repo file.

$ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Reboot at once in this timing.

$ sudo reboot

Install Slack.

$ flatpak install flathub com.slack.Slack -y

Run Slack

In my environment where running i3 by running the startx, I saw the error below.

$ flatpak run com.slack.Slack
[2 zypak-helper] Failed to connect to session bus: [org.freedesktop.DBus.Error.NotSupported] Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead
[2 zypak-helper] src/helper/main.cc:40(DetermineZygoteStrategy): Assertion failed: bus

I added the lines below, seeing the [2].

diff --git a/home/.xinitrc b/home/.xinitrc
index abe931a..a902714 100644
--- a/home/.xinitrc
+++ b/home/.xinitrc
@@ -1,3 +1,7 @@
 xrdb ~/.Xresources
 
+# dbus-launch for Slack on Flatpak.
+# https://github.com/flatpak/flatpak/issues/2754
+eval "$(dbus-launch --sh-syntax --exit-with-session)"
+
 exec i3

And it worked after running the startx again.

$ flatpak run com.slack.Slack

Here is the detail of the command above.

$ rpm -qf /bin/dbus-launch
dbus-x11-1.14.4-1.fc36.x86_64

$ dbus-launch --sh-syntax --exit-with-session
DBUS_SESSION_BUS_ADDRESS='unix:path=/tmp/dbus-rqcQtmDHcj,guid=776599334e0d304f27523f2d63868934';
export DBUS_SESSION_BUS_ADDRESS;
DBUS_SESSION_BUS_PID=8326;
DBUS_SESSION_BUS_WINDOWID=31457281;

I added the alias below.

.bashrc

+if flatpak info com.slack.Slack > /dev/null 2>&1; then
+    alias slack='flatpak run com.slack.Slack'
+fi

References