{"id":16833955,"url":"https://github.com/linus789/wl-clip-persist","last_synced_at":"2025-04-06T06:07:40.744Z","repository":{"id":102149039,"uuid":"512234451","full_name":"Linus789/wl-clip-persist","owner":"Linus789","description":"Keep Wayland clipboard even after programs close","archived":false,"fork":false,"pushed_at":"2025-03-27T13:05:20.000Z","size":274,"stargazers_count":124,"open_issues_count":5,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T05:04:19.706Z","etag":null,"topics":["clipboard","wayland"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Linus789.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-09T16:33:06.000Z","updated_at":"2025-03-29T19:04:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac92970c-0200-471f-83cd-3113dbc8926f","html_url":"https://github.com/Linus789/wl-clip-persist","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Linus789%2Fwl-clip-persist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Linus789%2Fwl-clip-persist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Linus789%2Fwl-clip-persist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Linus789%2Fwl-clip-persist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Linus789","download_url":"https://codeload.github.com/Linus789/wl-clip-persist/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247441049,"owners_count":20939239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clipboard","wayland"],"created_at":"2024-10-13T11:55:43.462Z","updated_at":"2025-04-06T06:07:40.722Z","avatar_url":"https://github.com/Linus789.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wl-clip-persist\nNormally, when you copy something on Wayland and then close the application you copied from, the copied data (e.g. text) disappears and you cannot paste it anymore. If you run wl-clip-persist in the background, however, the copied data persists.\n\n## How it works\nWhenever you copy something, it reads all the clipboard data into memory and then overwrites the clipboard with the data from our memory.\nBy doing so, the data is available even after the program you copied from exits.\n\n## Usage\n### Clipboard Type\nWhen you specify the clipboard to operate on, the clipboard data there will persist.\nThe clipboards we don’t operate on will continue to behave like before.\n\nRegular clipboard\n```\nwl-clip-persist --clipboard regular\n```\n\nPrimary clipboard\n```\nwl-clip-persist --clipboard primary\n```\n\nRegular and Primary clipboard\n```\nwl-clip-persist --clipboard both\n```\n\n\u003e [!NOTE]\n\u003e The general recommendation is to operate on the regular clipboard only,\nsince the primary clipboard seems to have unintended side effects for some applications,\n[see here](#primary-selection-mode-breaks-the-selection-system-3).\n\n## Optional arguments\n### Write timeout\n*Default: 3000 ms*\n\nIt is possible to change the write timeout.\nIn this example, the write timeout is reduced to 1000 ms.\n```\nwl-clip-persist --clipboard regular --write-timeout 1000\n```\n\nIf the data size exceeds the pipe buffer capacity, we will have to\nwait for the receiving client to read some of the content to write the rest to it.\nTo avoid keeping old clipboard data around for too long, there is a timeout\nwhich is also useful to limit the memory usage.\n\n### Ignore event on error\n*Default: disabled*\n\nWith `--ignore-event-on-error` only selection events where no error occurred are handled. If an error occurred and the selection event is ignored, you will still be able to paste the clipboard, but only for as long as the program you copied from is open.\n\nWhen this option is disabled, it will try to read the entire data for as many MIME types as possible. For example, when a clipboard event offers `image/png` and `text/plain` data and we are only able to read the `text/plain` data entirely because a read error occurred for `image/png`, then the clipboard will be overwritten with our data that only offers `text/plain`.\n\n### Filter\n*Default: no filter*\n\nWith `--all-mime-type-regex \u003cREGEX\u003e` only selection events where all offered MIME types have a match for the regex are handled.\nYou might want to use this option to ignore selection events that offer for example images. If the event is ignored, you will still be able to paste the images, but only for as long as the program you copied them from is open.\n\nIgnore events that offer images\n```\nwl-clip-persist --clipboard regular --all-mime-type-regex '(?i)^(?!image/).+'\n```\n\nIgnore most events that offer something else than text\n```\nwl-clip-persist --clipboard regular --all-mime-type-regex '(?i)^(?!(?:image|audio|video|font|model)/).+'\n```\n\n### Selection size limit\n*Default: no limit*\n\nWith `--selection-size-limit \u003cBYTES\u003e` only selection events whose total data size does not exceed the size limit are handled. If the size limit has been exceeded, you will still be able to paste the clipboard, but only for as long as the program you copied from is open.\n\nIgnore events that exceed the size of 1 MiB\n```\nwl-clip-persist --clipboard regular --selection-size-limit 1048576\n```\n\nThis option can be used to limit the memory usage.\n\n### Reconnect tries\n*Default: no limit*\n\nWith `--reconnect-tries`, the number of tries to reconnect to the Wayland server after a Wayland error occurred will be limited.\n\nThis option only applies if a Wayland error occurred after at least one successful connection to the Wayland server has been established. If the first connection to the Wayland server on startup fails, the application will exit with exit code 1.\n\n### Reconnect delay\n*Default: 100 ms*\n\nWith `--reconnect-delay`, the delay between reconnect tries to the Wayland server is adjusted.\n\nAfter a Wayland error occurred, a reconnect will be tried immediately. If the reconnect failed, the delay is applied before another reconnect is tried.\n\n### Disable timestamps\n*Default: not disabled*\n\nWith `--disable-timestamps`, the timestamps in the log messages are disabled.\nThis might be useful for systemd services or similar, which provide their own timestamps.\n\n### Logging\nYou can modify the log level to see more of what is going on, e.g.\n```\nRUST_LOG=trace wl-clip-persist --clipboard regular\n```\n\n## Troubleshooting\n### Primary selection mode breaks the selection system ([#3](https://github.com/Linus789/wl-clip-persist/issues/3))\n\u003e especially those based on GTK, e.g. Thunar and Inkscape\n\n\u003e [...] once you start using the primary mode or both, it becomes impossible to select text, because once you release the cursor to finalize the selection, it disappears.\n\n**Solution:**\nUse the regular clipboard only, e.g.\n```\nwl-clip-persist --clipboard regular\n```\n\n### Inkscape crashes when copy-pasting anything ([#7](https://github.com/Linus789/wl-clip-persist/issues/7))\n**Solution:**\n```\nwl-clip-persist --clipboard regular --all-mime-type-regex '(?i)^(?!image/x-inkscape-svg).+'\n```\n\n## FAQ\n### Is it possible to have a clipboard history?\nIt is perfectly possible to use a clipboard history application alongside wl-clip-persist.\nFor example [cliphist](https://github.com/sentriz/cliphist) will work.\n\n### Is it possible to ignore clipboard events from password managers?\nDepends. If the password manager advertises the selection event with the additional MIME type `x-kde-passwordManagerHint`,\nlike for example KeePassXC does, then we can ignore the selection event via:\n```\nwl-clip-persist --clipboard regular --all-mime-type-regex '^(?!x-kde-passwordManagerHint).+'\n```\n\n## Build from source\n* Install `rustup` to get the `rust` compiler installed on your system. [Install rustup](https://www.rust-lang.org/en-US/install.html)\n* Rust version 1.76.0 or later is required\n* Build in release mode: `cargo build --release`\n* The resulting executable can be found at `target/release/wl-clip-persist`\n\n## Thanks\n* [wl-clipboard-rs](https://github.com/YaLTeR/wl-clipboard-rs) for showing how to interact with the Wayland clipboard\n* [wl-gammarelay-rs](https://github.com/MaxVerevkin/wl-gammarelay-rs) for showing how to use [wayrs](https://github.com/MaxVerevkin/wayrs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinus789%2Fwl-clip-persist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinus789%2Fwl-clip-persist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinus789%2Fwl-clip-persist/lists"}