maestral.autostart ================== .. py:module:: maestral.autostart .. autoapi-nested-parse:: 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 --------------- .. py:class:: SupportedImplementations Bases: :py:obj:`enum.Enum` Enumeration of supported implementations .. py:attribute:: systemd :value: 'systemd' .. py:attribute:: launchd :value: 'launchd' .. py:attribute:: xdg_desktop :value: 'xdg_desktop' .. py:class:: AutoStartBase Base class for autostart backends .. py:method:: enable() :abstractmethod: Enable autostart. Must be implemented in subclass. .. py:method:: disable() :abstractmethod: Disable autostart. Must be implemented in subclass. .. py:property:: enabled :type: bool Returns the enabled status as bool. Must be implemented in subclass. .. py:class:: AutoStartSystemd(service_name, start_cmd, unit_dict = None, service_dict = None, install_dict = None) Bases: :py:obj:`AutoStartBase` Autostart backend for systemd :param service_name: Name of systemd service. :param start_cmd: Absolute path to executable and optional program arguments. :param unit_dict: Dictionary of additional keys and values for the Unit section. :param service_dict: Dictionary of additional keys and values for the Service section. :param install_dict: Dictionary of additional keys and values for the "Install" section. .. py:attribute:: service_name .. py:attribute:: destination .. py:attribute:: service_config .. py:method:: enable() Enable autostart. Must be implemented in subclass. .. py:method:: disable() Disable autostart. Must be implemented in subclass. .. py:property:: enabled :type: bool Checks if the systemd service is enabled. .. py:class:: AutoStartLaunchd(launchd_id, start_cmd, **kwargs) Bases: :py:obj:`AutoStartBase` Autostart backend for launchd :param launchd_id: Identifier for the launchd job, e.g., "com.google.calendar". :param start_cmd: Absolute path to executable and optional program arguments. :param kwargs: Additional key, value pairs to add to plist. Values may be strings, booleans, lists or dictionaries. .. py:attribute:: path .. py:attribute:: destination .. py:attribute:: plist_dict .. py:method:: enable() Enable autostart. Must be implemented in subclass. .. py:method:: disable() Disable autostart. Must be implemented in subclass. .. py:property:: enabled :type: bool Checks if the launchd plist exists in ~/Library/LaunchAgents. .. py:class:: AutoStartXDGDesktop(app_name, start_cmd, filename, **kwargs) Bases: :py:obj:`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 :param app_name: Name of application. :param start_cmd: Executable on $PATH or absolute path to executable and optional program arguments. :param filename: Name of desktop entry file. If not given, the application name will be used. :param 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. .. py:attribute:: config .. py:attribute:: destination .. py:method:: enable() Enable autostart. Must be implemented in subclass. .. py:method:: disable() Disable autostart. Must be implemented in subclass. .. py:property:: enabled :type: bool Checks if the XDG desktop entry exists in ~/.config/autostart. .. py:function:: get_available_implementation() Returns the supported implementation depending on the platform. .. py:function:: get_command_path(dist, command) Returns the path to a command line script. Tries to check dist_files first, falls back to :meth:`shutil.which` otherwise. :param dist: The distribution which installed the command line script. :param command: The command. .. py:class:: AutoStart(config_name) 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. :param config_name: Name of Maestral config. .. py:attribute:: implementation .. py:property:: enabled :type: bool True if autostart is enabled, False otherwise. .. py:method:: toggle() Toggles autostart on or off. .. py:method:: enable() Enable autostart. .. py:method:: disable() Disable autostart.