Add the installer, uninstaller, and generated docs

This commit is contained in:
2026-09-20 00:19:38 -04:00
parent 0c422e7345
commit 3e65d176e3
100 changed files with 2585 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
#!/bin/bash
# blob:summary=Regenerate docs/commands.md from each command's own metadata
# blob:hidden=true
set -e
bin_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
repo_dir="$(dirname "$bin_dir")"
output="$repo_dir/docs/commands.md"
metadata() {
sed -n "s/^# blob:$2=//p" "$1" | head -1
}
area_of() {
local name="${1#blob-}"
printf '%s\n' "${name%%-*}"
}
{
echo "# Commands"
echo
echo "Generated by \`blob-docs-commands\` from the \`# blob:summary=\` line in each"
echo "file. Do not edit by hand."
echo
echo "Commands marked hidden are plumbing other commands call, and are left out"
echo "of the \`blob\` listing."
echo
current_area=""
for file in "$bin_dir"/blob-*; do
[[ -f $file ]] || continue
name="$(basename "$file")"
area="$(area_of "$name")"
if [[ $area != "$current_area" ]]; then
echo
echo "## $area"
echo
echo "| Command | Does | Arguments |"
echo "| --- | --- | --- |"
current_area="$area"
fi
summary="$(metadata "$file" summary)"
args="$(metadata "$file" args)"
[[ -n $summary ]] || summary="-"
[[ -n $args ]] || args="-"
if grep -q '^# blob:hidden=true' "$file"; then
summary="$summary (hidden)"
fi
printf '| `%s` | %s | %s |\n' "$name" "$summary" "${args//|/\\|}"
done
echo
echo "## Totals"
echo
printf '%s commands.\n' "$(ls "$bin_dir"/blob-* | wc -l)"
} > "$output"
echo "Wrote $output"
+60
View File
@@ -0,0 +1,60 @@
#!/bin/bash
# blob:summary=Regenerate docs/keybinds.md from the Hyprland Lua bindings
# blob:hidden=true
set -e
bin_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
repo_dir="$(dirname "$bin_dir")"
output="$repo_dir/docs/keybinds.md"
# o.bind("KEYS", "Description", ...) and o.bind_toggle("KEYS", "Description", ...)
# are the only two forms the Lua layer uses to declare a binding.
collect() {
local file="$1"
grep -ohE 'o\.bind(_toggle)?\(\s*"[^"]+",\s*"[^"]+"' "$file" 2>/dev/null |
sed -E 's/o\.bind(_toggle)?\(\s*"([^"]+)",\s*"([^"]+)"/\2\t\3/'
}
section() {
local title="$1"
shift
local rows
rows="$(for file in "$@"; do collect "$file"; done | sort -u -t$'\t' -k1,1)"
[[ -n $rows ]] || return 0
echo
echo "## $title"
echo
echo "| Keys | Action |"
echo "| --- | --- |"
printf '%s\n' "$rows" | while IFS=$'\t' read -r keys action; do
printf '| `%s` | %s |\n' "$keys" "$action"
done
}
{
echo "# Keybindings"
echo
echo "Generated by \`blob-docs-keybinds\` from the \`o.bind\` calls in the Hyprland"
echo "Lua files. Do not edit by hand."
echo
echo "Personal overrides in \`hypr/bindings.lua\` win over the defaults, and"
echo "\`hl.unbind\` in that file removes a default outright."
section "Personal" "$repo_dir/hypr/bindings.lua"
section "Applications" "$repo_dir/default/hypr/bindings/applications.lua"
section "Tiling" "$repo_dir/default/hypr/bindings/tiling.lua"
section "Media" "$repo_dir/default/hypr/bindings/media.lua"
section "Clipboard" "$repo_dir/default/hypr/bindings/clipboard.lua"
section "Utilities" "$repo_dir/default/hypr/bindings/utilities.lua"
echo
echo "## Unbound defaults"
echo
grep -ohE 'hl\.unbind\("[^"]+"\)' "$repo_dir/hypr/bindings.lua" 2>/dev/null |
sed -E 's/hl\.unbind\("([^"]+)"\)/- `\1`/' || echo "None."
} > "$output"
echo "Wrote $output"
+61
View File
@@ -0,0 +1,61 @@
#!/bin/bash
# blob:summary=Monitor sleep preparation and lock before suspend
# blob:group=system
# blob:hidden=true
consume_sleep_events() {
local line sleep_lock
sleep_lock="$BLOB_PATH/bin/blob-system-sleep"
while IFS= read -r line; do
if [[ $line == *"boolean true"* ]]; then
"$sleep_lock"
return 0
fi
done
}
monitor_sleep_events() {
local monitor_fd monitor_pid status
coproc SLEEP_EVENTS {
exec dbus-monitor --system \
"type='signal',sender='org.freedesktop.login1',interface='org.freedesktop.login1.Manager',member='PrepareForSleep'"
}
monitor_fd=${SLEEP_EVENTS[0]}
monitor_pid=$SLEEP_EVENTS_PID
cleanup_monitor() {
kill "$monitor_pid" 2>/dev/null || true
wait "$monitor_pid" 2>/dev/null || true
}
trap cleanup_monitor EXIT
consume_sleep_events <&"$monitor_fd"
status=$?
cleanup_monitor
trap - EXIT
return "$status"
}
case ${1:-} in
--consume)
consume_sleep_events
exit 0
;;
--inhibited)
monitor_sleep_events
exit 0
;;
esac
sleep_monitor="$BLOB_PATH/bin/blob-system-sleep-monitor"
exec systemd-inhibit \
--what=sleep \
--mode=delay \
--who=Blob \
--why="Lock screen before suspend" \
"$sleep_monitor" --inhibited