From 722455262f13b3012c20ca8498f4c1d4ad138155 Mon Sep 17 00:00:00 2001 From: Miles Alan Date: Sat, 21 Mar 2020 15:48:18 -0500 Subject: [PATCH] Add sxmo_timer.sh & sxmo_timermenu.sh --- scripts/sxmo_appmenu.sh | 13 +++++++------ scripts/sxmo_timer.sh | 24 ++++++++++++++++++++++++ scripts/sxmo_timermenu.sh | 22 ++++++++++++++++++++++ 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 scripts/sxmo_timer.sh create mode 100644 scripts/sxmo_timermenu.sh diff --git a/scripts/sxmo_appmenu.sh b/scripts/sxmo_appmenu.sh index 329b541..e1e368a 100755 --- a/scripts/sxmo_appmenu.sh +++ b/scripts/sxmo_appmenu.sh @@ -20,11 +20,12 @@ programchoicesinit() { ")" && WINNAME=sys echo $WMCLASS | grep -i "applications" && CHOICES="$(echo " - Surf ^ 0 ^ surf - NetSurf ^ 0 ^ netsurf - St ^ 0 ^ st - Firefox ^ 0 ^ firefox - Foxtrotgps ^ 0 ^ foxtrotgps + Surf ^ 0 ^ surf + NetSurf ^ 0 ^ netsurf + St ^ 0 ^ st + Firefox ^ 0 ^ firefox + Foxtrotgps ^ 0 ^ foxtrotgps + Timer ^ 0 ^ sxmo_timer.sh Close Menu ^ 0 ^ quit ")" && WINNAME=Apps @@ -123,7 +124,7 @@ mainloop() { cut -d'^' -f1 | sed '/^[[:space:]]*$/d' | awk '{$1=$1};1' | - dmenu -idx $DMENUIDX -l 10 -c -fn "Terminus-30" -p "$WINNAME" + dmenu -idx $DMENUIDX -l 14 -c -fn "Terminus-30" -p "$WINNAME" ) LOOP=$(echo "$CHOICES" | grep "$PICKED" | cut -d '^' -f2) CMD=$(echo "$CHOICES" | grep "$PICKED" | cut -d '^' -f3) diff --git a/scripts/sxmo_timer.sh b/scripts/sxmo_timer.sh new file mode 100644 index 0000000..0570b1f --- /dev/null +++ b/scripts/sxmo_timer.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env sh + +TIME=$( + echo "$@" | + sed 's#h#*60m#g'| + sed 's#m#*60s#g'| + sed 's#s#*1#g'| + sed 's# #+#g' | + bc +) + +date1=$((`date +%s` + $TIME)); +while [ "$date1" -ge `date +%s` ]; do + echo -ne "$(date -u --date @$(($date1 - `date +%s`)) +%H:%M:%S) \r"; + sleep 0.1 +done +echo "Done with $@" + +while :; + do notify-send "Done with $@"; + xset dpms force off + xset dpms force on + sleep 0.5 +done diff --git a/scripts/sxmo_timermenu.sh b/scripts/sxmo_timermenu.sh new file mode 100644 index 0000000..b5e3137 --- /dev/null +++ b/scripts/sxmo_timermenu.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env sh +sxmo_keyboard.sh on & +TIMEINPUT=$( +echo "1h +10m +9m +8m +7m +6m +5m +4m +3m +2m +1m +30s +Close Menu" | dmenu -p Timer -c -fn "Terminus-30" -l 20 +) +sxmo_keyboard.sh off & +[ "Close Menu" = $TIMEINPUT ] && exit 0 + +st -f Monospace-50 -e sxmo_timer.sh $TIMEINPUT +