deltachat-desktop icon indicating copy to clipboard operation
deltachat-desktop copied to clipboard

Option to setup autostart for Deltachat

Open Simon-Laux opened this issue 3 years ago • 4 comments

Option to set up auto start for Deltachat on system start. If we cannot support a certain system/os we can link to a tutorial/guide how the user can do it manually.

This should become an option in the Settings. (activate autostart and disable autostart), in all cases it should be started with the --minimized cli argument.

lets collect the approaches how we could do it on the different OS/platforms/distribution-formats:

Windows (normally installed)

For windows (non store/non-appx) we could create a link/shortcut file in the StartMenu/Autostart folder, that is set to start Deltachat with the minimised argument. There is probably also a way to do this via the windows registry.

Windows (portable)

Either don't offer option at all (and display a manual guide), or do the same method as for the installed version but put a warning before it "Does not work with portable versions on a path that changes"

At beginning check how it was installed (user, globally or portable) (check executable path). If path is not known then warn user as written above.

For current user:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
"DeltaChat"="%USERPROFILE%\AppData\Local\Programs\DeltaChat\DeltaChat.exe"

For all users (only this additional option show option if dc was installed for all users, probably requires some prompt to add it with admin rights?):

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"DeltaChat"="path to global dc"

Windows (apps, Store version)

there is an npm package for this: https://github.com/felixrieseberg/electron-winstore-auto-launch

MacOS

?, probably not the biggest deal to not have it, because macOS normally restarts all previous applications after a reboot.

Linux (normally installed & AppImage)

copy deltachat.desktop file to ~/.config/autostart for a particular user (as per XDG Autostart).

Linux (flatpak)

use bus to communicate with flatpack:

def generateFlatpak(typeAction):
    try:
        bus = dbus.SessionBus()
        obj = bus.get_object("org.freedesktop.portal.Desktop",
                             "/org/freedesktop/portal/desktop")
        inter = dbus.Interface(obj, "org.freedesktop.portal.Background")

        res = inter.RequestBackground('', {'reason': 'Zapzap autostart', 'autostart': typeAction,
                                           'background': typeAction, 'commandline': dbus.Array(['zapzap', '--hideStart'])})

    except Exception as e:
        print(e)

https://github.com/rafatosta/zapzap/blob/f645c2a3f26cc80af45d11299432e9d1ced81bd8/zapzap/services/portal_desktop.py#L18-L29

PS: we might need to modify electron builder for this so that it allows us to write what distributable format it is before packing the app into that format.

Simon-Laux avatar Jan 14 '22 19:01 Simon-Laux

There is probably also a way to do this via the windows registry.

For current user:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
"DeltaChat"="%USERPROFILE%\AppData\Local\Programs\DeltaChat\DeltaChat.exe"

For all users:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"DeltaChat"="C:\Program Files (x86)\DeltaChat\DeltaChat.exe"

Although I am not absolutely sure about the program path for the all-user installation...

gerryfrancis avatar Jan 19 '22 17:01 gerryfrancis

Linux (normally installed)

?

copy deltachat.desktop file to ~/.config/autostart for a particular user (as per XDG Autostart).

jose1711 avatar Mar 20 '22 10:03 jose1711

There is a related forum topic on https://support.delta.chat/t/start-minimized-as-an-option/2057

link2xt avatar Sep 12 '23 16:09 link2xt

We can take a look at ZapZap build for Flatpak. I think they did a good job for Flatpak to autostart.

debilin avatar Oct 14 '23 20:10 debilin