Files
plasma-bitcoin-price/README.md
T

93 lines
2.9 KiB
Markdown

# Bitcoin Price (Plasma 5 widget)
KDE Plasma 5 widget that shows the bitcoin price in EUR, fetched from the
[CoinGecko API](https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=eur).
## Display
| Situation | Display |
|---|---|
| Price up compared to the previous reading | green |
| Price down compared to the previous reading | red |
| Price unchanged (or first reading) | grey |
| API failure (network error, 4xx/5xx, rate limit 429) | `--` |
Format: `68,969 €` (thousands separators follow the system locale, rounded to
whole euros) preceded by the bundled Bitcoin icon in the compact and full
representations.
## Configuration
- **Refresh interval (minutes)** — default 5, minimum **5**, maximum 1440.
The 5-minute floor exists because the CoinGecko API allows one request per
5 minutes. A hint text in the config dialog explains this.
Configurable via right-click on the widget → *Configure Bitcoin Price…**General*.
## Installation
### Graphical
Double-click `bitcoin-price-1.1.0.plasmoid` in Dolphin (Plasma installs it to
`~/.local/share/plasma/plasmoids/` automatically). The latest build is attached
to the [v1.1.0 release](../../releases/tag/v1.1.0).
### Terminal
```bash
kpackagetool5 --type Plasma/Applet --upgrade bitcoin-price-1.1.0.plasmoid
# Then restart the shell if needed:
plasmashell --replace &
```
Upgrading an already-installed widget requires `--upgrade` (`--install` fails
when the plugin id already exists).
Uninstall:
```bash
kpackagetool5 --type Plasma/Applet --remove nl.a14r.bitcoinprice
```
## Notes
- The API URL uses `vs_currencies=eur`. The original request referenced a
`usd` URL, but the requirement was "price versus the euro" with a €-sign;
showing a dollar amount under a € sign would be wrong.
- The trend comparison is made against the last known price. After an API
failure that reference is kept, so the color is correct again as soon as
fresh data arrives.
- Without a CoinGecko API key the API may occasionally return 429; the widget
shows `--` until the next successful poll.
- Tested on Plasma 5.27 / Qt 5.15. Plasma 6 is expected to work but is untested.
## Debugging
The widget logs to the plasmashell journal:
```bash
journalctl --user -u plasma-plasmashell.service | grep bitcoinprice
```
Expected lines: `started, refresh interval: N minutes`, `fetched EUR <price>`,
or `fetch failed, HTTP status: <code>`.
## Repository layout
```
metadata.desktop
contents/
├── config/main.xml # config schema (refreshMinutes, min 5, max 1440)
├── images/bitcoin.svg # bundled Bitcoin icon
└── ui/
├── main.qml # widget + fetch/compare logic
├── config.qml # config dialog (categories)
└── configGeneral.qml # interval setting
```
Repackage yourself:
```bash
zip -r bitcoin-price.plasmoid metadata.desktop contents
```
## License
MIT — see [LICENSE](LICENSE).