I was told to leave it alone, but I have this thing called OCD, you see

This commit is contained in:
CoolnsX
2022-11-08 23:18:40 +05:30
parent fb7a16f018
commit dc0a79c58b

26
bkmark Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
#script for bookmarking selected items and later using it..
data="$(xclip -o)"
file="$HOME/.cache/bookmarks"
if [ "$*" = "add" ];then
if [ "$data" = "Error: target STRING not available" ];then
notify-send "Please select anything to bookmark"
elif grep -q "^${data}$" "$file";then
notify-send "Already bookmarked"
else
printf "%s\n" "$data" >> "$file"
notify-send "Bookmarked" "$data"
fi
elif [ "$*" = "rm" ];then
data="$(cat "$file")"
[ -z "$data" ] && notify-send "Bookmark is empty" && exit 0
del=$(printf "%s" "$data" | dmenu -p "delete-bookmark :" | sed 's_/_\\/_g')
sed -E "s|^${del}$||g" .cache/bookmarks | sed '/^$/d' > "$file"
notify-send "Bookmarked deleted" "$del"
else
xdotool type "$(cat "$file" | dmenu -p "Put-bookmark :")"
fi