bookmark - bookmark links, RSS feeds, and songs

This commit is contained in:
Oleksandr Miliukhin 2025-07-08 15:48:32 +03:00
parent a02b117056
commit 21779072aa

25
.local/bin/bookmark Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
getbookmark() {
bookmark="$(xclip -selection clipboard -o)"
tags=$(echo "" | dmenu -p "Enter bookmark tags (ENTER to save without tags)")
}
write_to_file () {
if grep -q -E "^$bookmark( |$)" "$file"; then
notify-send "Already bookmarked $bookmark!"
else
notify-send "Bookmarked $bookmark"
echo "$bookmark" "$tags" >> "$file"
echo "$bookmark" | xclip -selection clipboard -i
fi
}
case "$(printf "📜 rss\n🌍 url\n🌍📜 site (rss + url)\n🎵 song" | dmenu -i -p 'Bookmark: ')" in
'🌍📜 site (rss + url)') getbookmark && rssget "$bookmark" "$tags" && file="$HOME/.local/share/larbs/snippets" && write_to_file ;;
'📜 rss') getbookmark && rssget "$bookmark" "$tags" ;;
'🌍 url') getbookmark && file="$HOME/.local/share/larbs/snippets" && write_to_file ;;
'🎵 song') bookmark="$(mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d;/^ERROR/Q")"
file="$HOME/.local/share/larbs/songlog" && write_to_file ;;
*) exit 1 ;;
esac