From 8f1bad5de975e24e641ff7a18a665f8a6cd48774 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 5 May 2022 21:57:40 +0200 Subject: Merged some status scripts into one. The functionality as changed a bit, check the source if you relied on notify-* scripts. --- Makefile | 3 +-- notify-battery | 10 ---------- notify-time | 15 --------------- old/notify-battery | 10 ++++++++++ old/notify-time | 15 +++++++++++++++ status | 29 +++++++++++++++++++++++++++++ 6 files changed, 55 insertions(+), 27 deletions(-) delete mode 100755 notify-battery delete mode 100755 notify-time create mode 100755 old/notify-battery create mode 100755 old/notify-time create mode 100755 status diff --git a/Makefile b/Makefile index 1013b4e..0abcda8 100644 --- 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/notify-battery deleted file mode 100755 index 0294b70..0000000 --- a/notify-battery +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Popup battery notification, based on the script battery-status - -# Requires: notify-send or similar - -#notify=notify-send -notify=herbe - -$notify "Battery" "$(battery-status)" diff --git a/notify-time b/notify-time deleted file mode 100755 index 4b77c74..0000000 --- a/notify-time +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Little notification to show time and date - -# Requires: notify-send or similar - -# TODO: check if it still works with notify-send - -#notify=notify-send -notify=herbe - -t=$(date +"%H:%M:%S") -d=$(date +"%d %B %Y, %A") - -$notify "$t" "$d" diff --git a/old/notify-battery b/old/notify-battery new file mode 100755 index 0000000..0294b70 --- /dev/null +++ b/old/notify-battery @@ -0,0 +1,10 @@ +#!/bin/sh + +# Popup battery notification, based on the script battery-status + +# Requires: notify-send or similar + +#notify=notify-send +notify=herbe + +$notify "Battery" "$(battery-status)" diff --git a/old/notify-time b/old/notify-time new file mode 100755 index 0000000..4b77c74 --- /dev/null +++ b/old/notify-time @@ -0,0 +1,15 @@ +#!/bin/sh + +# Little notification to show time and date + +# Requires: notify-send or similar + +# TODO: check if it still works with notify-send + +#notify=notify-send +notify=herbe + +t=$(date +"%H:%M:%S") +d=$(date +"%d %B %Y, %A") + +$notify "$t" "$d" diff --git a/status b/status new file mode 100755 index 0000000..442e583 --- /dev/null +++ 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" -- cgit v1.3