This commit is contained in:
2025-04-17 10:49:27 -07:00
parent 739e3f8837
commit 35ed3e1343
5 changed files with 8 additions and 7 deletions

View File

@@ -1,6 +1,5 @@
#!/bin/sh
clipboard_text=$(wl-paste -p)
bookmarks_file="$HOME/.local/share/bookmarks/bookmarks"
if [ ! -f "$bookmarks_file" ]; then
@@ -9,6 +8,10 @@ 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)
@@ -25,10 +28,8 @@ 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 selected" "Please highlight some text to save as a bookmark."
notify-send "No text to save" "Clipboard and primary selection are empty."
fi