From 40c19d5dfca9bfc12281301d4b7d8b2ac17a28fa Mon Sep 17 00:00:00 2001 From: joestandring Date: Fri, 31 Jan 2020 21:41:56 +0000 Subject: [PATCH] Add dwm_alarm --- README.md | 7 +++++++ bar-functions/dwm_alarm.sh | 25 +++++++++++++++++++++++++ dwm_bar.sh | 3 ++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 bar-functions/dwm_alarm.sh diff --git a/README.md b/README.md index efe99e8..9e4b73e 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ A modular statusbar for DWM - [dwm_pulse](#dwm_pulse) - [dwm_battery](#dwm_battery) - [dwm_countdown](#dwm_countdown) + - [dwm_alarm](#dwm_alarm) - [dwm_keyboard](#dwm_keyboard) - [dwm_resources](#dwm_resources) - [dwm_cmus](#dwm_cmus) @@ -47,6 +48,12 @@ Displays the status of [countdown](https://github.com/joestandring/countdown) [⏳ 00:10:00] ``` Dependencies: ```countdown.sh``` +### dwm_alarm +Displays upcoming alarms from [alarm](https://github.com/joestandring/alarm) +``` +[⏰ 22:30:00] +``` +Dependencies: ```alarm.sh``` ### dwm_keyboard Displays the current keyboard layout ``` diff --git a/bar-functions/dwm_alarm.sh b/bar-functions/dwm_alarm.sh new file mode 100755 index 0000000..2f82f1f --- /dev/null +++ b/bar-functions/dwm_alarm.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# A dwm_status function that displays upcoming alarms from alarm.sh +# Joe Standring +# GNU GPLv3 + +# Dependencies: https://github.com/joestandring/alarm + +dwm_alarm () { + for f in /tmp/alarm.*; do + if [ -e "$f" ]; then + printf "%s" "$SEP1" + if [ "$IDENTIFIER" = "unicode" ]; then + printf "⏰ %s" "$(cat /tmp/alarm.*)" + else + printf "ALM %s" "$(cat /tmp/alarm.*)" + fi + printf "%s\n" "$SEP2" + + break + fi + done +} + +dwm_alarm diff --git a/dwm_bar.sh b/dwm_bar.sh index 8af9a3e..5200cfb 100755 --- a/dwm_bar.sh +++ b/dwm_bar.sh @@ -23,6 +23,7 @@ export SEP2="]" # Import the modules . "$DIR/bar-functions/dwm_countdown.sh" +. "$DIR/bar-functions/dwm_alarm.sh" . "$DIR/bar-functions/dwm_transmission.sh" . "$DIR/bar-functions/dwm_cmus.sh" . "$DIR/bar-functions/dwm_resources.sh" @@ -41,6 +42,6 @@ export SEP2="]" # Update dwm status bar every second while true do - xsetroot -name "$(dwm_countdown)$(dwm_transmission)$(dwm_cmus)$(dwm_resources)$(dwm_battery)$(dwm_mail)$(dwm_backlight)$(dwm_alsa)$(dwm_pulse)$(dwm_weather)$(dwm_vpn)$(dwm_network)$(dwm_keyboard)$(dwm_date)" + xsetroot -name "$(dwm_countdown)$(dwm_alarm.sh)$(dwm_transmission)$(dwm_cmus)$(dwm_resources)$(dwm_battery)$(dwm_mail)$(dwm_backlight)$(dwm_alsa)$(dwm_pulse)$(dwm_weather)$(dwm_vpn)$(dwm_network)$(dwm_keyboard)$(dwm_date)" sleep 1 done