Results 1 to 2 of 2

Thread: play sund when critical battery

  1. #1
    Join Date
    Dec 2008
    Beans
    9
    Distro
    Xubuntu 9.04 Jaunty Jackalope

    play sund when critical battery

    Can somebody help me with a solution to play sound when xfce power manager critical battery warning pops up?

    Thank you
    Last edited by V Boti; 1 Week Ago at 11:36 AM.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    18,821
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: play sund when critical battery

    I have a cron task setup to run this script every 30 minutes:
    Code:
    $ more ~/bin/batt-chk.sh 
    #!/bin/bash
    
    # Battery 0: Not charging, 100
    BATT=$(/usr/bin/acpi  -i |/bin/grep  -v capacity \
    |/bin/sed  -e 's/^.*[cC]harging, //g' -e 's/\%.*$//' \
    |/bin/sed -e 's/^.*Discharging, //g' -e 's/\%.*$//')
    
    # echo \"$BATT\"
    
    if [ 50 -ge $BATT ] ; then
       /usr/bin/wall  "==INFO== Low battery: $BATT"
       /usr/bin/mpv  /usr/share/sounds/ubuntu/stereo/phone-incoming-call.ogg
    else
       echo "==INFO== Battery Level: $BATT %"
    fi

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •