diff --git a/.scripts/lecture-manager-shortcut.sh b/.scripts/lecture-manager-shortcut.sh new file mode 100644 index 0000000..c563e07 --- /dev/null +++ b/.scripts/lecture-manager-shortcut.sh @@ -0,0 +1,113 @@ +#!/bin/sh + +help_section=" +This simply creates a quick rofi interface for my lectures manager. +The notes manager is a program I created. +You can find it in the following link: +https://github.com/foo-dogsquared/a-remote-repo-full-of-notes-of-things-i-do-not-know-about/ . + +This shell script is specifically written for my system. +Don't expect it to work out-of-the-box so please edit this script accordingly. +" + +LECTURES=${LECTURES_DIRECTORY:-"$HOME/Documents/lectures"} +TERM="alacritty" # binary name of your terminal emulator + +while [[ $# -gt 0 ]] +do + case $1 in + -h|--help) + echo "$help_section" + exit 0;; + *) + shift;; + esac +done + +function prompt() { + value=$(exec "$1" || exit) + + return value +} + + +options='Create a new subject +Create a new lecture +Remove a subject +Remove a lecture +List all subjects and its notes +Open a note' + +actions=$(echo "$options" | rofi -dmenu -p "What do you want to do for the lectures?") + +if [[ $? != 0 ]]; then exit; fi + +lecture_manager_cmd="python $LECTURES/manager.py --target $HOME " +notes_list=$(eval "$lecture_manager_cmd list :all:") + +if [[ $actions == 'Create a new subject' ]]; then + subject=$(rofi -dmenu -p "What subject to be added into the binder?" || exit) + if [[ $? != 0 ]]; then exit; fi + + lecture_manager_cmd+="add --subject \"$subject\"" +elif [[ $actions == 'Create a new lecture' ]]; then + subject_list=$(echo "$notes_list" | sed "/^Subject \".+\" has [[:digit:]]+ notes?$/p" | awk -F "[\"\"]" '{ for (i=2; i