Metadata-Version: 2.4
Name: clipshelf
Version: 1.0.0
Summary: Clipboard history for Linux: press Super+V to search, pin and paste anything you've copied.
Author: sudipnext
License-Expression: MIT
Project-URL: Homepage, https://github.com/sudipnext/clipshelf
Project-URL: Issues, https://github.com/sudipnext/clipshelf/issues
Project-URL: Releases, https://github.com/sudipnext/clipshelf/releases
Keywords: clipboard,clipboard-manager,clipboard-history,linux,gnome,gtk,x11,snippets
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: X11 Applications :: GTK
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Desktop Environment
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

<p align="center">
  <img src="https://raw.githubusercontent.com/sudipnext/clipshelf/main/docs/icon.svg" alt="" width="96">
</p>

<h1 align="center">clipshelf</h1>

<p align="center"><strong>A fast, good-looking clipboard history for Linux — press <code>Super+V</code>, pick, paste.</strong></p>

<p align="center">
  <a href="https://github.com/sudipnext/clipshelf/releases/latest"><img alt="Latest release" src="https://img.shields.io/github/v/release/sudipnext/clipshelf"></a>
  <a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/github/license/sudipnext/clipshelf"></a>
  <img alt="Linux" src="https://img.shields.io/badge/platform-Linux%20(X11)-blue">
</p>

clipshelf remembers everything you copy (text, links, code, images) and brings it back with a
Windows-style `Super+V` popup. It is a single Python file with **zero dependencies to install**:
it only uses Python 3, GTK 3 and Xlib, which already ship with Ubuntu, Fedora, Debian and most
GNOME desktops.

<p align="center">
  <img src="https://raw.githubusercontent.com/sudipnext/clipshelf/main/docs/screenshot.png" alt="clipshelf picker showing pinned snippets and recent copies" width="440">
</p>

## Features

- **Tracks every copy** — text, URLs, code and images, persisted across reboots.
- **`Super+V` popup** that opens next to your mouse, like Windows 11. Press it again to close.
- **Pastes for you** — hit `Enter` and the item is pasted straight into the app you were using
  (uses `Ctrl+Shift+V` automatically in terminals).
- **Search as you type**, plus filter chips for *All / Pinned / Text / Images*.
- **Pin** favourites so they stay at the top and are never trimmed.
- **Add your own snippets** with the `+` button (or `Ctrl+N`) — perfect for addresses,
  canned replies, commands you always forget.
- **Edit** any text entry in place.
- **Smart previews** — colour swatches for `#hex` / `rgb()` values, monospace for code,
  highlighted links, image thumbnails.
- **Duplicate-free** — copying something again moves it to the top instead of adding a copy.
- **Privacy-minded** — skips entries that password managers (e.g. KeePassXC) mark as secret,
  stores history with owner-only permissions, and clearing keeps only what you pinned.
- **Follows your theme** — dark or light, picked up from GNOME automatically.

## Requirements

- Linux with an **X11** session (GNOME, Cinnamon, MATE, XFCE, …)
- Python 3.8+ with PyGObject and GTK 3 (`python3-gi`, `gir1.2-gtk-3.0`) — preinstalled on
  virtually every GNOME desktop
- `libX11` and `libXtst` — part of every X11 install

Nothing to `pip install`, nothing to compile.

## Install

### One command (any distro)

```bash
curl -fsSL https://raw.githubusercontent.com/sudipnext/clipshelf/main/install.sh | bash
```

The installer checks your system, offers to install Python/GTK if they are somehow missing
(apt, dnf, pacman, zypper, xbps, apk, eopkg), downloads the latest release and sets everything
up. Run the same command again to upgrade. Options go after `bash -s --`, for example
`... | bash -s -- --version v1.0.0`; see `install.sh --help`.

### Debian, Ubuntu, Mint, Pop!_OS (.deb)

