aboutsummaryrefslogtreecommitdiff
path: root/config/i3blocks/scripts/battery
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2020-10-08 07:49:07 +0200
committerKarel Kočí <karel.koci@nic.cz>2020-10-08 07:49:07 +0200
commit6c87803ec2c5338f9246c8689f3aded284417604 (patch)
treec37fa77117690c8592fa8922bf9ce256ca5423ad /config/i3blocks/scripts/battery
parent1552cdb455cd342590f22adc3d647cefc7f99b14 (diff)
downloadmyconfigs-6c87803ec2c5338f9246c8689f3aded284417604.tar.gz
myconfigs-6c87803ec2c5338f9246c8689f3aded284417604.tar.bz2
myconfigs-6c87803ec2c5338f9246c8689f3aded284417604.zip
config/i3blocks: cleanup scripts
We either do not use these or can use contrib ones.
Diffstat (limited to 'config/i3blocks/scripts/battery')
-rwxr-xr-xconfig/i3blocks/scripts/battery75
1 files changed, 0 insertions, 75 deletions
diff --git a/config/i3blocks/scripts/battery b/config/i3blocks/scripts/battery
deleted file mode 100755
index 7a5563a..0000000
--- a/config/i3blocks/scripts/battery
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
-# Copyright 2014 Vivien Didelot <vivien@didelot.org>
-#
-# Licensed under the terms of the GNU GPL v3, or any later version.
-#
-# This script is meant to use with i3blocks. It parses the output of the "acpi"
-# command (often provided by a package of the same name) to read the status of
-# the battery, and eventually its remaining time (to full charge or discharge).
-#
-# The color will gradually change for a percentage below 85%, and the urgency
-# (exit code 33) is set if there is less that 5% remaining.
-
-use strict;
-use warnings;
-use utf8;
-
-my $acpi;
-my $status;
-my $percent;
-my $full_text;
-my $short_text;
-my $bat_number = $ENV{BLOCK_INSTANCE} || 0;
-
-# read the first line of the "acpi" command output
-open (ACPI, "acpi -b | grep 'Battery $bat_number' |") or die;
-$acpi = <ACPI>;
-close(ACPI);
-
-# fail on unexpected output
-if ($acpi !~ /: (\w+), (\d+)%/) {
- die "$acpi\n";
-}
-
-$status = $1;
-$percent = $2;
-
-if ($status eq 'Discharging') {
- $full_text = '🔋 ';
-} elsif ($status eq 'Charging') {
- $full_text = '🔌 ';
-}
-
-$full_text .= "$percent%";
-
-$short_text = $full_text;
-
-if ($acpi =~ /(\d\d:\d\d):/) {
- $full_text .= " ($1)";
-}
-
-# print text
-print "$full_text\n";
-print "$short_text\n";
-
-# consider color and urgent flag only on discharge
-if ($status eq 'Discharging') {
-
- if ($percent < 20) {
- print "#FF0000\n";
- } elsif ($percent < 40) {
- print "#FFAE00\n";
- } elsif ($percent < 60) {
- print "#FFF600\n";
- } elsif ($percent < 85) {
- print "#A8FF00\n";
- }
-
- if ($percent < 5) {
- exit(33);
- }
-}
-
-exit(0);