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 of 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 or multiple configurations.

class maestral.autostart.SupportedImplementations(value)[source]

Bases: enum.Enum

Enumeration of supported implementations

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

Bases: object

Base class for autostart backends

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: bool

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

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

Bases: maestral.autostart.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 (Optional[Dict[str, str]]) – Dictionary of additional keys and values for the Unit section.

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

  • install_dict (Optional[Dict[str, str]]) – Dictionary of additional keys and values for the Install section.

Return type

None

enable()[source]
Return type

None

disable()[source]
Return type

None

property enabled: bool

Checks if the systemd service is enabled.

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

Bases: maestral.autostart.AutoStartBase

Autostart backend for launchd

Parameters
  • bundle_id (str) – Bundle ID for the, 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.

Return type

None

enable()[source]
Return type

None

disable()[source]
Return type

None

property enabled: bool

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

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

Bases: maestral.autostart.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 (Optional[str]) – 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.

Return type

None

enable()[source]
Return type

None

disable()[source]
Return type

None

property enabled: bool

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

maestral.autostart.get_available_implementation()[source]

Returns the supported implementation depending on the platform.

Return type

Optional[maestral.autostart.SupportedImplementations]

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]

Bases: object

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.

Return type

None

property enabled: bool

True if autostart is enabled, False otherwise.

toggle()[source]

Toggles autostart on or off.

Return type

None

enable()[source]

Enable autostart.

Return type

None

disable()[source]

Disable autostart.

Return type

None