Fix battery i3block
This commit is contained in:
@@ -4,10 +4,10 @@ set $term kitty
|
|||||||
# set $term st
|
# set $term st
|
||||||
# set $term_alt urxvt
|
# set $term_alt urxvt
|
||||||
{{ if eq .chezmoi.hostname "x1-carbon" }}
|
{{ if eq .chezmoi.hostname "x1-carbon" }}
|
||||||
# set $term urxvt
|
set $term urxvt
|
||||||
# set $term_alt kitty
|
# set $term_alt kitty
|
||||||
# set $term_alt st
|
set $term_alt st
|
||||||
set $term_alt urxvt
|
# set $term_alt urxvt
|
||||||
exec dunst
|
exec dunst
|
||||||
exec compton
|
exec compton
|
||||||
exec imwheel
|
exec imwheel
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ color=#cbe4ff
|
|||||||
|
|
||||||
# ticker [[[ #
|
# ticker [[[ #
|
||||||
|
|
||||||
|
{{ if eq .chezmoi.hostname "nzxt" }}
|
||||||
|
|
||||||
# [ticker]
|
# [ticker]
|
||||||
# label=BTC
|
# label=BTC
|
||||||
# TICKER=BTC-USD
|
# TICKER=BTC-USD
|
||||||
@@ -35,6 +37,8 @@ interval=30
|
|||||||
# TICKER=^IXIC
|
# TICKER=^IXIC
|
||||||
# interval=30
|
# interval=30
|
||||||
|
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
# ]]] ticker #
|
# ]]] ticker #
|
||||||
|
|
||||||
# volume/spotify [[[ #
|
# volume/spotify [[[ #
|
||||||
@@ -69,7 +73,7 @@ interval=5
|
|||||||
|
|
||||||
{{ if eq .chezmoi.hostname "x1-carbon" }}
|
{{ if eq .chezmoi.hostname "x1-carbon" }}
|
||||||
[battery]
|
[battery]
|
||||||
label=⚡
|
label=⚡
|
||||||
interval=30
|
interval=30
|
||||||
|
|
||||||
[wifi]
|
[wifi]
|
||||||
|
|||||||
@@ -24,12 +24,16 @@ my $short_text;
|
|||||||
my $bat_number = $ENV{BLOCK_INSTANCE} || 0;
|
my $bat_number = $ENV{BLOCK_INSTANCE} || 0;
|
||||||
|
|
||||||
# read the first line of the "acpi" command output
|
# read the first line of the "acpi" command output
|
||||||
open (ACPI, "acpi -b | grep 'Battery $bat_number' |") or die;
|
open (ACPI, "acpi -b 2>/dev/null| grep 'Battery $bat_number' |") or die;
|
||||||
$acpi = <ACPI>;
|
$acpi = <ACPI>;
|
||||||
close(ACPI);
|
close(ACPI);
|
||||||
|
|
||||||
# fail on unexpected output
|
# fail on unexpected output
|
||||||
if ($acpi !~ /: (\w+), (\d+)%/) {
|
if (not defined($acpi)) {
|
||||||
|
# don't print anything to stderr if there is no battery
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
elsif ($acpi !~ /: ([\w\s]+), (\d+)%/) {
|
||||||
die "$acpi\n";
|
die "$acpi\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ INTERFACE="${BLOCK_INSTANCE:-wlan0}"
|
|||||||
QUALITY=$(sudo grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70) }')
|
QUALITY=$(sudo grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70) }')
|
||||||
# echo $QUALITY
|
# echo $QUALITY
|
||||||
W_inter=$(ip link | grep "[1-9]: wlp" | cut -d " " -f2 | tr -d ':')
|
W_inter=$(ip link | grep "[1-9]: wlp" | cut -d " " -f2 | tr -d ':')
|
||||||
W_name=$(nmcli d | grep "$W_inter" | awk '{print $4}')
|
# W_name=$(nmcli d | grep "$W_inter" | awk '{print $4}')
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# set recolor true
|
set recolor true
|
||||||
# black
|
# black
|
||||||
set recolor-darkcolor "#ffffff"
|
set recolor-darkcolor "#ffffff"
|
||||||
set recolor-lightcolor "#000000"
|
set recolor-lightcolor "#000000"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# mount_dir="/run/media/kevin/backup-hd"
|
mount_dir="/run/media/kevin/backup-hd"
|
||||||
mount_dir="/mnt/linux-files-2"
|
# mount_dir="/mnt/linux-files-2"
|
||||||
# Backup destination
|
# Backup destination
|
||||||
case $1 in
|
case $1 in
|
||||||
nzxt )
|
nzxt )
|
||||||
|
|||||||
Reference in New Issue
Block a user