betterer code

This commit is contained in:
coolnsx
2023-01-15 19:45:28 +05:30
parent 6007f6baf6
commit 48b2c30cad
4 changed files with 15 additions and 12 deletions

4
bkmark
View File

@@ -16,12 +16,12 @@ if [ "$*" = "add" ];then
notify-send "Bookmarked" "$data"
fi
elif [ "$*" = "rm" ];then
data="$(cat "$file" | sed '/^$/d' | nl -n'ln')"
data="$(sed '/^$/d' "$file" | nl -n'ln')"
[ -z "$data" ] && notify-send "Bookmark is empty" && exit 0
del=$(printf "%s" "$data" | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 30 -p "delete-bookmark :" | cut -f1)
[ -z "$del" ] || (sed -i "${del}d" "$file" && notify-send "Bookmarked deleted")
else
wtype -d 5 "$(cat "$file" | sed '/^$/d' | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 30 -p "Put-bookmark :" | tr '\`' '\n')"
wtype -d 5 "$(sed '/^$/d' "$file" | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 30 -p "Put-bookmark :" | tr '\`' '\n')"
fi
sed -i '/^$/d' "$file"