CmdID / Commands
Report whether the computer is connected to an external power source. tldr-pages
On Linux
Opens CmdID with your command. It is read in your browser and sent nowhere.
Silently check and return a 0 status code when running on AC power, and a non-zero code otherwise
systemd-ac-power
Additionally print yes or no to stdout
systemd-ac-power --verbose