Metadata-Version: 2.4
Name: cosmic-flatpak-fixer
Version: 0.1.1
Summary: Restore COSMIC applet metadata stripped from Flatpak desktop exports by Flatpak 1.18.4+.
Keywords: cosmic,flatpak,desktop-entry,applet,pop-os
Author: Serge Matveenko
Author-email: Serge Matveenko <lig@countzero.co>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Desktop Environment
Classifier: Typing :: Typed
Requires-Dist: typer>=0.12
Requires-Dist: xdg-base-dirs>=6.0
Requires-Python: >=3.11
Project-URL: Homepage, https://codeberg.org/lig/cosmic-flatpak-fixer
Project-URL: Issues, https://codeberg.org/lig/cosmic-flatpak-fixer/issues
Project-URL: Repository, https://codeberg.org/lig/cosmic-flatpak-fixer
Description-Content-Type: text/markdown

# cosmic-flatpak-fixer

Restore COSMIC applet metadata that Flatpak strips from exported `.desktop` files.

## The problem

Flatpak 1.18.4+ filters the keys of `.desktop` files it exports, using an
allowlist. Keys such as `X-CosmicApplet`, `X-OverflowPriority` or
`X-HostWaylandDisplay` are dropped, so the COSMIC panel no longer recognises
Flatpak-installed applets as applets.

`cosmic-flatpak-fixer` finds installed Flatpak applications that declare
`X-CosmicApplet=true` and patches their exported `.desktop` file in place
(replacing the export symlink with a real file) so the COSMIC keys survive.
Patched files carry a `# Managed by cosmic-flatpak-fixer` marker, which
records the original symlink so `clean` can restore it.

> Do not put these files in `~/.local/share/applications`. COSMIC then treats
> the applet as a normal running app window.

## Install

```sh
uv tool install cosmic-flatpak-fixer
# or
pipx install cosmic-flatpak-fixer
```

## Usage

```sh
cosmic-flatpak-fixer fix --dry-run   # show what would be patched
cosmic-flatpak-fixer fix             # patch exports of installed COSMIC applets
cosmic-flatpak-fixer clean --dry-run # show what would be restored
cosmic-flatpak-fixer clean           # restore exports of applets that were uninstalled
cosmic-flatpak-fixer --version
```

- `fix` patches the export for every installed Flatpak whose desktop file has
  `X-CosmicApplet=true`. It also removes legacy overlays previously written to
  `~/.local/share/applications`. Run it again after Flatpak updates.
- `clean` restores Flatpak's original symlink for managed exports whose applet
  is no longer installed, and removes any leftover legacy overlays.

Both commands search the user (`$XDG_DATA_HOME/flatpak`, `~/.local/share/flatpak`)
and system (`/var/lib/flatpak`) installations. Re-open the panel settings (or
log out and in) if applets still look wrong afterwards.

## Development

```sh
uv sync
just check        # ruff + pytest
just build        # check, then build sdist and wheel into dist/
```

## Releasing

```sh
just bump-version minor   # or: just set-version 1.0.0 (commits the new version)
git tag "v$(uv version --short)"
just publish              # uv publish; token via UV_PUBLISH_TOKEN or keyring
```

Set `UV_PUBLISH_URL=https://test.pypi.org/legacy/` to try TestPyPI first.

## License

MIT
