Metadata-Version: 2.4
Name: 3dprintmon
Version: 0.2.0
Summary: A tray icon that watches your Klipper 3D printers and tells you when a print finishes, fails or needs you.
Author: Christopher Eslick
License-Expression: MIT
Project-URL: Homepage, https://github.com/drak42/3dprintmon
Project-URL: Repository, https://github.com/drak42/3dprintmon
Project-URL: Issues, https://github.com/drak42/3dprintmon/issues
Project-URL: Changelog, https://github.com/drak42/3dprintmon/blob/main/CHANGELOG.md
Project-URL: Funding, https://buymeacoffee.com/drak42
Keywords: 3d-printing,klipper,moonraker,tray,notifications,monitor,creality,k2
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: X11 Applications :: Qt
Classifier: Environment :: MacOS X
Classifier: Environment :: Win32 (MS Windows)
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Manufacturing
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Printing
Classifier: Topic :: System :: Monitoring
Classifier: Typing :: Typed
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PySide6>=6.6
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: ruff==0.17.6; extra == "dev"
Requires-Dist: mypy==2.4.1; extra == "dev"
Provides-Extra: demo
Requires-Dist: pillow>=10; extra == "demo"
Provides-Extra: bundle
Requires-Dist: pyinstaller>=6.10; extra == "bundle"
Requires-Dist: pillow>=10; extra == "bundle"
Dynamic: license-file

# 3dprintmon