Download `clipshelf_1.0.0_all.deb` from the [latest release](https://github.com/sudipnext/clipshelf/releases/latest), then:

```bash
sudo apt install ./clipshelf_1.0.0_all.deb
clipshelf install
```

The second command (as your normal user) turns on autostart and the `Super+V` shortcut.

### From source

```bash
git clone https://github.com/sudipnext/clipshelf.git
cd clipshelf
python3 clipshelf.py install
```

### What `clipshelf install` sets up

1. the program in `~/.local/bin/clipshelf` (one-command and source installs),
2. the background watcher, started now and on every login (`~/.config/autostart`),
3. a **Clipboard History** launcher in your app grid,
4. on GNOME, the **`Super+V`** shortcut. GNOME uses `Super+V` for the notification list
   by default, so that binding is moved aside — notifications remain on **`Super+M`**.

On other desktops, bind any shortcut you like to `clipshelf show`.

## Using the picker

| Key | Action |
| --- | --- |
| *type* | Search |
| `↑` `↓` / `PgUp` `PgDn` | Move the selection |
| `Enter` | Paste into the previous app |
| `Shift+Enter` | Copy only, don't paste |
| `Alt+1` … `Alt+9` | Quick-paste the *n*-th item |
| `Ctrl+P` | Pin / unpin |
| `Ctrl+E` | Edit the selected text entry |
| `Ctrl+N` | New snippet (saved as pinned) |
| `Del` (empty search) / `Ctrl+D` | Remove the selected entry |
| `Tab` / `Shift+Tab` | Switch filter |
| `Esc` | Clear the search, then close |

Clicking an entry pastes it as well. The broom button clears unpinned history (click twice to
confirm).

## Command line

```text
clipshelf show           open or close the picker (what Super+V runs)
clipshelf add [TEXT]     save a pinned snippet; reads stdin if TEXT is "-" or omitted
clipshelf list           print the history
clipshelf clear [--all]  clear unpinned history (--all removes pinned entries too)
clipshelf daemon         run the background watcher (started automatically)
clipshelf quit           stop the background watcher
clipshelf install        install, autostart and bind Super+V
clipshelf uninstall      undo install (your history is kept)
clipshelf --version      print the version
```

Example — save the output of a command as a snippet:

```bash
ip -4 addr show wlan0 | clipshelf add -
```

## Configuration

Settings live in `~/.config/clipshelf/config.json` (created on first run). Restart the watcher
with `clipshelf quit && clipshelf show` after editing.

| Key | Default | Meaning |
| --- | --- | --- |
| `max_items` | `200` | Unpinned entries to keep. Pinned entries are never trimmed. |
| `paste_on_select` | `true` | Paste into the previous app on `Enter`; `false` = copy only. |
| `capture_images` | `true` | Record copied images. |
| `position` | `"pointer"` | `"pointer"` opens by the mouse, `"center"` in the middle of the screen. |
| `theme` | `"auto"` | `"auto"`, `"dark"` or `"light"`. |
| `width`, `height` | `440`, `560` | Picker size in pixels. |
| `shortcut` | `"<Super>v"` | Shortcut bound by `clipshelf install` (GNOME accelerator syntax). |

## How it works

- A small background process listens for clipboard ownership changes through GTK and stores
  each new entry in `~/.local/share/clipshelf/history.json` (images as PNG files beside it).
- `clipshelf show` is a tiny client that talks to that process over a Unix socket in
  `$XDG_RUNTIME_DIR`, so the popup appears instantly.
- Auto-paste remembers which window was focused before the popup opened and sends the paste
  keystroke with the X Test extension via `ctypes` — no `xdotool` needed.

## Limitations

- **Wayland:** compositors only let focused apps read the clipboard, so background capture and
  auto-paste don't work reliably there. Log in with an X11 session ("Ubuntu on Xorg") to use
  clipshelf.
- Rich formats (HTML, files) are stored as their plain-text form.

## Uninstall

```bash
curl -fsSL https://raw.githubusercontent.com/sudipnext/clipshelf/main/uninstall.sh | bash
```

This stops the watcher and removes the shortcut, autostart entry, launcher and program, and
gives `Super+V` back to GNOME's notification list. Your history is kept in
`~/.local/share/clipshelf`; add `-s -- --purge` to delete it as well:

```bash
curl -fsSL https://raw.githubusercontent.com/sudipnext/clipshelf/main/uninstall.sh | bash -s -- --purge
```

Installed the `.deb`? Run `clipshelf uninstall` first, then `sudo apt remove clipshelf`.

## License

[MIT](LICENSE)
