From 6f37d2c95762cfee4f5c9c211002e30e7b2a44a0 Mon Sep 17 00:00:00 2001 From: foo-dogsquared Date: Mon, 30 Sep 2019 09:26:19 +0800 Subject: [PATCH] Update the lecture manager script --- .scripts/lecture-manager-shortcut.sh | 11 +++++------ i3/config | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.scripts/lecture-manager-shortcut.sh b/.scripts/lecture-manager-shortcut.sh index 47736e6..0b65d2d 100644 --- a/.scripts/lecture-manager-shortcut.sh +++ b/.scripts/lecture-manager-shortcut.sh @@ -93,17 +93,16 @@ elif [[ $actions == 'Remove a lecture' ]]; then if [[ $? != 0 ]]; then exit; fi note_list=$(eval $lecture_manager_cmd 'list' "$subject" | sed -n "s/^\s*-\s*//p") - title=$(echo "$note_list" | rofi -dmenu -p "What is the title of the note to be removed?") + title=$(echo "$note_list" | rofi -dmenu -p "What is the title of the note to be removed?" | sed --regexp-extended "s/^\s*\([[:digit:]]+\)\s*//") if [[ $? != 0 ]]; then exit; fi delete=$(echo -e "Yes\nNo" | rofi -dmenu -p "Delete the files on the disk?") if [[ $? != 0 ]]; then exit; fi - + + lecture_manager_cmd+="rm --note \"$subject\" \"$title\" " if [[ $delete == "Yes" ]]; then $lecture_manager_cmd+="--delete " fi - - lecture_manager_cmd+="--note \"$subject\" \"$title\"" elif [[ $actions == 'List all subjects and its notes' ]]; then lecture_manager_cmd+="list :all: " notes=$(eval $lecture_manager_cmd) @@ -118,7 +117,7 @@ elif [[ $actions == 'Open a note' ]]; then # I have my Pygmentize package in a virtual env, so I have the line below. # You can omit the line, if you have Pygmentize installed. source texture-notes-env/bin/activate - exec "$TERM" --command python "$LECTURES/manager.py" open $selected_note + exec "$TERM" --command python "$TEXTURE_NOTES_MANAGER/manager.py" --target "$TARGET" --config "$CONFIG" open $selected_note if [[ $? != 0 ]]; then notify-send "Opening note has failed." fi @@ -126,7 +125,7 @@ elif [[ $actions == 'Open a note' ]]; then exit fi -status=$(eval $lecture_manager_cmd) +status=$(eval "$lecture_manager_cmd") if [[ $? != 0 ]]; then diff --git a/i3/config b/i3/config index ebcc1a8..cb82387 100644 --- a/i3/config +++ b/i3/config @@ -271,7 +271,7 @@ bindsym $mod+Shift+c [instance="vim"] focus # Creating a lecture (it needs the custom lecture manager I created at # https://github.com/foo-dogsquared/a-remote-repo-full-of-notes-of-things-i-do-not-know-about/) -bindsym $mod+Shift+s exec ~/.scripts/lecture-manager-shortcut.sh +bindsym $mod+Shift+s exec ~/.scripts/lecture-manager-shortcut.sh --config ~/texture-notes-profile/config.py --target ~ # i3 bar bar {