Repository navigation
Replace older copies and retire shadowing desktop entries - #21
Merged
Merged
Conversation
Installing the .deb over a copy set up with install.sh left the old copy in charge: its ~/.config/autostart entry has the same name as the package's /etc/xdg/autostart one, so it shadows it and starts at every login, and it holds the single-instance lock, so the packaged version exits as "already running". Users kept seeing the pre-0.0.2 menu (no cutoffs, Collapse, About) and the unscaled extra usage amount after upgrading. - When the lock is held by a copy running an older version, or one that started before its script was replaced, stop it and take the lock. - The .deb's copy removes per-user autostart/launcher entries that run an older or deleted usage_widget.py, so its own entry applies again. - Extra usage without a cap shows the spend alone, not a 0% bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013mySqGaN3MoXy2yY16ZUG8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds functionality to handle upgrades from manually-installed copies to the packaged (.deb) version of the LLM Usage Widget. When a newer version starts, it now stops older running copies and removes user-level desktop entries that would shadow the system package's autostart entry.
Key Changes
replace_older_copies()to detect and stop older running instances, then acquire the single-instance lockolder_copies()identifies running Python processes executing older versions or stale copies (started before script upgrade)_process_start()reads process start time from/proc/[pid]/stat(Linux)script_version()extracts version from__version__in Python scriptsretire_shadowing_entries()to remove per-user autostart and launcher entries that:/etc/xdg/autostartentry_desktop_exec_script()parses.desktopfiles to extract the script pathmain()to:retire_shadowing_entries()on Linux and warn about removed entriesreplace_older_copies()if single-instance lock acquisition failsNonepercent when there's no spending cap (no bar to fill against)Implementation Details
/proc/[pid]/statand/proc/staton Linux to determine start timesparse_version()Exec=valuesXDG_CONFIG_HOMEandXDG_DATA_HOMEenvironment variables for user directorieshttps://claude.ai/code/session_013mySqGaN3MoXy2yY16ZUG8