feat : weekly update

This commit is contained in:
coolnsx
2023-11-02 13:06:34 +05:30
parent f81fc475b4
commit 61d772b93d
10 changed files with 269 additions and 265 deletions

View File

@@ -7,29 +7,29 @@ data="$(wl-paste -p | tr '\n' '\`' | sed 's/$/ /g')"
file="$HOME/.cache/bookmarks"
oshi_file="$HOME/.cache/oshi-urls"
case $1 in
case $1 in
add)
if [ -z "$data" ];then
notify-send "Please select anything to bookmark"
elif grep -q "${data}" "$file";then
notify-send -i "bookmark-missing" "Already bookmarked"
else
printf "%s" "$data" >> "$file"
notify-send -i "user-bookmarks" "Bookmarked" "$data"
fi
if [ -z "$data" ]; then
notify-send "Please select anything to bookmark"
elif grep -q "${data}" "$file"; then
notify-send -i "bookmark-missing" "Already bookmarked"
else
printf "%s" "$data" >>"$file"
notify-send -i "user-bookmarks" "Bookmarked" "$data"
fi
;;
rm)
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 -i "bookmark-missing" "Bookmark deleted" -u critical)
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 -i "bookmark-missing" "Bookmark deleted" -u critical)
;;
copy)
sed '/^$/d' "$file" "$oshi_file" | sed -E 's/.*DL: ([^|]*).*/\1/g' | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 30 -p "Put-bookmark :" | tr '\`' '\n' | wl-copy && notify-send "Copied to clipboard" -i "com.github.davidmhewitt.clipped"
;;
*)
result="$(sed '/^$/d' "$file" "$oshi_file" | sed -E 's/.*DL: ([^|]*).*/\1/g' | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 30 -p "Put-bookmark :" | tr '\`' '\n')"
if printf '%s' "$result" | grep -q 'B>';then
if printf '%s' "$result" | grep -q 'B>'; then
google-chrome-stable "$(printf '%s' "$result" | cut -d'>' -f2- | tr -d '\n ')"
else
wtype -d 10 "$result"
@@ -38,4 +38,4 @@ case $1 in
esac
sed -i '/^$/d' "$file"
printf "\n" >> "$file"
printf "\n" >>"$file"