From b2e8d5fc138d1ee9bb0eb0e4e3bf524a45d9fe25 Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Sun, 21 Jun 2026 17:03:56 +0100 Subject: Remove bin --- bin/.bin/new-episode | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100755 bin/.bin/new-episode (limited to 'bin/.bin') diff --git a/bin/.bin/new-episode b/bin/.bin/new-episode deleted file mode 100755 index c8a2305..0000000 --- a/bin/.bin/new-episode +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -if [ -z "$1" ]; then - echo "Usage: new-episode " - exit 1 -fi - -EP_NUM=$(printf "%03d" "$1") - -# Capture the Name (Shift the first arg so we can join the rest). -shift -RAW_NAME="${*:-untitled}" - -# Create the Title (Capitalize first letter of every word). -# Using a simple sed regex to capitalize words. -EP_TITLE=$(echo "$RAW_NAME" | sed 's/\b./\U&/g') - -# Create the Filename Slug (Lower case and replace spaces with hyphens) -# tr '[:upper:]' '[:lower:]' handles the casing -# tr ' ' '-' handles the spaces -SLUG=$(echo "$RAW_NAME" | tr '[:upper:]' '[:lower:]' | tr ' ' '-') -FILENAME="episode-${EP_NUM}-${SLUG}.php" - -# Generate the file -cat < "$FILENAME" - Date: Sun, 21 Jun 2026 19:01:25 +0100 Subject: Add bookmark management scripts --- bin/.bin/add-bookmark.sh | 36 ++++++++++++++++++++++++++++++++++++ bin/.bin/open-bookmark.sh | 23 +++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100755 bin/.bin/add-bookmark.sh create mode 100755 bin/.bin/open-bookmark.sh (limited to 'bin/.bin') diff --git a/bin/.bin/add-bookmark.sh b/bin/.bin/add-bookmark.sh new file mode 100755 index 0000000..9a8ab6b --- /dev/null +++ b/bin/.bin/add-bookmark.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +set -euo pipefail + +BOOKMARKS_FILE="$DOTFILES_REPO/bookmarks.txt" + +mkdir -p "$(dirname "$BOOKMARKS_FILE")" +touch "$BOOKMARKS_FILE" + +xdotool key --delay 50 ctrl+l ctrl+c Escape + +sleep 0.15 + +URL=$(xclip -selection clipboard -o) + +if [[ "$URL" =~ ^https?:// ]]; then + NAME=$(zenity --entry \ + --title="Add Bookmark" \ + --text="Enter a name for this bookmark:" \ + --entry-text="" 2>/dev/null) + + if [ -z "$NAME" ]; then + notify-send "Bookmark Cancelled" "No name was provided." + exit 0 + fi + + CLEAN_NAME=$(echo "$NAME" | tr '|' '-') + + if ! grep -q "|$URL$" "$BOOKMARKS_FILE"; then + echo "$CLEAN_NAME|$URL" >>"$BOOKMARKS_FILE" + notify-send "Bookmark Saved" "$CLEAN_NAME\n$URL" + else + notify-send "Bookmark" "This exact URL already exists!" + fi +else + notify-send "Bookmark Error" "Clipboard did not contain a valid URL." +fi diff --git a/bin/.bin/open-bookmark.sh b/bin/.bin/open-bookmark.sh new file mode 100755 index 0000000..67e724b --- /dev/null +++ b/bin/.bin/open-bookmark.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -euo pipefail + +BOOKMARKS_FILE="$DOTFILES_REPO/bookmarks.txt" + +if [ ! -f "$BOOKMARKS_FILE" ] || [ ! -s "$BOOKMARKS_FILE" ]; then + notify-send "Bookmarks" "Your bookmarks file is empty or missing." + exit 1 +fi + +SELECTION=$(cut -d'|' -f1 "$BOOKMARKS_FILE" | rofi -dmenu -p "Go To:") + +if [ -z "$SELECTION" ]; then + exit 0 +fi + +URL=$(grep "^$SELECTION|" "$BOOKMARKS_FILE" | head -n 1 | cut -d'|' -f2) + +if [ -n "$URL" ]; then + firefox "$URL" & +else + notify-send "Error" "Could not resolve the URL for: $SELECTION" +fi -- cgit v1.2.3-13-gbd6f