add battery monitor program

This commit is contained in:
izzY 2023-05-26 06:11:39 -05:00
parent 8201828ee9
commit b13e18461c
3 changed files with 17 additions and 0 deletions

6
.local/bin/bar.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
while true
do
echo $(date +"%a, %B %d %Y @%I:%M %p %Z") "||" $(battstat) > ~/.config/sdorfehs/bar
done

View File

@ -5,6 +5,7 @@ permit nopass :staff cmd make
permit nopass :staff cmd reboot
permit nopass :staff cmd halt
permit nopass :staff cmd pkg_add
permit nopass :staff cmd install
permit nopass :staff cmd pkg_info
permit nopass :staff cmd pkg_delete
permit nopass :staff cmd sysmerge

View File

@ -123,6 +123,13 @@ sub compile_afetch {
system('doas', 'make', 'install');
}
# Setup Battery Monitor
sub setup_battstat {
system('git', 'clone', 'https://github.com/imwally/battstat.git', "$ENV{HOME}/.battstat");
chdir "$ENV{HOME}/.battstat";
system('doas', 'install', './battstat', '/usr/local/bin');
}
# Updates XDG user directories
sub update_xdg_user_dirs {
system('xdg-user-dirs-update');
@ -196,6 +203,9 @@ sub main {
print_message("Compiling afetch...");
compile_afetch();
print_message("Setting up Battery Monitor...");
setup_battstat();
closedir $dh;
update_xdg_user_dirs();