aperezdc / revolt

Better desktop integration for Riot.im (not only) for GNOME
GNU General Public License v3.0
92 stars 9 forks source link

Support independent Revolt instances #83

Closed lofidevops closed 6 years ago

lofidevops commented 6 years ago

User story: I am an everyday user. I want multiple Matrix accounts, so I can separate work and personal contacts/rooms/etc.

Suggested solution: In lieu of Riot itself supporting multiple accounts, I'd like to launch a second instance of Revolt in the current desktop session, such that:

This has the added benefit of being able to completely close off accounts that I don't want to attend to right now.

Apparently this should be possible with:

flatpak run org.perezdecastro.Revolt --setting=org.the.new.name --own-name=org.the.new.name

Where:

From https://github.com/flatpak/flatpak/issues/1170:

To run multiple instances you need revolt itself to be able to run as a different dbus name, and that is a request you have to take up with revolt developers.

Once you have that you need to also call it with flatpak run --own-name=org.the.new.name to allow that name to be owned.

For the storage settings there is no current way to automatically do this from flatpak itself, but I guess it could be added by using a separate dir for ~/.var/app/$id

aperezdc commented 6 years ago

This shouldn't be too difficult to achieve. Revolt is already using Gtk.Application, so if we change the code to let it parse the command line and set the flag to allow changing the application identifier at runtime (that is G_APPLICATION_CAN_OVERRIDE_APP_ID), then it will be possible to pass --gapplication-app-id=<ID>. Most of the code that needs the application identifier (if not all) already uses Gtk.Application.get_application_id() so I expect this won't be a lot of work to implement.

aperezdc commented 6 years ago

Funny story: I just checked the code and there is support for overriding the application identifier already there! It is done with the REVOLT_OVERRIDE_APPLICATION_ID environment variable:

REVOLT_OVERRIDE_APPLICATION_ID=org.myself.OtherRevolt revolt

or, if you are using Flatpak:

flatpak run \
    --env=REVOLT_OVERRIDE_APPLICATION_ID=org.myself.OtherRevolt \
    org.perezdecastro.Revolt

I hope this helps. If you find any issues using REVOLT_OVERRIDE_APPLICATION_ID, please comment here.

lofidevops commented 6 years ago

It works! Thanks.

aperezdc commented 6 years ago

@kwill: Great, thanks for confirming that it works for you and closing the issue!