appscripts: add a sxmo_notes script
Signed-off-by: Willow Barraco <contact@willowbarraco.fr> Signed-off-by: Anjandev Momi <anjan@momi.ca>
This commit is contained in:

committed by
Anjandev Momi

parent
3fbcf32fee
commit
0acdebf0a7
43
scripts/appscripts/sxmo_notes.sh
Executable file
43
scripts/appscripts/sxmo_notes.sh
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
# title=" Notes"
|
||||||
|
|
||||||
|
# shellcheck source=configs/default_hooks/sxmo_hook_icons.sh
|
||||||
|
. sxmo_hook_icons.sh
|
||||||
|
|
||||||
|
DIR="${XDG_DATA_HOME:-$HOME/.local/share}/sxmo.notes"
|
||||||
|
mkdir -p "$DIR"
|
||||||
|
|
||||||
|
_listnotes() {
|
||||||
|
( cd "$DIR" && find ./ -maxdepth 1 ) | cut -d/ -f2- | grep .
|
||||||
|
}
|
||||||
|
|
||||||
|
while : ; do
|
||||||
|
ENTRIES="$(cat <<EOF
|
||||||
|
$icon_cls Close Menu
|
||||||
|
$icon_trh Delete
|
||||||
|
$(_listnotes)
|
||||||
|
EOF
|
||||||
|
)"
|
||||||
|
PICKED="$(printf %b "$ENTRIES" | sxmo_dmenu.sh -p "Notes")" || break
|
||||||
|
|
||||||
|
case "$PICKED" in
|
||||||
|
"$icon_cls Close Menu"|"")
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"$icon_trh Delete")
|
||||||
|
ENTRIES="$(cat <<EOF
|
||||||
|
$icon_ret Cancel
|
||||||
|
$(_listnotes)
|
||||||
|
EOF
|
||||||
|
)"
|
||||||
|
PICKED="$(printf %b "$ENTRIES" | sxmo_dmenu.sh -p "Notes - Delete")" || break
|
||||||
|
if [ "$icon_ret Cancel" != "$PICKED" ]; then
|
||||||
|
rm -f "$DIR"/"$PICKED"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
sxmo_terminal.sh $EDITOR "$DIR"/"$PICKED"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
Reference in New Issue
Block a user