Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/perl
- $output = `acpi`;
- @output = split(/ /, $output);
- $last = "";
- # print($output[3]);
- while (1) {
- $output = `acpi`;
- @output = split(/ /, $output);
- #print($output[2]);
- if ($output[2] eq "Discharging,") {
- $bat = $output[3];
- #print("DECH");
- if ($bat eq "90%," && $last ne $bat) {
- `aplay /home/$HOME/Music/90.wav`;
- $last = $bat;
- } elsif ($bat eq "50%," && $last ne $bat) {
- `aplay /home/$HOME/Music/50.wav`;
- $last = $bat;
- } elsif ($bat eq "10%," && $last ne $bat) {
- `aplay /home/$HOME/Music/10.wav`;
- $last = $bat;
- }
- } else {
- $last = "";
- }
- sleep(5)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement