mirror of
https://github.com/lwouis/alt-tab-macos.git
synced 2026-05-24 11:20:36 +00:00
9147a4a864
BREAKING CHANGE: announcement: https://github.com/lwouis/alt-tab-macos/discussions/5533 * improved performance, especially switcher responsiveness * reduced battery usage even more * reduced ram usage (closes #5450, closes #5539, closes #5627) * reduced app size even more * polished many aspects of the ui; align more with liquid glass * better handle "ghost" windows (closes #5509) * fix issue with wrong window order (closes #5492) * escape closes the switcher on tahoe (closes #5585) * improve search matches (closes #5488) * localizations trimmed and reviewed entirely (closes #5583) * highlight matching app icons when searching, in addition to text * better settings import/export * reworked "send feedback" experience * reworked exceptions ui (closes #5482) * per-shortcut settings (closes #5313) * rework about window
83 lines
2.5 KiB
Bash
Executable File
83 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -exu
|
|
|
|
github_api_request() {
|
|
local url="$1"
|
|
curl -s \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "Authorization: token $GITHUB_TOKEN" \
|
|
"https://api.github.com/repos/lwouis/alt-tab-macos$url"
|
|
}
|
|
|
|
unicode_sort() {
|
|
python3 -c 'import sys, unicodedata; print("".join(sorted((line for line in sys.stdin if line.strip()), key=lambda s: unicodedata.normalize("NFKD", s.casefold()))), end="")'
|
|
}
|
|
|
|
github_contributors() {
|
|
github_api_request "/contributors" |
|
|
jq -r '.[]|("[" + .login + "](" + .html_url + ")")' |
|
|
sed -e '/semantic-release-bot/d' |
|
|
unicode_sort |
|
|
awk '{printf "%s%s", sep, $0; sep=", "} END{print ""}'
|
|
}
|
|
|
|
# Rewrite only the "Developed the app" section of docs/contributors.md, preserving the
|
|
# frozen "Localized the app" section below it.
|
|
update_developer_contributors() {
|
|
local file="docs/contributors.md"
|
|
{
|
|
echo "## [Developed the app](https://github.com/lwouis/alt-tab-macos/graphs/contributors)"
|
|
echo
|
|
github_contributors
|
|
echo
|
|
sed -n '/## Localized the app/,$p' "$file"
|
|
} > "$file.tmp" && mv "$file.tmp" "$file"
|
|
}
|
|
|
|
get_total_downloads() {
|
|
local downloads=0
|
|
local page=1
|
|
while true; do
|
|
local response
|
|
response=$(github_api_request "/releases?per_page=100&page=$page")
|
|
# Safely sum all download counts, even if assets are empty
|
|
local count
|
|
count=$(echo "$response" | jq '[.[]?.assets[]?.download_count // 0] | add // 0')
|
|
downloads=$((downloads + count))
|
|
# Stop if no more releases
|
|
if [[ $(echo "$response" | jq 'length') -lt 1 ]]; then
|
|
break
|
|
fi
|
|
page=$((page + 1))
|
|
done
|
|
echo "$downloads"
|
|
}
|
|
|
|
get_stars() {
|
|
github_api_request "" | jq '.stargazers_count'
|
|
}
|
|
|
|
format_number() {
|
|
local NUM=$1
|
|
if (( NUM >= 1000000 )); then
|
|
printf "%.1fM" "$(echo "$NUM/1000000" | bc -l)"
|
|
elif (( NUM >= 1000 )); then
|
|
printf "%.0fK" "$(echo "$NUM/1000" | bc -l)"
|
|
else
|
|
printf "%d" "$NUM"
|
|
fi
|
|
}
|
|
|
|
downloads=$(format_number "$(get_total_downloads)")
|
|
stars=$(format_number "$(get_stars)")
|
|
|
|
# Stats are baked into docs/readme/main.svg (one consolidated SVG that holds
|
|
# the hero, stats, CTAs, and screenshot). Each stat text element is preceded by
|
|
# an XML comment marker — anchor sed on the marker and replace whatever value
|
|
# follows up to the next `<` (i.e. the closing `</text>`).
|
|
sed -i "" -E "s|(<!--downloads-->)[^<]*|\1${downloads}|" "docs/readme/main.svg"
|
|
sed -i "" -E "s|(<!--stars-->)[^<]*|\1${stars}|" "docs/readme/main.svg"
|
|
|
|
update_developer_contributors
|