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

property enabled: bool[source]#

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

Return type:

bool

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

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.

property enabled: bool[source]#

Checks if the systemd service is enabled.

Return type:

bool

enable()[source]#

Enable autostart. Must be implemented in subclass.

Return type:

None

disable()[source]#

Disable autostart. Must be implemented in subclass.

Return type:

None

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

Bases: AutoStartBase

Autostart backend for launchd

Parameters:
  • launchd_id (str) – Identifier for the launchd job, e.g., “com.google.calendar”.

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

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

property enabled: bool[source]#

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

Return type:

bool

enable()[source]#

Enable autostart. Must be implemented in subclass.

Return type:

None

disable()[source]#

Disable autostart. Must be implemented in subclass.

Return type:

None

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.

property enabled: bool[source]#

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

Return type:

bool

enable()[source]#

Enable autostart. Must be implemented in subclass.

Return type:

None

disable()[source]#

Disable autostart. Must be implemented in subclass.

Return type:

None

maestral.autostart.get_available_implementation()[source]#

Returns the supported implementation depending on the platform.

Return type:

SupportedImplementations | None

maestral.autostart.get_command_path(dist, command)[source]#

Returns the path to a command line script. Tries to check dist_files first, falls back to shutil.which() otherwise.

Parameters:
  • dist (str) – The distribution which installed the command line script.

  • command (str) – The command.

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