summaryrefslogtreecommitdiff
path: root/dotfiles/system/.local/bin/org-capture.sh
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-01-26 17:36:38 -0600
committerCraig Jennings <c@cjennings.net>2026-01-26 17:36:38 -0600
commitdada2f255daaa2fb493ec8c7d47e2a8123aea494 (patch)
tree0c0eeb84bb7b6e66a2d7f41cdfd061b25f80cc14 /dotfiles/system/.local/bin/org-capture.sh
parentd50e5955837788fc69b4d5bc74cb574b859ed31a (diff)
refactor(dotfiles): rename system/ to common/ and remove unused configs
Rename dotfiles/system to dotfiles/common for clarity - indicates shared dotfiles used across all desktop environments (DWM, Hyprland). Removed config directories for uninstalled applications: - ghostty (using different terminal) - lf (using ranger instead) - mopidy (using mpd instead) - nitrogen (X11-only, obsolete for Wayland) - pychess (not installed) - JetBrains (not installed via archsetup) - youtube-dl (using yt-dlp with different config location) Kept audacious config for potential future use. Updated all references in archsetup, CLAUDE.md, todo.org, and validation.sh. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'dotfiles/system/.local/bin/org-capture.sh')
-rwxr-xr-xdotfiles/system/.local/bin/org-capture.sh159
1 files changed, 0 insertions, 159 deletions
diff --git a/dotfiles/system/.local/bin/org-capture.sh b/dotfiles/system/.local/bin/org-capture.sh
deleted file mode 100755
index 1e63177..0000000
--- a/dotfiles/system/.local/bin/org-capture.sh
+++ /dev/null
@@ -1,159 +0,0 @@
-#!/bin/bash
-
-# * Defaults
-
-heading=" "
-protocol="capture-html"
-template="w"
-
-# * Functions
-
-function debug {
- if [[ -n $debug ]]
- then
- function debug {
- echo "DEBUG: $@" >&2
- }
- debug "$@"
- else
- function debug {
- true
- }
- fi
-}
-function die {
- echo "$@" >&2
- exit 1
-}
-function usage {
- cat <<EOF
-$0 [OPTIONS] [HTML]
-html | $0 [OPTIONS]
-
-Send HTML to Emacs through org-protocol, passing it through Pandoc to
-convert HTML to Org-mode. HTML may be passed as an argument or
-through STDIN. If only URL is given, it will be downloaded and its
-contents used.
-
-Options:
- -h, --heading HEADING Heading
- -r, --readability Capture web page article with python-readability
- -t, --template TEMPLATE org-capture template key (default: w)
- -u, --url URL URL
-
- --debug Print debug info
- --help I need somebody!
-EOF
-}
-
-function urlencode {
- python -c "
-from __future__ import print_function
-try:
- from urllib import quote # Python 2
-except ImportError:
- from urllib.parse import quote # Python 3
-import sys
-
-print(quote(sys.stdin.read()[:-1], safe=''))"
-}
-
-# * Args
-
-args=$(getopt -n "$0" -o dh:rt:u: -l debug,help,heading:,readability,template:,url: -- "$@") \
- || die "Unable to parse args. Is getopt installed?"
-eval set -- "$args"
-
-while true
-do
- case "$1" in
- -d|--debug)
- debug=true
- debug "Debugging on"
- ;;
- --help)
- usage
- exit
- ;;
- -h|--heading)
- shift
- heading="$1"
- ;;
- -r|--readability)
- protocol="capture-eww-readable"
- readability=true
- ;;
- -t|--template)
- shift
- template="$1"
- ;;
- -u|--url)
- shift
- url="$1"
- ;;
- --)
- # Remaining args
- shift
- rest=("$@")
- break
- ;;
- esac
-
- shift
-done
-
-debug "ARGS: $args"
-debug "Remaining args: ${rest[@]}"
-
-# * Main
-
-# ** Get HTML
-
-if [[ -n $@ ]]
-then
- debug "HTML from args"
-
- html="$@"
-
-elif ! [[ -t 0 ]]
-then
- debug "HTML from STDIN"
-
- html=$(cat)
-
-elif [[ -n $url && ! -n $readability ]]
-then
- debug "Only URL given; downloading..."
-
- # Download URL
- html=$(curl "$url") || die "Unable to download $url"
-
- # Get HTML title for heading
- heading=$(sed -nr '/<title>/{s|.*<title>([^<]+)</title>.*|\1|i;p;q};' <<<"$html") || heading="A web page with no name"
-
- debug "Using heading: $heading"
-
-elif [[ -n $readability ]]
-then
- debug "Using readability"
-
-else
- usage
- echo
- die "I need somethin' ta go on, Cap'n!"
-fi
-
-# ** Check URL
-# The URL shouldn't be empty
-
-[[ -n $url ]] || url="http://example.com"
-
-# ** URL-encode html
-
-heading=$(urlencode <<<"$heading") || die "Unable to urlencode heading."
-url=$(urlencode <<<"$url") || die "Unable to urlencode URL."
-html=$(urlencode <<<"$html") || die "Unable to urlencode HTML."
-
-# ** Send to Emacs
-
-emacsclient "org-protocol://$protocol?template=$template&url=$url&title=$heading&body=$html"