Skip to content

Commit d69e4dc

Browse files
committed
Cosmic Containers 0.2.0
COSMIC panel applet for Pop!_OS that manages Docker containers, images, and volumes from the panel badge and a popup. - Panel badge with the running container count and configurable font size - Popup tabs: Containers (grouped by Compose project), Images, Volumes, Settings - Start, stop, restart, and remove per container; Compose actions per group - Published ports and live CPU/RAM usage from `docker stats` - Tab-scoped clean action running `docker container|image|volume prune` - Flatpak packaging for COSMIC Flatpak; host Docker via `flatpak-spawn --host` The previous development history was squashed into this single commit for the public release.
0 parents  commit d69e4dc

56 files changed

Lines changed: 18482 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/CODEOWNERS‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Default owners for all files
2+
* @VaultTec-Dev

‎.github/dependabot.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 5
8+
9+
- package-ecosystem: cargo
10+
directory: /
11+
schedule:
12+
interval: weekly
13+
open-pull-requests-limit: 5

‎.github/workflows/ci.yml‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
rust:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Harden Runner
17+
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
18+
with:
19+
egress-policy: audit
20+
21+
- name: Checkout
22+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
23+
24+
- name: Rust toolchain
25+
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
26+
with:
27+
toolchain: 1.93
28+
components: rustfmt, clippy
29+
30+
- name: Install system dependencies
31+
run: |
32+
sudo apt-get update -qq
33+
sudo apt-get install -y -qq \
34+
build-essential pkg-config \
35+
libxkbcommon-dev libwayland-dev libdbus-1-dev \
36+
libpipewire-0.3-dev libpam0g-dev libssl-dev \
37+
libegl1-mesa-dev libinput-dev libpulse-dev
38+
39+
- name: Format
40+
run: cargo fmt --check
41+
42+
- name: Clippy
43+
run: cargo clippy --all-features -- -D warnings
44+
45+
- name: Test
46+
run: cargo test --lib --no-default-features && cargo test --all-features

‎.gitignore‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Rust / Cargo
2+
/target/
3+
**/*.rs.bk
4+
5+
# SnakeFlow (transient pre-commit / quality state)
6+
.snakeflow/
7+
8+
# Local editor & agent config (do not commit secrets or machine-specific prefs)
9+
.claude/settings.local.json
10+
*.swp
11+
*~
12+
13+
# Environment & secrets
14+
.env
15+
.env.*
16+
*.pem
17+
*.key
18+
*.p12
19+
*.pfx
20+
id_rsa
21+
id_ed25519
22+
credentials.json
23+
secrets.json
24+
secrets.yaml
25+
secrets.yml
26+
service-account*.json
27+
.netrc
28+
29+
# OS
30+
.DS_Store
31+
Thumbs.db
32+
33+
# Flatpak / build artifacts (when added later)
34+
.flatpak-builder/
35+
flatpak-build/
36+
build-dir/
37+
cosmic-repo-test/
38+
build-cosmic/
39+
build-cosmic-git/
40+
cosmic-build-log/
41+
repo/
42+
.claude/

‎AGENTS.md‎

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# cosmic-containers — Agent Instructions
2+
3+
<!-- SNAKEFLOW:STRUCTURE:BEGIN — auto-generated by SnakeFlow. Do not edit manually. -->
4+
**Layer boundaries**: imports flow one direction only (utils → services → commands → extension). Extract to a shared module when logic is duplicated 2+ times.
5+
6+
**Don't touch**: `target/**`
7+
8+
> For numeric thresholds (line count, function length, complexity, etc.) run `Ctrl+Alt+F` — values live in VS Code settings, not here.
9+
<!-- SNAKEFLOW:STRUCTURE:END -->
10+
11+
## Overview
12+
13+
Rust crate (`cosmic-containers`): **Cosmic Containers** — COSMIC panel applet for Pop!_OS that lists and starts/stops Docker containers via CLI (`libcosmic`, `cosmic::applet::run`). Binary requires feature `applet`, Docker in PATH, and system Wayland/GTK-related dev packages. See `README.md` for install and “Add widget” steps.
14+
15+
**Chat language**: Reply to the user in **Ukrainian** unless they ask for another language. Keep code, identifiers, commits, and this file in **English**.
16+
17+
When requirements are unclear, ask once with concrete options rather than guessing architecture.
18+
19+
## Tech Stack
20+
21+
| Item | Value |
22+
|------|--------|
23+
| Language | Rust |
24+
| Edition | 2024 (`Cargo.toml`) |
25+
| Package manager | Cargo |
26+
| Build output | `target/` (gitignored) |
27+
28+
## Commands
29+
30+
```bash
31+
# Build (debug)
32+
cargo build
33+
34+
# Run applet (COSMIC session, requires system deps + --features applet)
35+
cargo run --release
36+
37+
# Release build
38+
cargo build --release
39+
40+
# Check without full link
41+
cargo check
42+
43+
# Format
44+
cargo fmt
45+
46+
# Lint
47+
cargo clippy
48+
```
49+
50+
Prefer `cargo check` for fast feedback during edits; run `cargo build` or `cargo run` before claiming a change works.
51+
52+
## Code Style
53+
54+
- Match existing style: minimal, direct Rust without premature abstractions.
55+
- Keep diffs small; do not refactor unrelated code in the same change.
56+
- Prefer `Result` and explicit error handling over `unwrap()` in non-trivial paths.
57+
- Use `cargo fmt` before finishing; keep `Cargo.toml` dependencies justified.
58+
- Comments only for non-obvious behavior; let names and types carry intent.
59+
60+
## Architecture
61+
62+
```
63+
cosmic-containers/
64+
AGENTS.md # This file
65+
Cargo.toml # `applet` feature → libcosmic
66+
src/lib.rs # APP_ID, ContainerSummary, parse_ps_output
67+
src/main.rs # cosmic::applet::run
68+
src/app.rs # Application impl (panel + popup)
69+
src/services/docker.rs # async docker CLI
70+
resources/ # .desktop, metainfo, icon
71+
scripts/install-local.sh
72+
.githooks/
73+
.cursor/skills/
74+
```
75+
76+
Panel UI lives in `src/app.rs`; parsing and types in `src/lib.rs`; Docker in `src/services/docker.rs`. Register applets with `X-CosmicApplet=true` in `resources/*.desktop`.
77+
78+
## Testing
79+
80+
- Do not add tests unless the user asks or they cover real, non-trivial behavior.
81+
- Pre-commit (when configured): `cargo test` runs via SnakeFlow custom checks in `.vscode/settings.json`.
82+
- After adding tests, run `cargo test` before claiming the change works.
83+
84+
## Security
85+
86+
**Never**: commit `target/`, secrets, API keys, or machine-specific paths in agent context files.
87+
88+
**Always**: read `Cargo.toml` and relevant `src/**/*.rs` before proposing changes; justify new dependencies in `Cargo.toml`.
89+
90+
## PR / Commit
91+
92+
- Create commits only when the user explicitly asks.
93+
- Do not force-push to `main`/`master` or skip hooks (`--no-verify`) unless the user explicitly requests it.
94+
- Pre-commit hook: `.githooks/pre-commit` (SnakeFlow). Requires SnakeFlow extension CLI when installed; otherwise exits 0.
95+
96+
## Agent Workflows
97+
98+
1. Read `Cargo.toml` and relevant `src/**/*.rs` before proposing changes.
99+
2. Implement the smallest change that satisfies the request.
100+
3. Verify with `cargo check` (minimum) or `cargo run` when behavior matters.
101+
102+
**Dev environment (SnakeFlow)**: use `.cursor/skills/setup-dev-manager/SKILL.md`. Fetch live docs from `https://snakeflow.pages.dev/getting-started/cursor-setup-skill/` when configuring `devManager.*` in `.vscode/settings.json`.
103+
104+
## Verify / Acceptance
105+
106+
Before marking work done:
107+
108+
| Step | Command |
109+
|------|---------|
110+
| Fast compile check | `cargo check` |
111+
| Format | `cargo fmt --check` |
112+
| Lint (if enabled in pre-commit) | `cargo clippy -- -D warnings` |
113+
| Tests (if present / requested) | `cargo test` |
114+
| Run behavior | `cargo run` when output or CLI behavior matters |
115+
116+
## Pre-Planning Protocol
117+
118+
For non-trivial work:
119+
120+
1. **Clarify**: ask focused questions about scope, target platform (desktop integration vs CLI), and error-handling expectations before coding.
121+
2. **Test plan**: decide whether `cargo check`, `cargo test`, or `cargo run` proves the change; note any manual steps on Pop!_OS if relevant.
122+
3. **Read first**: `Cargo.toml`, `src/main.rs`, and any new modules touched; skip for trivial one-line fixes.

