From c81e4b2d82834122ee4030fe4b53ea65fa47a4e2 Mon Sep 17 00:00:00 2001 From: Claudio Date: Fri, 28 Aug 2026 09:17:47 +0200 Subject: [PATCH] feat: refresh button in the popup header The plasmoid does not fetch: state.json has a single writer and the token a single refresher, and a second one inside plasmashell would race the daemon over both. So the button only knocks. `dipstick refresh` sends SIGUSR1 to the pid the daemon records in $XDG_RUNTIME_DIR, verified against /proc//comm because a pidfile left by an unclean exit points at whatever process later took that pid. The signal cuts the daemon's wait short and clears the backoff with it: the user is asking for now, so the wait that backoff produced no longer holds. The loading state is tied to state.json changing, not to the lifetime of the command. `dipstick refresh` returns in milliseconds while the round it asks for takes ~13 seconds, most of it the transcript scan, so a spinner bound to the process was invisible. A 700ms floor keeps it from flickering and a 60s cap keeps a dead daemon from spinning it forever. The Refresher lives on the root item and not in the popup, which Plasma destroys on every collapse: a thirteen-second round started just before closing would have died with it. --- CLAUDE.md | 5 + README.md | 1 + cmd/dipstick/main.go | 40 +++++++- internal/daemon/daemon.go | 16 ++- internal/daemon/pidfile.go | 105 +++++++++++++++++++ internal/daemon/pidfile_test.go | 97 ++++++++++++++++++ plasmoid/contents/ui/FullRepresentation.qml | 38 +++++++ plasmoid/contents/ui/Refresher.qml | 106 ++++++++++++++++++++ plasmoid/contents/ui/StateSource.qml | 30 +++++- plasmoid/contents/ui/main.qml | 13 ++- translations/dipstick.pot | 66 +++++++----- translations/it.po | 66 +++++++----- 12 files changed, 524 insertions(+), 59 deletions(-) create mode 100644 internal/daemon/pidfile.go create mode 100644 internal/daemon/pidfile_test.go create mode 100644 plasmoid/contents/ui/Refresher.qml diff --git a/CLAUDE.md b/CLAUDE.md index e3601b3..24a0626 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -85,5 +85,10 @@ journal, not to the terminal. the letter after them is a unit of measure. With those flags `msgfmt` rejects a translation that changes the letter (`%1d` becoming `%1g` for "days"). `translations/extract.sh` strips them. +- **A refresh round takes ~13 seconds, not milliseconds.** `dipstick refresh` + only sends `SIGUSR1` and returns at once; the wait the user actually feels is + the daemon's round, and most of it is the transcript scan. Any "loading" + state in the plasmoid must therefore be tied to `state.json` changing, never + to the lifetime of the command that was launched. - **`state.json` carries no interface strings.** Localisation belongs to the plasmoid; the daemon runs with no locale context. diff --git a/README.md b/README.md index 133013c..3e8f840 100644 --- a/README.md +++ b/README.md @@ -283,6 +283,7 @@ Useful for diagnosis: ``` dipstick usage # the endpoint's raw JSON, uninterpreted dipstick state # the state the plasmoid would read, without writing it +dipstick refresh # what the popup's refresh button does: one round, now journalctl --user -u dipstick -f ``` diff --git a/cmd/dipstick/main.go b/cmd/dipstick/main.go index a7aaac1..ccfa58f 100644 --- a/cmd/dipstick/main.go +++ b/cmd/dipstick/main.go @@ -50,6 +50,8 @@ func run(args []string) error { return cmdState(args[1:]) case "run": return cmdRun() + case "refresh": + return cmdRefresh() case "logout": if err := anthropic.Logout(); err != nil { return err @@ -75,6 +77,7 @@ func usage() { dipstick profile print the raw profile JSON dipstick state [--write] produce the state the plasmoid will read dipstick run the daemon: keeps the state up to date + dipstick refresh ask the running daemon for a round now dipstick logout remove the local token The token lives in %s (0600). @@ -218,13 +221,48 @@ func cmdRun() error { ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGTERM, syscall.SIGINT) defer stop() + // SIGUSR1 is `dipstick refresh`, which is the plasmoid's refresh button. + // The channel is buffered and the send is dropped when it is full: several + // clicks in a row are one round, not a queue of them. + wake := make(chan struct{}, 1) + usr1 := make(chan os.Signal, 1) + signal.Notify(usr1, syscall.SIGUSR1) + defer signal.Stop(usr1) + go func() { + for range usr1 { + select { + case wake <- struct{}{}: + default: + } + } + }() + + // Without the pidfile the daemon still works: only the refresh button + // stops finding it, and it says so rather than failing silently. + removePID, err := daemon.WritePID() + if err != nil { + log.Warn("could not record the pid: refresh unavailable", "err", err) + } + defer removePID() + path, _ := state.Path() log.Info("starting", "state", path, "transcripts", root) - err = daemon.New(daemon.DefaultConfig(), root, log).Run(ctx) + err = daemon.New(daemon.DefaultConfig(), root, log).Run(ctx, wake) if errors.Is(err, context.Canceled) { log.Info("stopping") return nil } return err } + +// cmdRefresh asks the daemon for an immediate round. It does not fetch +// anything itself: the daemon owns state.json, and a second writer would race +// with it over the same file and the same refresh token. +func cmdRefresh() error { + if err := daemon.Refresh(); err != nil { + return err + } + fmt.Println("refresh requested.") + return nil +} diff --git a/internal/daemon/daemon.go b/internal/daemon/daemon.go index 4562b6a..7b193c2 100644 --- a/internal/daemon/daemon.go +++ b/internal/daemon/daemon.go @@ -79,15 +79,27 @@ func New(cfg Config, root string, log *slog.Logger) *Daemon { } // Run loops until the context is cancelled. -func (d *Daemon) Run(ctx context.Context) error { +// +// A send on wake cuts the wait short and starts a round immediately: it is how +// the plasmoid's refresh button reaches a daemon that may be half an hour into +// an idle sleep. A nil channel simply never fires. +func (d *Daemon) Run(ctx context.Context, wake <-chan struct{}) error { for { wait := d.tick(time.Now()) d.log.Debug("next round", "in", wait) + timer := time.NewTimer(wait) select { case <-ctx.Done(): + timer.Stop() return ctx.Err() - case <-time.After(wait): + case <-wake: + // The wait was cut short on request, so the backoff that produced + // it is forgotten too: the user is telling us to try again now. + timer.Stop() + d.log.Info("refresh requested") + d.failures = 0 + case <-timer.C: } } } diff --git a/internal/daemon/pidfile.go b/internal/daemon/pidfile.go new file mode 100644 index 0000000..3b3beb9 --- /dev/null +++ b/internal/daemon/pidfile.go @@ -0,0 +1,105 @@ +// Daemon discovery, so that `dipstick refresh` can reach the running daemon. +// +// A pidfile rather than a systemd unit name: the daemon must also be +// reachable when it was started by hand, and asking systemd would tie a +// developer's session to the packaged unit. It is verified against +// /proc before signalling, because a pidfile left behind by an unclean +// exit points at whatever process later took that pid. +package daemon + +import ( + "errors" + "fmt" + "os" + "path/filepath" + "strconv" + "strings" + "syscall" +) + +// ErrNotRunning is returned when no daemon can be found. It is a normal +// outcome, not a failure: the user may simply not have started the service. +var ErrNotRunning = errors.New("the dipstick daemon is not running") + +// PIDPath is where the running daemon records itself. +// +// The runtime directory is the right home for it - the kernel empties it on +// logout, so a pidfile cannot survive the session that produced it - but it +// is not guaranteed to exist, so the configuration directory is the fallback. +func PIDPath() (string, error) { + if dir := os.Getenv("XDG_RUNTIME_DIR"); dir != "" { + return filepath.Join(dir, "dipstick", "daemon.pid"), nil + } + dir, err := os.UserConfigDir() + if err != nil { + return "", err + } + return filepath.Join(dir, "dipstick", "daemon.pid"), nil +} + +// WritePID records this process as the daemon and returns the function that +// removes the record again. +// +// A failure here is not fatal: it costs the refresh button, not the service. +func WritePID() (remove func(), err error) { + path, err := PIDPath() + if err != nil { + return func() {}, err + } + if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil { + return func() {}, err + } + if err := os.WriteFile(path, []byte(strconv.Itoa(os.Getpid())+"\n"), 0o644); err != nil { + return func() {}, err + } + return func() { os.Remove(path) }, nil +} + +// Refresh asks the running daemon for an immediate round. +func Refresh() error { + pid, err := readPID() + if err != nil { + return err + } + if err := syscall.Kill(pid, syscall.SIGUSR1); err != nil { + if errors.Is(err, syscall.ESRCH) { + return ErrNotRunning + } + return fmt.Errorf("signalling the daemon (pid %d): %w", pid, err) + } + return nil +} + +func readPID() (int, error) { + path, err := PIDPath() + if err != nil { + return 0, err + } + raw, err := os.ReadFile(path) + if err != nil { + return 0, ErrNotRunning + } + pid, err := strconv.Atoi(strings.TrimSpace(string(raw))) + if err != nil || pid <= 0 { + return 0, ErrNotRunning + } + if !isDipstick(pid) { + return 0, ErrNotRunning + } + return pid, nil +} + +// daemonComm is the process name a recorded pid must have. It is a variable +// only so the tests can point it at the test binary and exercise the real +// check instead of a stub. +var daemonComm = "dipstick" + +// isDipstick guards against pid reuse: without it a stale pidfile turns the +// refresh button into a signal aimed at an unrelated process. +func isDipstick(pid int) bool { + comm, err := os.ReadFile(filepath.Join("/proc", strconv.Itoa(pid), "comm")) + if err != nil { + return false + } + return strings.TrimSpace(string(comm)) == daemonComm +} diff --git a/internal/daemon/pidfile_test.go b/internal/daemon/pidfile_test.go new file mode 100644 index 0000000..b221c16 --- /dev/null +++ b/internal/daemon/pidfile_test.go @@ -0,0 +1,97 @@ +package daemon + +import ( + "errors" + "os" + "os/signal" + "path/filepath" + "strconv" + "strings" + "syscall" + "testing" + "time" +) + +// selfComm points the pid check at the test binary, so the check itself runs +// for real instead of being stubbed out. +func selfComm(t *testing.T) { + t.Helper() + raw, err := os.ReadFile("/proc/self/comm") + if err != nil { + t.Skip("no /proc: pid verification cannot be exercised here") + } + old := daemonComm + daemonComm = strings.TrimSpace(string(raw)) + t.Cleanup(func() { daemonComm = old }) +} + +func runtimeDir(t *testing.T) string { + t.Helper() + dir := t.TempDir() + t.Setenv("XDG_RUNTIME_DIR", dir) + return dir +} + +func TestRefreshSignalsTheRecordedProcess(t *testing.T) { + runtimeDir(t) + selfComm(t) + + remove, err := WritePID() + if err != nil { + t.Fatalf("WritePID: %v", err) + } + + // The signal has to reach this very process: SIGUSR1 is ignored by + // default in Go, so a test that only checks for no error would pass even + // if the pid were wrong. + got := make(chan os.Signal, 1) + signal.Notify(got, syscall.SIGUSR1) + defer signal.Stop(got) + + if err := Refresh(); err != nil { + t.Fatalf("Refresh: %v", err) + } + select { + case <-got: + case <-time.After(2 * time.Second): + t.Fatal("SIGUSR1 never arrived") + } + + remove() + if err := Refresh(); !errors.Is(err, ErrNotRunning) { + t.Fatalf("after the pidfile is gone: got %v, want ErrNotRunning", err) + } +} + +func TestRefreshRefusesAStalePID(t *testing.T) { + dir := runtimeDir(t) + selfComm(t) + + // A pid that is either free or belongs to something that is not dipstick: + // either way the refresh must not signal it. + path := filepath.Join(dir, "dipstick", "daemon.pid") + if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(path, []byte(strconv.Itoa(1)+"\n"), 0o644); err != nil { + t.Fatal(err) + } + + if err := Refresh(); !errors.Is(err, ErrNotRunning) { + t.Fatalf("stale pid: got %v, want ErrNotRunning", err) + } +} + +func TestRefreshRejectsGarbage(t *testing.T) { + dir := runtimeDir(t) + path := filepath.Join(dir, "dipstick", "daemon.pid") + if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(path, []byte("not a pid\n"), 0o644); err != nil { + t.Fatal(err) + } + if err := Refresh(); !errors.Is(err, ErrNotRunning) { + t.Fatalf("garbage pidfile: got %v, want ErrNotRunning", err) + } +} diff --git a/plasmoid/contents/ui/FullRepresentation.qml b/plasmoid/contents/ui/FullRepresentation.qml index 02ef64c..29aeb36 100644 --- a/plasmoid/contents/ui/FullRepresentation.qml +++ b/plasmoid/contents/ui/FullRepresentation.qml @@ -82,6 +82,44 @@ PlasmaExtras.Representation { elide: Text.ElideRight text: "dipstick" } + + // Opposite the identity, where a header's actions belong. It asks + // the daemon for a round; the numbers still arrive the usual way, + // by re-reading the state file. + // + // Button and indicator live in a fixed-size slot rather than + // taking turns in the row: swapping two items of different widths + // would make the heading twitch on every click. + Item { + Layout.alignment: Qt.AlignVCenter + implicitWidth: refreshButton.implicitWidth + implicitHeight: refreshButton.implicitHeight + + PlasmaComponents.ToolButton { + id: refreshButton + anchors.fill: parent + icon.name: root.refresher.error !== "" ? "dialog-warning" : "view-refresh" + // Hidden rather than removed while the click is in flight, + // so the indicator over it is the only thing moving. + opacity: root.refresher.busy ? 0 : 1 + enabled: !root.refresher.busy + onClicked: root.refresher.trigger() + + PlasmaComponents.ToolTip.visible: hovered + PlasmaComponents.ToolTip.delay: Kirigami.Units.toolTipDelay + PlasmaComponents.ToolTip.text: root.refresher.error !== "" + ? root.refresher.error + : i18n("Refresh now") + } + + PlasmaComponents.BusyIndicator { + anchors.centerIn: parent + implicitWidth: Kirigami.Units.iconSizes.small + implicitHeight: Kirigami.Units.iconSizes.small + visible: root.refresher.busy + running: visible + } + } } } diff --git a/plasmoid/contents/ui/Refresher.qml b/plasmoid/contents/ui/Refresher.qml new file mode 100644 index 0000000..ff91692 --- /dev/null +++ b/plasmoid/contents/ui/Refresher.qml @@ -0,0 +1,106 @@ +/* + * The refresh button's other half: asks the daemon for an immediate round. + * + * It does not fetch anything itself. state.json has exactly one writer, and + * the token has exactly one refresher; a second one started from inside + * plasmashell would race with the daemon over both. So the plasmoid only + * knocks - `dipstick refresh` signals the running daemon - and goes back to + * reading the file as it always does. + */ +import QtQml +import org.kde.plasma.plasma5support as P5Support + +QtObject { + id: refresher + + // Busy for as long as the user is actually waiting, which is NOT the + // length of the `dipstick refresh` process: that only signals the daemon + // and returns in milliseconds. What is being waited for is the daemon's + // round and the state file changing underneath it, so the wait ends when + // fresh state arrives - settle() - and not when the command exits. + // The floor is part of it: the round often lands in well under a second, + // and an indicator that appears and vanishes inside one frame reads as + // nothing having happened at all. + readonly property bool busy: _running || _settling.running || _floor.running + + // Why the last attempt failed, empty when all is well. Shown on the + // button rather than logged: a button that does nothing and says nothing + // is indistinguishable from a broken one. + property string error: "" + + signal requested() + + property bool _running: false + + readonly property string command: "dipstick refresh" + + function trigger() { + if (busy) { + return + } + error = "" + _running = true + _floor.restart() + _engine.connectSource(command) + } + + property var _engine: P5Support.DataSource { + engine: "executable" + // One-shot: the source is connected by trigger() and dropped as soon + // as it has answered. An interval here would turn the button into a + // timer. + interval: 0 + + onNewData: (sourceName, data) => { + disconnectSource(sourceName) + refresher._running = false + + if (data["exit code"] === 0) { + refresher.requested() + refresher._settling.restart() + return + } + // 127 is the shell's "command not found": worth telling apart, + // because the fix is an installation one and not a daemon one. + if (data["exit code"] === 127) { + refresher.error = i18n("dipstick was not found: is it installed?") + return + } + var stderr = (data.stderr || "").trim() + // The CLI prefixes its own errors; the button has no room for a + // name it already knows. + if (stderr.indexOf("dipstick: ") === 0) { + stderr = stderr.substring("dipstick: ".length) + } + refresher.error = stderr !== "" ? stderr : i18n("Refresh failed") + } + } + + property var _floor: Timer { + interval: 700 + } + + // Fresh state has arrived: the round the click asked for is over. + function settle() { + _settling.stop() + } + + // The cap on the wait, and it has to be generous: a round is not just the + // HTTP call, it is the transcript scan too, and that was measured at ~13s + // on a real tree. The daemon rewrites the state on every round even when + // the fetch failed, so settle() normally comes first; this is only here so + // that a daemon which died between the signal and the round cannot leave + // the button spinning forever. + property var _settling: Timer { + interval: 60000 + onTriggered: refresher.error = i18n("The daemon did not answer") + } + + // The warning does not stay: it belongs to one click, and a button stuck + // showing an old failure misreports the current state. + property var _clearError: Timer { + interval: 10000 + running: refresher.error !== "" + onTriggered: refresher.error = "" + } +} diff --git a/plasmoid/contents/ui/StateSource.qml b/plasmoid/contents/ui/StateSource.qml index 7292e52..0f14bde 100644 --- a/plasmoid/contents/ui/StateSource.qml +++ b/plasmoid/contents/ui/StateSource.qml @@ -22,7 +22,25 @@ QtObject { // daemon queries the network - so re-reading it more often is just one // more fork inside plasmashell. Fifteen seconds keeps the widget // responsive right after a `dipstick auth` without weighing anything down. - property int interval: 15000 + property int idleInterval: 15000 + + // After a refresh has been asked for, the file is about to change: for a + // short while it is worth looking more often, or the button appears not to + // have worked for up to fifteen seconds. + property int eagerInterval: 1000 + + property int interval: _eager.running ? eagerInterval : idleInterval + + // Look eagerly for a bit. Bounded on purpose: the daemon may be unable to + // fetch anything, and in that case there is nothing to wait for. + function poke() { + _eager.restart() + } + + property var _eager: Timer { + interval: 15000 + repeat: false + } readonly property string filePath: { var dir = StandardPaths.writableLocation(StandardPaths.GenericConfigLocation).toString() @@ -32,6 +50,11 @@ QtObject { // The deserialised state, or null if there is nothing usable. property var state: null + // The file has changed, for better or worse. It is what tells the refresh + // button that the round it asked for has landed, so it is emitted on a + // failure too: a refresh that ends in "no data" has still ended. + signal updated() + // Why there is nothing. Distinct from `state === null` because the popup // has to tell the user what to do, and the answers differ. // "": all good @@ -82,10 +105,12 @@ QtObject { source._lastRaw = data.stdout source.state = parsed source.problem = "" + source.updated() } } function _fail(reason) { + var changed = problem !== reason || state !== null if (problem !== reason) { console.warn("dipstick: unreadable state (" + reason + "): " + filePath) } @@ -94,6 +119,9 @@ QtObject { // were current is worse than showing none. state = null problem = reason + if (changed) { + updated() + } } function stripScheme(url) { diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml index 7e5fb43..6a991b7 100644 --- a/plasmoid/contents/ui/main.qml +++ b/plasmoid/contents/ui/main.qml @@ -19,7 +19,18 @@ PlasmoidItem { readonly property var primary: quotaState && quotaState.compact ? quotaState.compact.primary : null - StateSource { id: stateSource } + StateSource { + id: stateSource + // The click is done waiting when the numbers have actually changed. + onUpdated: refresher.settle() + } + + // Owned by the root and not by the popup, which Plasma destroys and + // rebuilds every time it is collapsed: a refresh started just before + // closing must still be in flight when the popup comes back. + readonly property Refresher refresher: Refresher { + onRequested: stateSource.poke() + } Plasmoid.status: primary && Format.severityRank(primary.severity) > 0 ? PlasmaCore.Types.ActiveStatus diff --git a/translations/dipstick.pot b/translations/dipstick.pot index c10a575..10690c2 100644 --- a/translations/dipstick.pot +++ b/translations/dipstick.pot @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: dipstick\n" -"Report-Msgid-Bugs-To: https://github.com/claudioquaglia/dipstick/issues\n" -"POT-Creation-Date: 2026-08-27 15:36+0200\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-08-28 08:40+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -22,100 +22,112 @@ msgctxt "percentage of quota used" msgid "%1%" msgstr "" -#: plasmoid/contents/ui/DailyChart.qml:122 -#: plasmoid/contents/ui/FullRepresentation.qml:265 +#: plasmoid/contents/ui/DailyChart.qml:123 +#: plasmoid/contents/ui/FullRepresentation.qml:316 msgid "today" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:99 +#: plasmoid/contents/ui/FullRepresentation.qml:119 +msgid "Refresh now" +msgstr "" + +#: plasmoid/contents/ui/FullRepresentation.qml:147 msgid "No data from the dipstick daemon" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:102 +#: plasmoid/contents/ui/FullRepresentation.qml:150 msgid "Daemon and widget versions do not match" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:105 +#: plasmoid/contents/ui/FullRepresentation.qml:153 msgid "The state file is unreadable" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:108 +#: plasmoid/contents/ui/FullRepresentation.qml:156 msgid "Not signed in" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:110 +#: plasmoid/contents/ui/FullRepresentation.qml:158 msgid "Quota unavailable" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:114 +#: plasmoid/contents/ui/FullRepresentation.qml:162 msgid "Start it with: systemctl --user start dipstick" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:117 +#: plasmoid/contents/ui/FullRepresentation.qml:165 msgid "Reinstall dipstick so both halves are on the same version." msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:120 -#: plasmoid/contents/ui/main.qml:62 +#: plasmoid/contents/ui/FullRepresentation.qml:168 +#: plasmoid/contents/ui/main.qml:69 msgid "Sign in with: dipstick auth" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:140 +#: plasmoid/contents/ui/FullRepresentation.qml:189 msgid "From local transcripts (tokens, not quota):" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:146 +#: plasmoid/contents/ui/FullRepresentation.qml:195 msgid "%1 in the last 5h · %2 this week" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:180 -#: plasmoid/contents/ui/main.qml:53 +#: plasmoid/contents/ui/FullRepresentation.qml:230 +#: plasmoid/contents/ui/main.qml:60 msgid "Claude usage" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:245 +#: plasmoid/contents/ui/FullRepresentation.qml:296 msgid "Tokens used" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:266 +#: plasmoid/contents/ui/FullRepresentation.qml:317 msgid "this week" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:267 +#: plasmoid/contents/ui/FullRepresentation.qml:318 msgid "this month" msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:317 +#: plasmoid/contents/ui/FullRepresentation.qml:368 msgid "Quota data may be out of date." msgstr "" -#: plasmoid/contents/ui/FullRepresentation.qml:328 +#: plasmoid/contents/ui/FullRepresentation.qml:379 msgid "Extra usage credits are enabled: reaching 100% will not block you." msgstr "" -#: plasmoid/contents/ui/main.qml:41 +#: plasmoid/contents/ui/main.qml:48 msgctxt "quota window and its percentage" msgid "%1: %2%" msgstr "" -#: plasmoid/contents/ui/main.qml:44 +#: plasmoid/contents/ui/main.qml:51 msgctxt "quota window, its percentage and when it resets" msgid "%1: %2% — %3" msgstr "" -#: plasmoid/contents/ui/main.qml:54 +#: plasmoid/contents/ui/main.qml:61 msgid "Claude quota unavailable" msgstr "" -#: plasmoid/contents/ui/main.qml:59 +#: plasmoid/contents/ui/main.qml:66 msgid "The dipstick daemon is not running" msgstr "" -#: plasmoid/contents/ui/QuotaRow.qml:63 +#: plasmoid/contents/ui/QuotaRow.qml:62 msgctxt "how much of a quota window is consumed" msgid "%1% used" msgstr "" +#: plasmoid/contents/ui/Refresher.qml:55 +msgid "dipstick was not found: is it installed?" +msgstr "" + +#: plasmoid/contents/ui/Refresher.qml:64 +msgid "Refresh failed" +msgstr "" + #: plasmoid/contents/ui/format.js:12 msgid "Session (5h)" msgstr "" diff --git a/translations/it.po b/translations/it.po index 6b3dd31..27c4c74 100644 --- a/translations/it.po +++ b/translations/it.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: dipstick 0.1\n" -"Report-Msgid-Bugs-To: https://github.com/claudioquaglia/dipstick/issues\n" -"POT-Creation-Date: 2026-08-27 15:36+0200\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-08-28 08:40+0200\n" "PO-Revision-Date: 2026-08-27 14:00+0200\n" "Last-Translator: Claudio Quaglia\n" "Language-Team: Italiano\n" @@ -22,100 +22,112 @@ msgctxt "percentage of quota used" msgid "%1%" msgstr "%1%" -#: plasmoid/contents/ui/DailyChart.qml:122 -#: plasmoid/contents/ui/FullRepresentation.qml:265 +#: plasmoid/contents/ui/DailyChart.qml:123 +#: plasmoid/contents/ui/FullRepresentation.qml:316 msgid "today" msgstr "oggi" -#: plasmoid/contents/ui/FullRepresentation.qml:99 +#: plasmoid/contents/ui/FullRepresentation.qml:119 +msgid "Refresh now" +msgstr "Aggiorna adesso" + +#: plasmoid/contents/ui/FullRepresentation.qml:147 msgid "No data from the dipstick daemon" msgstr "Nessun dato dal demone dipstick" -#: plasmoid/contents/ui/FullRepresentation.qml:102 +#: plasmoid/contents/ui/FullRepresentation.qml:150 msgid "Daemon and widget versions do not match" msgstr "Le versioni di demone e widget non coincidono" -#: plasmoid/contents/ui/FullRepresentation.qml:105 +#: plasmoid/contents/ui/FullRepresentation.qml:153 msgid "The state file is unreadable" msgstr "Il file di stato non e' leggibile" -#: plasmoid/contents/ui/FullRepresentation.qml:108 +#: plasmoid/contents/ui/FullRepresentation.qml:156 msgid "Not signed in" msgstr "Accesso non effettuato" -#: plasmoid/contents/ui/FullRepresentation.qml:110 +#: plasmoid/contents/ui/FullRepresentation.qml:158 msgid "Quota unavailable" msgstr "Quota non disponibile" -#: plasmoid/contents/ui/FullRepresentation.qml:114 +#: plasmoid/contents/ui/FullRepresentation.qml:162 msgid "Start it with: systemctl --user start dipstick" msgstr "Avvialo con: systemctl --user start dipstick" -#: plasmoid/contents/ui/FullRepresentation.qml:117 +#: plasmoid/contents/ui/FullRepresentation.qml:165 msgid "Reinstall dipstick so both halves are on the same version." msgstr "Reinstalla dipstick per allineare le due meta'." -#: plasmoid/contents/ui/FullRepresentation.qml:120 -#: plasmoid/contents/ui/main.qml:62 +#: plasmoid/contents/ui/FullRepresentation.qml:168 +#: plasmoid/contents/ui/main.qml:69 msgid "Sign in with: dipstick auth" msgstr "Accedi con: dipstick auth" -#: plasmoid/contents/ui/FullRepresentation.qml:140 +#: plasmoid/contents/ui/FullRepresentation.qml:189 msgid "From local transcripts (tokens, not quota):" msgstr "Dai transcript locali (token, non quota):" -#: plasmoid/contents/ui/FullRepresentation.qml:146 +#: plasmoid/contents/ui/FullRepresentation.qml:195 msgid "%1 in the last 5h · %2 this week" msgstr "%1 nelle ultime 5h · %2 questa settimana" -#: plasmoid/contents/ui/FullRepresentation.qml:180 -#: plasmoid/contents/ui/main.qml:53 +#: plasmoid/contents/ui/FullRepresentation.qml:230 +#: plasmoid/contents/ui/main.qml:60 msgid "Claude usage" msgstr "Consumo Claude" -#: plasmoid/contents/ui/FullRepresentation.qml:245 +#: plasmoid/contents/ui/FullRepresentation.qml:296 msgid "Tokens used" msgstr "Token consumati" -#: plasmoid/contents/ui/FullRepresentation.qml:266 +#: plasmoid/contents/ui/FullRepresentation.qml:317 msgid "this week" msgstr "questa settimana" -#: plasmoid/contents/ui/FullRepresentation.qml:267 +#: plasmoid/contents/ui/FullRepresentation.qml:318 msgid "this month" msgstr "questo mese" -#: plasmoid/contents/ui/FullRepresentation.qml:317 +#: plasmoid/contents/ui/FullRepresentation.qml:368 msgid "Quota data may be out of date." msgstr "I dati della quota potrebbero non essere aggiornati." -#: plasmoid/contents/ui/FullRepresentation.qml:328 +#: plasmoid/contents/ui/FullRepresentation.qml:379 msgid "Extra usage credits are enabled: reaching 100% will not block you." msgstr "I crediti aggiuntivi sono attivi: toccare il 100% non ti bloccherà." -#: plasmoid/contents/ui/main.qml:41 +#: plasmoid/contents/ui/main.qml:48 msgctxt "quota window and its percentage" msgid "%1: %2%" msgstr "%1: %2%" -#: plasmoid/contents/ui/main.qml:44 +#: plasmoid/contents/ui/main.qml:51 msgctxt "quota window, its percentage and when it resets" msgid "%1: %2% — %3" msgstr "%1: %2% — %3" -#: plasmoid/contents/ui/main.qml:54 +#: plasmoid/contents/ui/main.qml:61 msgid "Claude quota unavailable" msgstr "Quota Claude non disponibile" -#: plasmoid/contents/ui/main.qml:59 +#: plasmoid/contents/ui/main.qml:66 msgid "The dipstick daemon is not running" msgstr "Il demone dipstick non e' in esecuzione" -#: plasmoid/contents/ui/QuotaRow.qml:63 +#: plasmoid/contents/ui/QuotaRow.qml:62 msgctxt "how much of a quota window is consumed" msgid "%1% used" msgstr "%1% usato" +#: plasmoid/contents/ui/Refresher.qml:55 +msgid "dipstick was not found: is it installed?" +msgstr "dipstick non trovato: è installato?" + +#: plasmoid/contents/ui/Refresher.qml:64 +msgid "Refresh failed" +msgstr "Aggiornamento non riuscito" + #: plasmoid/contents/ui/format.js:12 msgid "Session (5h)" msgstr "Sessione (5h)" -- knotmirror 0.0.1