From b4f5a1515f601419def32b222f55a50e532c074d Mon Sep 17 00:00:00 2001 From: gutmet Date: Sun, 14 Mar 2021 16:28:41 +0100 Subject: [PATCH] remember last save directory --- save_screen.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/save_screen.sh b/save_screen.sh index e670a2e..3945606 100755 --- a/save_screen.sh +++ b/save_screen.sh @@ -1,7 +1,16 @@ #!/bin/sh + +DIRFILE="$HOME/.surf/lastsavedir" + +lastdir=$(cat "$DIRFILE") +if [ -n "$lastdir" ]; then + cd "$lastdir" +fi + filename=$(basename -s ".html" "$1") file=$(zenity --file-selection --save --filename="$filename.html") if [ -n "$file" ]; then cat > "$file" + dir=$(dirname "$file") + echo "$dir" > "$DIRFILE" fi -