scripts

Various scripts for UNIX-like systems
git clone https://git.tronto.net/scripts
Download | Log | Files | Refs | README

commit 8f1bad5de975e24e641ff7a18a665f8a6cd48774
parent 71a43325c4b523c781202785390bb11149d204e7
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Thu,  5 May 2022 21:57:40 +0200

Merged some status scripts into one. The functionality as changed a bit, check the source if you relied on notify-* scripts.

Diffstat:
MMakefile | 3+--
Rnotify-battery -> old/notify-battery | 0
Rnotify-time -> old/notify-time | 0
Astatus | 29+++++++++++++++++++++++++++++
4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile @@ -18,8 +18,6 @@ SCRIPTS = addressgrep \ ffmpeg-facecam \ mail-checknow \ mail-compose \ - notify-battery \ - notify-time \ open-file \ open-stdin \ open-url \ @@ -30,6 +28,7 @@ SCRIPTS = addressgrep \ sel \ sfeed-browser \ spawn \ + status \ templess \ terminal \ togglemute \ diff --git a/notify-battery b/old/notify-battery diff --git a/notify-time b/old/notify-time diff --git a/status b/status @@ -0,0 +1,29 @@ +#!/bin/sh + +# Prints some status info to stdout. Includes: +# - date and time +# - battery +# - wifi (requires nmcli) +# - past reminders, if any (requires sdep and sdep-list) + +# Usage: status [separator] + +sep=${1:-" | "} + +time=$(date +"%H:%M:%S") +date=$(date +"%d %B %Y, %A") + +bat="/sys/class/power_supply/BAT0" +if [ -d $bat ]; then + battery="Battery: $(cat $bat/capacity) $(cat $bat/status)" +else + battery="No battery" +fi + +network=$(nmcli device status | head -n 2 | tail -n 1 | awk '{print "Network: " $4}') + +events=$(sdep-list past | wc -l) + +printf "$time$sep$date$sep$battery$sep$network" +[ -n "$events" ] && printf "$sep$events TODO tasks" +printf "\n"