diff --git a/.bashrc b/.bashrc index dee11ca..e2ca0d4 100644 --- a/.bashrc +++ b/.bashrc @@ -35,6 +35,9 @@ if grep "arch-laptop" /etc/hostname &> /dev/null ; then export IS_LAPTOP=1 fi +# Path to store working directory +export WDIR_PATH="/tmp/$(id -u).wdir" + # include bash aliases if [ -f ~/.bash_aliases ] then @@ -53,3 +56,9 @@ then source ~/.nnn_bookmarks fi +if [ -f $WDIR_PATH ] +then + wdir="$(cat $WDIR_PATH)" + echo "Working directory from $WDIR_PATH" + cd "$wdir" +fi diff --git a/.custom_bash_scripts b/.custom_bash_scripts index 7bb7f02..c09e4a6 100644 --- a/.custom_bash_scripts +++ b/.custom_bash_scripts @@ -99,3 +99,30 @@ tzathura() fi zathura "$@" -e $( "$WDIR_PATH" && echo "set $wdir" +} + +pwdir() +{ + if [ -f "$WDIR_PATH" ] + then + cat "$WDIR_PATH" + else + echo "Working directory not set." + fi +} + +cwdir() +{ + if [ -f "$WDIR_PATH" ] + then + rm -f "$WDIR_PATH" + echo "Cleared working directory." + else + echo "Working directory not set." + fi +}