Skip to content

Instantly share code, notes, and snippets.

@Raymo111
Last active August 21, 2021 23:24
Show Gist options
  • Save Raymo111/56b5f4b1d5d13f6eb3a6b59d7cea2881 to your computer and use it in GitHub Desktop.
Save Raymo111/56b5f4b1d5d13f6eb3a6b59d7cea2881 to your computer and use it in GitHub Desktop.
UPS battery power notification
#!/bin/bash
#.
#.
#.
# (append this)
# Send a desktop notif
sudo -u raymo DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "Warning: Utility power has failed. Now running on battery." -i battery-caution -u critical -t 10000 -h 'string:desktop-entry:ups' -a UPS
[Desktop Entry]
Name=UPS
Comment=CyberPower UPS
Icon=preferences-system-power-management
Type=Application
Exec=systemmonitor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment