12345678910111213141516171819202122232425262728 |
- #!/usr/bin/env bash
- DMENU='dmenu -l 50 -p memo'
- [ -f "$HOME/.dmenurc" ] && . "$HOME/.dmenurc" && DMENU+="$DMENU_ARGS"
- SEL='xsel'
- DATE='date'
- FILE="$HOME/pipes/tasklist/dmemo"
- if [ -z "$1" ]; then
- pick="$($DMENU < $FILE)"
- if [ "$pick" ]; then
- IFS='>' read -ra entry <<< "$pick"
- len="${#entry[@]}"
- "$BROWSER" "${entry[$(( $len - 2 ))]}" && \
- sed -i "/${entry[$(( $len - 1 ))]}/d" "$FILE"
- fi
- else
- line="$($DATE)"
- if [ "$1" == '-s' ]; then
- line="$($SEL) > $line"
- memo="$($DMENU -p memo: <&-)"
- [ "$memo" ] && line="$memo > $line"
- else
- line="$1 > $line"
- [ "$2" ] && line="$2 > $line"
- fi
- echo "$line" >> "$FILE"
- fi
|