Files
menologion/bin/horologion-install
T
funkpower 7beb53fc94 the documented way to use this did not work
`import qs.horologion.modules` was the README's headline instruction and it
fails outright: Quickshell resolves `qs` against the host config root, not
the subtree, so in an empty shell the type is unavailable and in a populated
one the widget would have silently bound to the host's Config and Theme
instead of its own. The imports inside are now relative and each directory
carries a qmldir, so `import "horologion/modules"` works in any host and the
three pieces really are usable on their own.

  - refresh() dropped a request made while a run was in flight, so a
    jurisdiction or date set a moment after startup never took effect until
    midnight. It queues now.
  - The waybar script exited non-zero on its error paths, and waybar hides a
    module whose script does that -- so a missing typikon made the module
    vanish rather than say so, and the .error CSS was dead. An unrecognised
    --format field raised instead of rendering empty, and the tooltip
    interpolated unescaped text into Pango markup, which matters because
    --update-menaion fetches commemorations from a page nobody here controls.
  - The installer aborted the whole run at the point where it printed
    'leaving it alone', and a wholly successful run exited 1 because the last
    statement was a failed [ -d ] test under set -e. --help demanded typikon,
    which is what --help would have told you to install.
  - eww painted every day with the feast colour and printed a dangling
    separator, because it compares against "" and eww renders a JSON null as
    the string "null". The parenthesised ?: form two lines away was already
    right. The week list also repeated today.

pip install typikon installed nothing; there is no such package, and that was
the first line of every install path. Pascha now carries its label instead of
being a bare ISO date in a corner.

tests/smoke.sh covers the scripts, which is where all of this lived and where
nothing was covered. It caught two of these while being written.
2026-09-18 10:29:37 -04:00

113 lines
3.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Link the front ends into place. Nothing is copied, so a `git pull` updates
# what you are running.
set -euo pipefail
src="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
config="${XDG_CONFIG_HOME:-$HOME/.config}"
binhome="${HOME}/.local/bin"
usage() {
cat <<USAGE
horologion-install [quickshell|waybar|eww|bin|all]
quickshell link quickshell/ into a quickshell config as horologion/
waybar link the bar script and print the module to merge
eww link eww/ into your eww config
bin link horologion-waybar into ~/.local/bin
all bin + whichever of the three are already configured
USAGE
}
# Set when something was skipped, so the run can report it in its exit status
# without `set -e` tearing the rest of the install down.
skipped=0
link() {
local from="$1" to="$2"
mkdir -p "$(dirname "$to")"
if [ -e "$to" ] && [ ! -L "$to" ]; then
echo " ! $to exists and is not a link — leaving it alone" >&2
skipped=1
return 0
fi
ln -sfn "$from" "$to"
echo " $to -> $from"
}
do_bin() {
link "$src/bin/horologion-waybar" "$binhome/horologion-waybar"
case ":$PATH:" in
*":$binhome:"*) ;;
*) echo " note: $binhome is not on your PATH" >&2 ;;
esac
}
do_quickshell() {
link "$src/quickshell" "$config/quickshell/horologion"
cat <<'NOTE'
Add to your shell.qml:
import qs.horologion.modules
...
Horologion {}
Or run it on its own:
quickshell -p ~/.config/quickshell/horologion/shell.qml
NOTE
}
do_waybar() {
link "$src/waybar/style.css" "$config/waybar/horologion.css"
cat <<'NOTE'
Add "custom/typikon" to a modules list, merge waybar/config.jsonc into
your config, and @import "horologion.css" from your style.css.
NOTE
}
do_eww() {
link "$src/eww" "$config/eww/horologion"
cat <<'NOTE'
Add to your eww.yuck: (include "horologion/horologion.yuck")
Add to your eww.scss: @import "horologion/horologion.scss";
Then put (horologion) in a window, or (horologion-bar) in a bar.
NOTE
}
require_typikon() {
command -v typikon >/dev/null 2>&1 && return 0
echo "horologion: typikon is not on PATH." >&2
echo " pipx install git+https://git.pumpin.online/funkpower/typikon" >&2
exit 1
}
# --help must not be gated behind the dependency it tells you about.
case "${1:-all}" in
-h|--help|help) usage; exit 0 ;;
esac
require_typikon
case "${1:-all}" in
quickshell) do_bin; do_quickshell ;;
waybar) do_bin; do_waybar ;;
eww) do_bin; do_eww ;;
bin) do_bin ;;
all)
do_bin
# `[ -d x ] && f` as the last statement of the script would make a
# perfectly good run exit 1 under `set -e` whenever the directory is
# absent. Hence the `|| true`, and the explicit exit below.
[ -d "$config/quickshell" ] && do_quickshell || true
[ -d "$config/waybar" ] && do_waybar || true
[ -d "$config/eww" ] && do_eww || true
;;
*) usage; exit 2 ;;
esac
exit "$skipped"