From 7dd0d5d27fc177f88c68918618b0830e8bb99142 Mon Sep 17 00:00:00 2001 From: syui Date: Wed, 1 Apr 2026 21:31:45 +0900 Subject: [PATCH] fix tmux pds --- .gitconfig | 1 + .tmux/plugin/ailog.zsh | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitconfig b/.gitconfig index 78ed729..cf1fcc3 100644 --- a/.gitconfig +++ b/.gitconfig @@ -6,6 +6,7 @@ gpgsign = true [core] editor = vim + excludesfile = /Users/syui/.gitignore_global [pull] rebase = false [init] diff --git a/.tmux/plugin/ailog.zsh b/.tmux/plugin/ailog.zsh index 8d9e07d..773f61a 100755 --- a/.tmux/plugin/ailog.zsh +++ b/.tmux/plugin/ailog.zsh @@ -31,6 +31,17 @@ can_run() { command -v ailog &>/dev/null && command -v jq &>/dev/null && [ -f "$cfg" ] && has_aifont } +refresh_token() { + local stamp="/tmp/.ailog_refresh" + local now=$(date +%s) + local last=0 + [ -f "$stamp" ] && last=$(cat "$stamp") + if [ $((now - last)) -gt 1800 ]; then + ailog pds r 2>/dev/null + echo "$now" > "$stamp" + fi +} + get_handle() { ailog pds s 2>/dev/null | jq -r '.handle // empty' 2>/dev/null } @@ -50,6 +61,7 @@ get_latest_post() { status_left() { can_run || return + refresh_token local handle=$(get_handle) local count=$(get_notify_count) local post=$(get_latest_post) @@ -73,7 +85,7 @@ status_left() { } get_pds() { - ailog pds s 2>/dev/null | jq -r '.issuer // empty' 2>/dev/null | sed 's|https://||' + ailog pds s 2>/dev/null | jq -r '.pds // empty' 2>/dev/null | sed 's|https://||' } get_pds_icon() {