Advertisement
zerinol

Untitled

Jul 5th, 2020
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.57 KB | None | 0 0
  1. //batcheck
  2.  
  3. #!/bin/bash
  4.  
  5. BATTINFO=$(acpi -b)
  6. if [[ "$(echo $BATTINFO | grep Discharging)" && "$(echo $BATTINFO | cut -f 5 -d " ")" < 00:05:00 ]]; then
  7.  
  8.     systemctl hibernate
  9.  
  10. elif [[ "$(echo $BATTINFO | grep Discharging)" && "$(echo $BATTINFO | cut -f 5 -d " ")" < 00:15:00 ]] ; then
  11.  
  12.     if [ -r "$HOME/.dbus/Xdbus" ]; then
  13.       . "$HOME/.dbus/Xdbus"
  14.     fi  
  15.    
  16.     export DISPLAY=:0
  17.     notify-send -u critical "P-R-E-R-I-G-O" "$BATTINFO"
  18.  
  19. fi
  20.  
  21. //~/.dbus/Xdbus
  22.  
  23. DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
  24. export DBUS_SESSION_BUS_ADDRESS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement