diff --git a/dots/applications/trash-put.desktop b/dots/applications/tp.desktop similarity index 91% rename from dots/applications/trash-put.desktop rename to dots/applications/tp.desktop index b2938bd..9ede51c 100644 --- a/dots/applications/trash-put.desktop +++ b/dots/applications/tp.desktop @@ -2,7 +2,7 @@ Name=trash-put GenericName=trash-put Icon=system-error -Exec=trash-put +Exec=tp.sh Terminal=false Type=Application Categories=System;FileTools;FileManager diff --git a/dots/bash/.bashrc b/dots/bash/.bashrc index a0ec6fd..a365326 100644 --- a/dots/bash/.bashrc +++ b/dots/bash/.bashrc @@ -38,12 +38,13 @@ ex () fi } -alias ffind="sudo find / -type f -name" -alias keymap="setxkbmap -model pc105 -layout us,no -option grp:caps_toggle,grp_led:scroll" -alias nr="nitrogen --restore" -alias myip="echo $(wget http://ipinfo.io/ip -qO -)" alias curae="sudo curae" +alias ffind="sudo find / -type f -name" alias gparted="sudo gparted" +alias keymap="setxkbmap -model pc105 -layout us,no -option grp:caps_toggle,grp_led:scroll" +alias myip="echo $(wget http://ipinfo.io/ip -qO -)" +alias nr="nitrogen --restore" +alias tp="tp.sh" nmrestart() { systemctl restart NetworkManager diff --git a/dots/bin/tp.sh b/dots/bin/tp.sh new file mode 100755 index 0000000..f16babe --- /dev/null +++ b/dots/bin/tp.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# klevstul :: 24.06 + +this_file_name=`basename "$0"` +if [ $# -lt 1 ]; then + echo "error: path to file is missing." + echo "usage: '$this_file_name [path_to_file]'" + exit 1 +fi +input_file=$1 + +sync_dir_sym=/home/${USER}/syncDir +syncdir_env_var=SYNCDIR_${HOSTNAME} +sync_dir=${!syncdir_env_var} # '!' to use the name and not the value + +#echo ${input_file} +#echo ${sync_dir_sym} +#echo ${sync_dir} + +# substitute parts of the old path, from using the symlink folder, to the non-symlink folder +# example: +# "/home/poq/syncDir/0_downloads/topBanner.jpg" > "/home/poq/nextcloud/syncDir/0_downloads/topBanner.jpg" +# +# new_file=${original_string//old_substring/new_substring} +new_file=${input_file//$sync_dir_sym/$sync_dir} + +if [ -f ${new_file} ] ; then + trash-put ${new_file} +fi