![3dprintmon: the tray icon with a progress ring, and the status window showing a K2 Plus printing a bracket at 62 %](https://raw.githubusercontent.com/drak42/3dprintmon/main/docs/images/banner.png)

[![PyPI](https://img.shields.io/pypi/v/3dprintmon)](https://pypi.org/project/3dprintmon/)
[![Python](https://img.shields.io/pypi/pyversions/3dprintmon)](https://pypi.org/project/3dprintmon/)
[![PyPI Downloads](https://static.pepy.tech/personalized-badge/3dprintmon?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/3dprintmon)
[![CI](https://github.com/drak42/3dprintmon/actions/workflows/ci.yml/badge.svg)](https://github.com/drak42/3dprintmon/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/drak42/3dprintmon/blob/main/LICENSE)
[![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-support-FFDD00?logo=buymeacoffee&logoColor=black)](https://buymeacoffee.com/drak42)

A small tray icon that watches your 3D printers' current jobs and tells you
when a print **finishes**, **fails**, is **cancelled** or **paused**, when its
**first layer is done**, when it's **almost finished**, or when a printer stops
answering. For Klipper printers with Moonraker (such as the Creality K2 Plus,
Voron or any Mainsail/Fluidd printer), on Linux, macOS and Windows.

![A print on a K2 Plus counting down to finished: the tray icon's ring fills, the tooltip and window update, and a 'print finished' notification appears](https://raw.githubusercontent.com/drak42/3dprintmon/main/docs/images/demo.gif)

*The notification is drawn as an example; your desktop shows it in its own style.*

## Quick start

```bash
pipx install 3dprintmon                       # from PyPI
3dprintmon add "K2 Plus" 192.168.1.20         # your printer's address (Moonraker, port 7125)
3dprintmon autostart on                       # start with the computer (optional)
3dprintmon                                    # the icon appears in the tray
```

Or download a ready-to-run app (no Python needed) from the
[latest release](https://github.com/drak42/3dprintmon/releases/latest):

| System | Download | First start |
|---|---|---|
| Windows | `3dprintmon-X.Y.Z-windows.zip` | Unzip, run `3dprintmon.exe`. Windows may warn about an unknown publisher: **More info → Run anyway** |
| macOS (Apple silicon) | `3dprintmon-X.Y.Z-macos.zip` | Unzip, move `3dprintmon.app` to Applications, then **right-click → Open** the first time (the app isn't signed by Apple) |
| Linux | `3dprintmon-X.Y.Z-linux.tar.gz` | Extract, run `3dprintmon/3dprintmon` |

Add printers from **Settings…** in the tray menu.

## Features

- **Several printers at once.** The icon shows the most urgent one, with a
  progress ring while printing; the tooltip, menu and window list them all.
- **Live:** follows each printer over Moonraker's websocket, so the icon and
  notifications change within a second, with a regular check as a safety net.
- **Notifications** for finished, failed, cancelled and paused prints, printer
  errors, a printer that stops answering mid-print, the **first layer done**
  (time to check it stuck) and **almost done** (10 minutes before the end, or
  your choice). Each can be turned off.
- **Failures are hard to miss:** they stay in an alert window until you dismiss
  them, with a short chime.
- **Quiet hours and snooze:** hold back the routine notifications at night or
  for a while; failures still show, silently.
- **Status window** with each job's **thumbnail**, progress, time printing and
  left, temperatures, the printer's message, and a **camera picture** while
  printing (from Moonraker's webcam or a snapshot address you set).
- **Settings window** for printers and every option; no file editing needed.
- **Starts with the computer** if you want it to.
- **Reads, never writes:** it never sends a command to a printer.

| Status window | Tray menu |
|---|---|
| ![The status window: a K2 Plus printing at 62 % with its thumbnail, and an Ender-3 V3 SE finished](https://raw.githubusercontent.com/drak42/3dprintmon/main/docs/images/status-window.png) | ![The tray menu: each printer's status, Show status window, Check now, web pages, Snooze, Settings, Start when I log in, Quit](https://raw.githubusercontent.com/drak42/3dprintmon/main/docs/images/tray-menu.png) |

The icon at a glance:

![Tray icons for printing, paused, finished, problem, idle and offline](https://raw.githubusercontent.com/drak42/3dprintmon/main/docs/images/tray-icons.png)

## Use

Click the icon to show or hide the status window; right-click (or click, on
macOS) for the menu: each printer's status, **Check now**, each printer's web
page, **Snooze notifications**, **Settings…**, **Start when I log in** and
**Quit**. Closing the window leaves the icon running.

### Settings window

![The settings window: printers with their addresses, notification choices, almost-done notice, quiet hours, sound and start at login](https://raw.githubusercontent.com/drak42/3dprintmon/main/docs/images/settings-window.png)

Add a printer with its name and **Moonraker address** (such as
`http://192.168.1.20:7125`; port 7125 is assumed). **Test** checks it answers.
Optionally give its **web page** (Fluidd, Mainsail or the printer's own; the
address without the port is used otherwise), a **camera snapshot** address
(a URL that returns one JPEG or PNG picture; Moonraker's webcam is used if
it has one) and an **API key** if Moonraker asks for one.

### When something fails

A failed print, a printer error or a printer that stops answering mid-print
shows a notification, plays a chime and opens a small window that stays until
you dismiss it, even during quiet hours (silently then):

![The alert window: K2 Plus print failed at 03:12, filament runout detected, with a Dismiss button](https://raw.githubusercontent.com/drak42/3dprintmon/main/docs/images/alert-window.png)

### Commands

The same program works in a terminal:

![3dprintmon add, list and status in a terminal](https://raw.githubusercontent.com/drak42/3dprintmon/main/docs/images/terminal.png)

| Command | What it does |
|---|---|
| `3dprintmon` | Start the tray |
| `3dprintmon status` | Check every printer once and print a line each (exit status 1 if one is offline) |
| `3dprintmon add NAME URL` | Add a printer (`--web-url`, `--api-key` optional), or change one with that name |
| `3dprintmon remove NAME` / `list` | Stop watching a printer / list them |
| `3dprintmon autostart on`, `off`, `status` | Start with the computer, or not |
| `3dprintmon --printer URL` | Watch that printer only, without changing the settings (repeat for several) |
| `3dprintmon config-path` | Print where the settings file is |
| `3dprintmon --debug` | Log every check to the terminal |

## Settings file

The settings window and `3dprintmon add` write it; you can also edit it (then
restart 3dprintmon). It is at `~/.config/3dprintmon/config.toml` on Linux,
`~/Library/Application Support/3dprintmon/config.toml` on macOS and
`%APPDATA%\3dprintmon\config.toml` on Windows (`3dprintmon config-path`).

```toml
poll_seconds = 5            # how often to check without live updates (60 s while live)
notify = ["finished", "failed", "cancelled", "paused", "printer_error", "offline",
          "first_layer", "almost_done"]
almost_done_minutes = 10    # 0 turns the almost-done notice off
quiet_hours = "22:00-07:00" # "" for none
sound = "problems"          # "problems", "all" or "off"
alert_problems = true       # keep failures on screen until dismissed
live_updates = true         # follow printers over Moonraker's websocket
camera = true               # camera picture in the window while printing

[[printers]]
name = "K2 Plus"
url = "http://192.168.1.20:7125"

[[printers]]
name = "Voron"
url = "http://voron.local:7125"
web_url = "http://voron.local"
camera_url = "http://voron.local/webcam/?action=snapshot"
api_key = "only if Moonraker asks for one"
```

## How it knows

- **Job state, progress, times, temperatures** come from Klipper through
  Moonraker (`print_stats`, `display_status`, `virtual_sdcard`, `webhooks`,
  `gcode_move`, the heaters).
- **Time left** uses the slicer's estimate for the file, else progress so far.
- **Thumbnail, layer count and estimate** come from Moonraker's file metadata,
  or, when Moonraker hasn't indexed them (the Creality K2), from the first and
  last few kilobytes of the G-code file itself.
- **First layer done** uses the printer's layer counter when it reports one,
  otherwise the nozzle staying above the first layer's height for 20 seconds
  (so a quick Z-hop doesn't count).
- A job already under way when 3dprintmon starts isn't announced again.

## Platform notes

- **Linux:** needs a desktop with a system tray. On GNOME, install the
  *AppIndicator and KStatusNotifierItem Support* extension; KDE, Cinnamon, XFCE
  and others have one built in. Without a tray, the status window opens
  instead. Notifications use the desktop's notification service; starting at
  login adds `~/.config/autostart/3dprintmon.desktop`.
- **macOS:** the icon sits in the menu bar. The first notification may ask for
  permission (System Settings → Notifications). Starting at login adds a
  LaunchAgent in `~/Library/LaunchAgents`.
- **Windows:** the icon sits in the notification area (it may be under the ^
  arrow at first; drag it out to keep it visible). Starting at login adds a
  value under the current user's `Run` key.

## Troubleshooting

| Problem | What to do |
|---|---|
| "offline (Cannot reach …)" | Check the printer is on and the address and port are right: `3dprintmon status`. Moonraker's port is usually 7125 |
| "Moonraker answered 401" | Moonraker wants an API key: add it in Settings or with `--api-key` |
| No icon on Linux | Install a tray extension (see Platform notes); the window opens meanwhile |
| No notifications | Check the system's notification settings allow them; on Linux a notification service must be running |
| No thumbnail | The file has none (some slicers or settings leave them out) |
| No camera picture | Moonraker lists no webcam: set the printer's **camera snapshot** address to a URL that returns a single picture |
| Updates only every minute | The live connection isn't working (a proxy in the way?); 3dprintmon falls back to checking. Turn off live updates to check every `poll_seconds` instead |
| Time left looks wrong | It uses the slicer's estimate when the file has one, otherwise progress so far |

## Development

See [CONTRIBUTING.md](https://github.com/drak42/3dprintmon/blob/main/CONTRIBUTING.md),
the [CHANGELOG](https://github.com/drak42/3dprintmon/blob/main/CHANGELOG.md) and
the [Roadmap](https://github.com/drak42/3dprintmon/blob/main/docs/Roadmap.md).

## Support

3dprintmon is free and open source. If it saves you a trip to the printer, you
can [buy me a coffee](https://buymeacoffee.com/drak42) ☕. Bug reports, ideas
and pull requests are just as welcome: see
[CONTRIBUTING.md](https://github.com/drak42/3dprintmon/blob/main/CONTRIBUTING.md).
