Skip to content

Add D-Bus service file #1381

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: main
Choose a base branch
from
Open

Conversation

City-busz
Copy link
Contributor

@City-busz City-busz commented Apr 17, 2025

And mark the application as D-Bus activatable. This allows application launchers to activate it via D-Bus.

When the application is run in service mode, it's not supposed to show window, so I moved accounts.init () from startup to activate phase and ensured that it runs only once, because it calls ensure_active_account (), which in turn calls present_window () if no account configured.

Reference:
https://specifications.freedesktop.org/desktop-entry-spec/1.3/dbus.html

Depends on #1380

And mark the application as D-Bus activatable. This allows application
launchers to activate it via D-Bus.
@GeopJr
Copy link
Owner

GeopJr commented Apr 17, 2025

🤔 Do we really need this?

I get the point of it, but having the app run as a service sounds a bit too much IMO. The current solution of --hidden, uses (or it least it should) the background portal and will display Tuba in the background apps section of the DE, allowing users to see that 1. it's running and 2. kill it. This is what it looks like in GNOME:

image

When the application is run in service mode, it's not supposed to show window, so I moved accounts.init () from startup to activate phase and ensured that it runs only once, because it calls ensure_active_account (), which in turn calls present_window () if no account configured.

Which I also think it's important. It should also show errors when Tuba can't access the keyring or the token has expired / been revoked.

@City-busz
Copy link
Contributor Author

This is not the same as --hidden. The GApplication service is just used to launch the application, and it terminates the process if no action given after 10 seconds.

It has some benefits as described here: https://wiki.gnome.org/HowDoI(2f)DBusApplicationLaunching.html#Why.3F

When DBusActivatable=true is set in the desktop file, the application launcher of GNOME Shell and KDE Plasma launches the application via D-Bus instead of fork()/exec() the executable, so the D-Bus daemon will control the process by setting up its environment, adding it to the correct cgroup, just like how usual D-Bus services work.

The D-Bus interface is provided by GApplication, just the service file is missing.

@Rafostar
Copy link
Contributor

D-Bus activation allows app to have persistent notifications: link. I would imagine something like this especially important for the apps like Tuba, no? 😄 There are also other benefits of being D-Bus activatable so its useful even if you do not plan of running as service.

@GeopJr
Copy link
Owner

GeopJr commented Apr 18, 2025

Okay that makes it a lot more appealing, thanks! I thought notifications already worked like that :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants