maestral.autostart

This module handles starting the maestral daemon on user login and supports multiple platform specific backends such as launchd or systemd.

Note that launchd agents will not show as “login items” in macOS system preferences. As a result, the user does not have a convenient UI to remove Maestral autostart entries manually outside Maestral itself. Login items however only support app bundles and provide no option to pass command line arguments to the app. They would therefore neither support pip installed packages nor multiple configurations.

Module Contents

class maestral.autostart.SupportedImplementations[source]

Bases: enum.Enum

Enumeration of supported implementations

systemd = systemd[source]
launchd = launchd[source]
xdg_desktop = xdg_desktop[source]
class maestral.autostart.AutoStartBase[source]

Base class for autostart backends

abstract enable()[source]

Enable autostart. Must be implemented in subclass.

Return type

None

abstract disable()[source]

Disable autostart. Must be implemented in subclass.

Return type

None

property enabled[source]

Returns the enabled status as bool. Must be implemented in subclass.

Return type

bool

class maestral.autostart.AutoStartSystemd(service_name, start_cmd, unit_dict=None, service_dict=None, install_dict=None)[source]

Bases: AutoStartBase

Autostart backend for systemd

Parameters
  • service_name (str) – Name of systemd service.

  • start_cmd (str) – Absolute path to executable and optional program arguments.

  • unit_dict (dict[str, str] | None) – Dictionary of additional keys and values for the Unit section.

  • service_dict (dict[str, str] | None) – Dictionary of additional keys and values for the Service section.

  • install_dict (dict[str, str] | None) – Dictionary of additional keys and values for the “Install” section.

enable()[source]

Enable autostart. Must be implemented in subclass.

Return type

None

disable()[source]

Disable autostart. Must be implemented in subclass.

Return type

None

property enabled[source]

Checks if the systemd service is enabled.

Return type

bool

class maestral.autostart.AutoStartLaunchd(bundle_id, start_cmd, **kwargs)[source]

Bases: AutoStartBase

Autostart backend for launchd

Parameters
  • bundle_id (str) – Bundle ID for the app, e.g., “com.google.calendar”.

  • start_cmd (str) – Absolute path to executable and optional program arguments.

  • kwargs – Additional key, value pairs to add to plist. Values may be strings, booleans, lists or dictionaries.

enable()[source]

Enable autostart. Must be implemented in subclass.

Return type

None

disable()[source]

Disable autostart. Must be implemented in subclass.

Return type

None

property enabled[source]

Checks if the launchd plist exists in ~/Library/LaunchAgents.

Return type

bool

class maestral.autostart.AutoStartXDGDesktop(app_name, start_cmd, filename, **kwargs)[source]

Bases: AutoStartBase

Autostart backend for XDG desktop entries

Used to start a GUI on user login for most Linux desktops. For a full specifications, please see:

https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

Parameters
  • app_name (str) – Name of application.

  • start_cmd (str) – Executable on $PATH or absolute path to executable and optional program arguments.

  • filename (str | None) – Name of desktop entry file. If not given, the application name will be used.

  • kwargs (str) – Additional key, value pairs to be used in the desktop entries. Values must be strings and may not contain “=”, otherwise no additional validation will be performed.

enable()[source]

Enable autostart. Must be implemented in subclass.

Return type

None

disable()[source]

Disable autostart. Must be implemented in subclass.

Return type

None

property enabled[source]

Checks if the XDG desktop entry exists in ~/.config/autostart.

Return type

bool

maestral.autostart.get_available_implementation()[source]

Returns the supported implementation depending on the platform.

Return type

SupportedImplementations | None

maestral.autostart.get_maestral_command_path()[source]

Returns the path to the maestral executable. May be an empty string if the executable cannot be found.

Return type

str

class maestral.autostart.AutoStart(config_name)[source]

Starts Maestral on user log-in

Creates auto-start files in the appropriate system location to automatically start Maestral when the user logs in. Different backends are used depending on the platform.

Parameters

config_name (str) – Name of Maestral config.

property enabled[source]

True if autostart is enabled, False otherwise.

Return type

bool

toggle()[source]

Toggles autostart on or off.

Return type

None

enable()[source]

Enable autostart.

Return type

None

disable()[source]

Disable autostart.

Return type

None