systemctl-import-environment
Import variables into service manager
TLDR
Import environment variable
SYNOPSIS
systemctl import-environment VARIABLE...
DESCRIPTION
systemctl import-environment imports environment variables from the current shell session into the systemd service manager's environment. These imported variables become available to all units started by the service manager.
This is commonly used with `--user` to pass display-related variables (like DISPLAY, WAYLANDDISPLAY, or XDGSESSION_ID) from the login session to user services.
PARAMETERS
--user
Import into user service manager environment--system
Import into system manager environment (default)
CAVEATS
Only affects services started after the import. Does not affect already running services. The system service manager typically runs in a minimal environment; importing user session variables may not be appropriate.
HISTORY
The import-environment subcommand enables proper integration between login sessions and systemd user services, solving the problem of user services not having access to session environment variables.
