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.

Module Contents

Classes

SupportedImplementations

Enumeration of supported implementations

AutoStartBase

Base class for autostart backends

AutoStartSystemd

Autostart backend for systemd

AutoStartLaunchd

Autostart backend for launchd

AutoStartXDGDesktop

Autostart backend for XDG desktop entries

AutoStart

Starts Maestral on user log-in

Functions

get_available_implementation() → Optional[SupportedImplementations]

Returns the supported implementation depending on the platform.

get_maestral_command_path() → str

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

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(self)None[source]

Enable autostart. Must be implemented in subclass.

abstract disable(self)None[source]

Disable autostart. Must be implemented in subclass.

property enabled(self)bool[source]

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

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

Bases: maestral.autostart.AutoStartBase

Autostart backend for systemd

Parameters
  • service_name – Name of systemd service.

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

  • unit_dict – Dictionary of additional keys and values for the Unit section.

  • service_dict – Dictionary of additional keys and values for the Service section.

  • install_dict – Dictionary of additional keys and values for the Install section.

enable(self)None[source]

Enable autostart. Must be implemented in subclass.

disable(self)None[source]

Disable autostart. Must be implemented in subclass.

property enabled(self)bool[source]

Checks if the systemd service is enabled.

class maestral.autostart.AutoStartLaunchd(bundle_id: str, start_cmd: str)[source]

Bases: maestral.autostart.AutoStartBase

Autostart backend for launchd

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

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

enable(self)None[source]

Enable autostart. Must be implemented in subclass.

disable(self)None[source]

Disable autostart. Must be implemented in subclass.

property enabled(self)bool[source]

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

class maestral.autostart.AutoStartXDGDesktop(app_name: str, start_cmd: str, filename: Optional[str], **kwargs: str)[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
  • Name – Name of application.

  • Exec – Executable on $PATH or absolute path to executable and optional program arguments.

  • filename – Name of desktop entry file. If not given, the application name will be used.

  • kwargs – 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(self)None[source]

Enable autostart. Must be implemented in subclass.

disable(self)None[source]

Disable autostart. Must be implemented in subclass.

property enabled(self)bool[source]

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

maestral.autostart.get_available_implementation() → Optional[SupportedImplementations][source]

Returns the supported implementation depending on the platform.

maestral.autostart.get_maestral_command_path()str[source]

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

class maestral.autostart.AutoStart(config_name: str)[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 – Name of Maestral config.

property enabled(self)bool[source]

True if autostart is enabled.

toggle(self)None[source]

Toggles autostart on or off.

enable(self)None[source]

Setter: True if autostart is enabled.

disable(self)None[source]

Setter: True if autostart is enabled.