buncha stuff

This commit is contained in:
2025-04-17 19:19:37 -07:00
parent d4d48ef96d
commit f18f11279f
9 changed files with 714 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
#!/bin/sh
clipboard_text=$(wl-paste -p)
bookmarks_file="$HOME/.local/share/bookmarks/bookmarks"
if [ ! -f "$bookmarks_file" ]; then
@@ -8,13 +9,12 @@ if [ ! -f "$bookmarks_file" ]; then
exit 1
fi
# Try clipboard first, fall back to primary
clipboard_text=$(wl-paste --no-newline 2>/dev/null)
[ -z "$clipboard_text" ] && clipboard_text=$(wl-paste -p --no-newline 2>/dev/null)
# Trim leading/trailing whitespace
clipboard_text=$(echo "$clipboard_text" | xargs)
# Strip https:// or http://
clipboard_text=$(echo "$clipboard_text" | sed 's#^https\?://##')
# Remove trailing slashes
clipboard_text=$(echo "$clipboard_text" | sed 's#/$##')
@@ -25,8 +25,10 @@ if [ -n "$clipboard_text" ]; then
else
echo "$clipboard_text" >> "$bookmarks_file"
notify-send "Bookmark saved" "$clipboard_text"
# Run git update script
sh "$HOME/.local/bin/bookmark_update"
fi
else
notify-send "No text to save" "Clipboard and primary selection are empty."
notify-send "No text selected" "Please highlight some text to save as a bookmark."
fi