diff --git a/README.md b/README.md index c6910cb..ae78da7 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,9 @@ scalable outline files may be supplied; their argument order is the glyph fallback order. A collection file uses its first face. If any named file is absent or invalid, the popup disables itself cleanly while input processing continues. `run.sh` and `bench.sh` accept the same font-file arguments. +When `run.sh` is invoked without arguments, it uses the installed DejaVu, +Jigmo, or Noto CJK font files from the standard Arch Linux paths. Explicit +font-file arguments replace these defaults. The IPC socket is placed at `$XDG_RUNTIME_DIR/strans.sock` when `XDG_RUNTIME_DIR` is an absolute path. Otherwise strans uses the per-user diff --git a/run.sh b/run.sh index cb8b60d..2e5bb45 100755 --- a/run.sh +++ b/run.sh @@ -1,6 +1,25 @@ #!/bin/sh cd "$(dirname "$0")" + +if test "$#" -eq 0; then + set -- + for font in \ + /usr/share/fonts/TTF/DejaVuSans.ttf \ + /usr/share/fonts/TTF/Jigmo.ttf \ + /usr/share/fonts/TTF/Jigmo2.ttf \ + /usr/share/fonts/noto/NotoSansCJK-Regular.ttc + do + if test -f "$font"; then + set -- "$@" "$font" + fi + done + if test "$#" -eq 0; then + echo "run.sh: no default font found; pass a font file" >&2 + exit 1 + fi +fi + pkill strans sleep 1 ./strans map "$@" &