‎CHANGELOG.md‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.2.0] - 2026-07-25
9+
10+
### Added
11+
12+
- Flatpak packaging manifest (`flatpak/io.github.vaulttec_dev.CosmicContainers.json`) for COSMIC Flatpak / Flathub
13+
- Host Docker access in Flatpak via `flatpak-spawn --host docker`
14+
- Tab-scoped clean action (broom icon) running `docker container|image|volume prune`, with confirmation and reclaimed-space feedback
15+
- Published ports and live CPU / RAM usage per container (`docker stats --no-stream`, polled only while the popup is open)
16+
17+
### Changed
18+
19+
- Application ID renamed to `io.github.vaulttec_dev.CosmicContainers` (desktop entry, metainfo, icon paths)
20+
- Crate, binary, and command renamed from `linux-pop-extension` to `cosmic-containers`; settings from the old config directory are migrated on first load
21+
- Application icon replaced with an original design — the previous one was the Docker logo, a trademark of Docker, Inc.
22+
- Popup doubled in size (800×960) with 16 rows per page
23+
- Header refresh button replaced by the clean action; lists still auto-refresh every 5 seconds
24+
- Flatpak permissions trimmed: dropped `--filesystem=/var/run/docker.sock` (unused — the applet talks to the host CLI via `flatpak-spawn`) and both `xdg-config` overrides; added `--socket=fallback-x11`
25+
26+
### Fixed
27+
28+
- Settings are written to `$XDG_CONFIG_HOME` when set; inside Flatpak `$HOME/.config` is a sandbox tmpfs, so the panel font size was lost on every restart
29+
- Panel button grows along the panel's major axis instead of being fixed to one icon width, and the applet surface is wrapped in `autosize_window`, so the running count is no longer clipped; the font is capped to the panel thickness
30+
- Volume prune passes `-a`: without it Docker removes only anonymous volumes and leaves unused named ones behind
31+
- Ports are also shown for stopped containers, read from their configured bindings (`docker ps` reports ports only while a container runs)
32+
- Settings path follows `APP_ID`; legacy config under `~/.config/linux-pop-extension/` is migrated on first load
33+
34+
## [0.1.0] - 2026-05-20
35+
36+
### Added
37+
38+
- Initial Rust crate layout (`lib` + `bin`, integration smoke test)
39+
- SnakeFlow / pre-commit quality configuration
40+
- README, LICENSE, SECURITY.md, CODEOWNERS, Dependabot, CI workflow

0 commit comments

Comments
 (0)