dotfiles/.bin/dexec_pim
2023-06-26 13:28:54 +02:00

53 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
. $HOME/.bin/_config
SEL=$(print "Notes\nDocuments\nContacts\nCalendar\nSlides" | $DMENU_CMD -p "Information System")
case $SEL in
Notes)
N=$(printf "Todo\nNotes\nEvents" | $DMENU_CMD -p Notes)
case $N in
Todo) hterm -e "vim scp://sdk@shell.codevoid.de/work/notes/todos.txt"; ;;
Notes) hterm -e "vim scp://sdk@shell.codevoid.de/work/notes/notes.txt" ;;
Events) hterm -e "vim scp://sdk@shell.codevoid.de/work/notes/events.txt" ;;
esac
;;
Documents)
DOC=$(ls -1pr $PIMDIR/documents/ | grep -v '/$' | sort -hr | $DMENU_CMD -p Documents -l 25)
if [ ! -z "$DOC" ]; then
ACT=$(printf "View\nCopy\nEdit\nPrint\nEmail\nDelete" | $DMENU_CMD -p Action)
case $ACT in
View) mupdf "$PIMDIR/documents/$DOC" ;;
Copy) echo "$PIMDIR/documents/$DOC" | xclip -r;;
Edit) pdfarranger "$PIMDIR/documents/$DOC" ;;
Email) texec "mutt -a \"$PIMDIR/documents/$DOC\"" ;;
Print) lpr "$PIMDIR/documents/$DOC" ;;
Delete) mkdir -p /tmp/deleted_documents; mv "$PIMDIR/documents/$DOC" /tmp/deleted_documents/; ;;
esac
fi
;;
Contacts)
eval $(gnome-keyring-daemon --start --components=secrets)
dbus-update-activation-environment --all
export GNOME_KEYRING_CONTROL GNOME_KEYRING_SOCKET GNOME_KEYRING_PID
gnome-contacts
;;
Calendar)
eval $(gnome-keyring-daemon --start --components=secrets)
dbus-update-activation-environment --all
export GNOME_KEYRING_CONTROL GNOME_KEYRING_SOCKET GNOME_KEYRING_PID
gnome-calendar
;;
Slides)
P=$(ls -1 "$PIMDIR/slides/" | sort -hr | $DMENU_CMD -p Slides -l 25)
if [ ! -z "$P" ]; then
ACT=$(printf "Open\nEdit" | $DMENU_CMD -p Action)
case $ACT in
Open) sent "$PIMDIR/slides/$P" ;;
Edit) texec "vim \"$PIMDIR/slides/$P\"" ;;
esac
fi
;;
esac