diff options
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 23 | ||||
| -rwxr-xr-x | scripts/sdep-add | 6 | ||||
| -rwxr-xr-x | scripts/sdep-checknow | 12 | ||||
| -rwxr-xr-x | scripts/sdep-checkpast | 8 | ||||
| -rwxr-xr-x | scripts/sdep-clear | 6 | ||||
| -rwxr-xr-x | scripts/sdep-edit | 4 | ||||
| -rwxr-xr-x | scripts/sdep-list | 12 | ||||
| -rwxr-xr-x | sdep | bin | 0 -> 21928 bytes |
8 files changed, 33 insertions, 38 deletions
| @@ -4,8 +4,7 @@ VERSION = 0.1 | |||
| 4 | 4 | ||
| 5 | PREFIX = /usr/local | 5 | PREFIX = /usr/local |
| 6 | MANPREFIX = ${PREFIX}/share/man | 6 | MANPREFIX = ${PREFIX}/share/man |
| 7 | SDEPDATA = ${HOME}/.local/share/sdep | 7 | SCRIPTS = sdep-add sdep-checknow sdep-checkpast sdep-clear sdep-edit sdep-list |
| 8 | SCRIPTS = sdep-add sdep-checknow sdep-clear sdep-edit sdep-list sdep-checkpast | ||
| 9 | 8 | ||
| 10 | CPPFLAGS = -D_XOPEN_SOURCE=700 -DVERSION=\"${VERSION}\" | 9 | CPPFLAGS = -D_XOPEN_SOURCE=700 -DVERSION=\"${VERSION}\" |
| 11 | CFLAGS = -pedantic -Wall -Os ${CPPFLAGS} | 10 | CFLAGS = -pedantic -Wall -Os ${CPPFLAGS} |
| @@ -21,10 +20,10 @@ options: | |||
| 21 | @echo "CC = ${CC}" | 20 | @echo "CC = ${CC}" |
| 22 | 21 | ||
| 23 | sdep: | 22 | sdep: |
| 24 | ${CC} ${CFLAGS} -o sdep.o sdep.c | 23 | ${CC} ${CFLAGS} -o sdep sdep.c |
| 25 | 24 | ||
| 26 | clean: | 25 | clean: |
| 27 | rm -rf sdep.o sdep-${VERSION}.tar.gz scripts-build | 26 | rm -rf sdep sdep-${VERSION}.tar.gz |
| 28 | 27 | ||
| 29 | dist: clean | 28 | dist: clean |
| 30 | mkdir -p sdep-${VERSION} | 29 | mkdir -p sdep-${VERSION} |
| @@ -35,24 +34,16 @@ dist: clean | |||
| 35 | 34 | ||
| 36 | install: all | 35 | install: all |
| 37 | mkdir -p ${DESTDIR}${PREFIX}/bin | 36 | mkdir -p ${DESTDIR}${PREFIX}/bin |
| 38 | cp -f sdep.o ${DESTDIR}${PREFIX}/bin/sdep | 37 | cp -f sdep ${DESTDIR}${PREFIX}/bin/sdep |
| 39 | chmod 755 ${DESTDIR}${PREFIX}/bin/sdep | 38 | chmod 755 ${DESTDIR}${PREFIX}/bin/sdep |
| 40 | mkdir -p ${DESTDIR}${MANPREFIX}/man1 | 39 | mkdir -p ${DESTDIR}${MANPREFIX}/man1 |
| 41 | sed "s/VERSION/${VERSION}/g" < sdep.1 \ | 40 | sed "s/VERSION/${VERSION}/g" < sdep.1 \ |
| 42 | > ${DESTDIR}${MANPREFIX}/man1/sdep.1 | 41 | > ${DESTDIR}${MANPREFIX}/man1/sdep.1 |
| 43 | chmod 644 ${DESTDIR}${MANPREFIX}/man1/sdep.1 | 42 | chmod 644 ${DESTDIR}${MANPREFIX}/man1/sdep.1 |
| 44 | 43 | ||
| 45 | scripts: | 44 | scriptsinstall: |
| 46 | mkdir -p scripts-build | ||
| 47 | mkdir -p ${SDEPDATA} | ||
| 48 | for s in ${SCRIPTS}; do\ | 45 | for s in ${SCRIPTS}; do\ |
| 49 | sed "s|SDEPDATA|${SDEPDATA}|g" < scripts/$$s \ | 46 | cp -f scripts/$$s ${DESTDIR}${PREFIX}/bin ; \ |
| 50 | > scripts-build/$$s ;\ | ||
| 51 | done | ||
| 52 | |||
| 53 | scriptsinstall: scripts | ||
| 54 | for s in ${SCRIPTS}; do\ | ||
| 55 | cp -f scripts-build/$$s ${DESTDIR}${PREFIX}/bin ; \ | ||
| 56 | chmod 755 ${DESTDIR}${PREFIX}/bin/$$s ;\ | 47 | chmod 755 ${DESTDIR}${PREFIX}/bin/$$s ;\ |
| 57 | done | 48 | done |
| 58 | 49 | ||
| @@ -60,5 +51,5 @@ uninstall: | |||
| 60 | rm -rf ${DESTDIR}${PREFIX}/bin/sdep ${DESTDIR}${MANPREFIX}/man1/sdep.1 | 51 | rm -rf ${DESTDIR}${PREFIX}/bin/sdep ${DESTDIR}${MANPREFIX}/man1/sdep.1 |
| 61 | for s in ${SCRIPTS}; do rm -rf ${DESTDIR}${PREFIX}/bin/$$s; done | 52 | for s in ${SCRIPTS}; do rm -rf ${DESTDIR}${PREFIX}/bin/$$s; done |
| 62 | 53 | ||
| 63 | .PHONY: all options clean dist install scripts uninstall | 54 | .PHONY: all options clean dist install uninstall |
| 64 | 55 | ||
diff --git a/scripts/sdep-add b/scripts/sdep-add index bb0b2c8..c9f4344 100755 --- a/scripts/sdep-add +++ b/scripts/sdep-add | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # Adds a line to SDEPDATA/once. It is possible to specify a date, which will be | 3 | # Adds a line to $sdepdata/once. It is possible to specify a date, which will be |
| 4 | # read by date -d and prepended to the input text. | 4 | # read by date -d and prepended to the input text. |
| 5 | # -d is a non-portable option of GNU date. On some other systems one can | 5 | # -d is a non-portable option of GNU date. On some other systems one can |
| 6 | # accomplish the same with the -j option. | 6 | # accomplish the same with the -j option. |
| @@ -8,7 +8,9 @@ | |||
| 8 | # Usage: sdep-add [date] | 8 | # Usage: sdep-add [date] |
| 9 | # Example: sdep-add "next monday" | 9 | # Example: sdep-add "next monday" |
| 10 | 10 | ||
| 11 | file="SDEPDATA/once" | 11 | sdepdata="${XDG_DATA_HOME:-$HOME/.local}/sdep" |
| 12 | |||
| 13 | file="$sdepdata/once" | ||
| 12 | date="" | 14 | date="" |
| 13 | 15 | ||
| 14 | [ -n "$1" ] && date=$(date -d "$1" +%Y-%m-%d) | 16 | [ -n "$1" ] && date=$(date -d "$1" +%Y-%m-%d) |
diff --git a/scripts/sdep-checknow b/scripts/sdep-checknow index 2cb8f68..404d461 100755 --- a/scripts/sdep-checknow +++ b/scripts/sdep-checknow | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | # Run this every minute (for example using cron) to receive a notification | 3 | # Run this every minute (for example using cron) to receive a notification |
| 4 | # when an event happens. | 4 | # when an event happens. |
| 5 | # | 5 | # |
| 6 | # The events are read from the following files in SDEPDATA folder: | 6 | # The events are read from the following files in $sdepdata folder: |
| 7 | # once: events that only happen once; full date needs to be specified | 7 | # once: events that only happen once; full date needs to be specified |
| 8 | # daily: events that happen every day; only specify the time in HH:MM format | 8 | # daily: events that happen every day; only specify the time in HH:MM format |
| 9 | # weekly: only specify Weekday + time | 9 | # weekly: only specify Weekday + time |
| @@ -14,6 +14,8 @@ | |||
| 14 | # might have to change if you are not on Linux (on some systems you can | 14 | # might have to change if you are not on Linux (on some systems you can |
| 15 | # accomplish the same with -j). | 15 | # accomplish the same with -j). |
| 16 | 16 | ||
| 17 | sdepdata="${XDG_DATA_HOME:-$HOME/.local}/sdep" | ||
| 18 | |||
| 17 | #notify="notify-send -t 3600000" | 19 | #notify="notify-send -t 3600000" |
| 18 | notify=herbe | 20 | notify=herbe |
| 19 | title="$(date +%H:%M)" | 21 | title="$(date +%H:%M)" |
| @@ -23,17 +25,17 @@ sdepnotify() { | |||
| 23 | } | 25 | } |
| 24 | 26 | ||
| 25 | # One-off events | 27 | # One-off events |
| 26 | sdepnotify <"SDEPDATA/once" | 28 | sdepnotify <"$sdepdata/once" |
| 27 | 29 | ||
| 28 | # Daily events | 30 | # Daily events |
| 29 | sed "s/^/$(date +%Y-%m-%d) /" <"SDEPDATA/daily" | sdepnotify | 31 | sed "s/^/$(date +%Y-%m-%d) /" <"$sdepdata/daily" | sdepnotify |
| 30 | 32 | ||
| 31 | # Weekly events - needs GNU date (try -j intead of -d on BSD) | 33 | # Weekly events - needs GNU date (try -j intead of -d on BSD) |
| 32 | while read line; do | 34 | while read line; do |
| 33 | weekday=$(echo "$line" | sed "s/ .*$//") | 35 | weekday=$(echo "$line" | sed "s/ .*$//") |
| 34 | echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /" | 36 | echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /" |
| 35 | done <"SDEPDATA/weekly" | \ | 37 | done <"$sdepdata/weekly" | \ |
| 36 | sdepnotify | 38 | sdepnotify |
| 37 | 39 | ||
| 38 | # Monthly events | 40 | # Monthly events |
| 39 | sed "s/^[ ]*/$(date +%Y-%m-)/" <"SDEPDATA/daily" | sdepnotify | 41 | sed "s/^[ ]*/$(date +%Y-%m-)/" <"$sdepdata/daily" | sdepnotify |
diff --git a/scripts/sdep-checkpast b/scripts/sdep-checkpast index 35a561c..e5686fb 100755 --- a/scripts/sdep-checkpast +++ b/scripts/sdep-checkpast | |||
| @@ -1,13 +1,7 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # Run this at boot to receive a notification about past events that you might | 3 | # Run this at boot to receive a notification about past events that you might |
| 4 | # have missed | 4 | # have missed (based on sdep-list). |
| 5 | # | ||
| 6 | # The events are read from the following files in SDEPDATA folder: | ||
| 7 | # once: events that only happen once; full date needs to be specified | ||
| 8 | # daily: events that happen every day; only specify the time in HH:MM format | ||
| 9 | # weekly: only specify Weekday + time | ||
| 10 | # monthly: only specify day of the month + time | ||
| 11 | 5 | ||
| 12 | # Requires: a command to send notifications such as herbe or notify-send. | 6 | # Requires: a command to send notifications such as herbe or notify-send. |
| 13 | 7 | ||
diff --git a/scripts/sdep-clear b/scripts/sdep-clear index 814f853..98599ef 100755 --- a/scripts/sdep-clear +++ b/scripts/sdep-clear | |||
| @@ -1,10 +1,12 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # Removes old events from specified file (default: SDEPDATA/once). | 3 | # Removes old events from specified file (default: $sdepdata/once). |
| 4 | 4 | ||
| 5 | # Usage: sdep-clear [file] | 5 | # Usage: sdep-clear [file] |
| 6 | 6 | ||
| 7 | file="SDEPDATA/${1:-once}" | 7 | sdepdata="${XDG_DATA_HOME:-$HOME/.local}/sdep" |
| 8 | |||
| 9 | file="$sdepdata/${1:-once}" | ||
| 8 | temp=$(mktemp) | 10 | temp=$(mktemp) |
| 9 | 11 | ||
| 10 | sdep -t <"$file" >"$temp" | 12 | sdep -t <"$file" >"$temp" |
diff --git a/scripts/sdep-edit b/scripts/sdep-edit index d19a3f5..b561dd8 100755 --- a/scripts/sdep-edit +++ b/scripts/sdep-edit | |||
| @@ -5,7 +5,9 @@ | |||
| 5 | # Usage: sdep-edit [file] | 5 | # Usage: sdep-edit [file] |
| 6 | # No options = once | 6 | # No options = once |
| 7 | 7 | ||
| 8 | file="SDEPDATA/${1:-once}" | 8 | sdepdata="${XDG_DATA_HOME:-$HOME/.local}/sdep" |
| 9 | |||
| 10 | file="$sdepdata/${1:-once}" | ||
| 9 | editor=${VISUAL:-vi} | 11 | editor=${VISUAL:-vi} |
| 10 | 12 | ||
| 11 | $editor "$file" | 13 | $editor "$file" |
diff --git a/scripts/sdep-list b/scripts/sdep-list index a9e5405..c1e89f9 100755 --- a/scripts/sdep-list +++ b/scripts/sdep-list | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | # Recurring events are listed at most once, and only if their first occurrence | 4 | # Recurring events are listed at most once, and only if their first occurrence |
| 5 | # is in the range. | 5 | # is in the range. |
| 6 | # | 6 | # |
| 7 | # The events are read from the following files in the SDEPDATA folder: | 7 | # The events are read from the following files in the $sdepdata folder: |
| 8 | # once: events that only happen once; full date needs to be specified | 8 | # once: events that only happen once; full date needs to be specified |
| 9 | # daily: events that happen every day; only specify the time in HH:MM format | 9 | # daily: events that happen every day; only specify the time in HH:MM format |
| 10 | # weekly: only specify Weekday + time | 10 | # weekly: only specify Weekday + time |
| @@ -15,6 +15,8 @@ | |||
| 15 | # Usage: sdep-list [today|tomorrow|week|nextweek|past|future] | 15 | # Usage: sdep-list [today|tomorrow|week|nextweek|past|future] |
| 16 | # No options = all | 16 | # No options = all |
| 17 | 17 | ||
| 18 | sdepdata="${XDG_DATA_HOME:-$HOME/.local}/sdep" | ||
| 19 | |||
| 18 | from="" | 20 | from="" |
| 19 | to="" | 21 | to="" |
| 20 | w="%d %b %H:%M" | 22 | w="%d %b %H:%M" |
| @@ -52,13 +54,13 @@ esac | |||
| 52 | 54 | ||
| 53 | tempfile=$(mktemp) | 55 | tempfile=$(mktemp) |
| 54 | 56 | ||
| 55 | cat "SDEPDATA/once" > "$tempfile" | 57 | cat "$sdepdata/once" > "$tempfile" |
| 56 | sed "s/^/$(date +%Y-%m-%d) /" <"SDEPDATA/daily" | >> "$tempfile" | 58 | sed "s/^/$(date +%Y-%m-%d) /" <"$sdepdata/daily" | >> "$tempfile" |
| 57 | while read line; do | 59 | while read line; do |
| 58 | weekday=$(echo "$line" | sed "s/ .*$//") | 60 | weekday=$(echo "$line" | sed "s/ .*$//") |
| 59 | echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /" | 61 | echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /" |
| 60 | done <"SDEPDATA/weekly" >> "$tempfile" | 62 | done <"$sdepdata/weekly" >> "$tempfile" |
| 61 | sed "s/^[ ]*/$(date +%Y-%m-)/" <"SDEPDATA/daily" >> "$tempfile" | 63 | sed "s/^[ ]*/$(date +%Y-%m-)/" <"$sdepdata/daily" >> "$tempfile" |
| 62 | 64 | ||
| 63 | sdep -w "$w" -f "$from" -t "$to" <"$tempfile" | 65 | sdep -w "$w" -f "$from" -t "$to" <"$tempfile" |
| 64 | 66 | ||
| Binary files differ | |||
