Commit graph

53 commits

Author SHA1 Message Date
f2274aa524
multicall: auto-select MIME type more intelligently when not specified
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Idfd5ab25079161d694bda429e70500a16a6a6964
2025-12-23 10:11:28 +03:00
bbfe583423
multicall: prevent newline corruption of binary data in wl-copy
Previously we unconditionally appended a newline to all clipboard
contents, which ended up corrupting binary files like PNG images when
using shell redirection (e.g., `wl-paste > file.png`). Now we
intelligently (in quotes) detect content type via MIME type and only
append newlines to text-based content such as `text/*`,
`application/json` and so on. Binary data on another hand is written
exactly as it is. Falls back to UTF-8 validation when MIME type is
unavailable.

On paper this is also fully backwards compatible; text content still
gets newline by default *unless* the `--no-newline` flag is used.

Fixes #52

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I8b1e6f7013d081150be761820cafd1926a6a6964
2025-12-23 09:41:19 +03:00
raf
1f0312b2f6
Merge pull request #56 from NotAShelf/notashelf/push-umuwyuqntslp
various: bump dependencies
2025-12-22 17:14:53 +03:00
c2182d21dc
chore: bump dependencies; fix lifetime warnings for Rust 1.90+
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: If755ceefb970311c7660118cb2019c2c6a6a6964
2025-12-22 16:59:12 +03:00
a68946d54d
various: fix clippy lints
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I4bb649a5161460d8794dc5c93baa6cc46a6a6964
2025-11-13 00:05:52 +03:00
2d8ccf2a4f
multicall: go back to forking solution
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I2a24a3c7efc41fc45c675fd98e08782e6a6a6964
2025-11-13 00:05:48 +03:00
61ff65e9e8
stash: make log messages lowercase
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I45a9055b6bc3bfbf2179627470d0cedd6a6a6964
2025-10-28 13:02:59 +03:00
d59ac77b9f
stash: utilize clap for multicall functionality; simplify CLI handler
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I84d9f46bb9bba0e893aa4f99d6ff48f76a6a6964
2025-10-28 12:40:17 +03:00
78acc38044
multicall: cleanup; modularize
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I658f22fdf983777354a5beb32df631916a6a6964
2025-10-27 11:11:13 +03:00
955a5d51f8
multicall: cleanup; match wl-copy/wl-paste interfaces more closely
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I8cc05c0141cccff8378ef4fd83ccf77d6a6a6964
2025-10-25 08:38:53 +03:00
78fa23a764
multicall: remove program name prefixes from log and error messages
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964f65a0f1e473a50abfa985365ad8f1fa1
2025-10-09 14:44:45 +03:00
6496d3963d
stash: add multicall support for stash-copy and stash-paste
We can finally tell the users that they can uninstall `wl-copy` and
`wl-paste` on their systems. Stash now somewhat supports being invoked
under the names `stash-copy` and `stash-paste` to fully reimplement the
functionality of `wl-copy` and `wl-paste` respectively.

A build wrapper has been added generate symlinks for `stash-copy`, `stash-paste`,
`wl-copy`, and `wl-paste`. `wl-copy` and `wl-paste` links are provided
only for backwards compatibility, but they will not go away anytime
soon.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964463b35427cb720fbab68b252944cc90c
2025-10-09 14:40:54 +03:00
f8440926b1
list: log clipboard copy errors and update notification message
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69649bdd37a44f254d520e33a54634958ada
2025-10-09 11:45:37 +03:00
d8b1ac1f37
list: properly error notification if clipboard copy fails
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a696459d7fbc344545daeead6164cad5cde6f
2025-10-09 11:45:36 +03:00
4c0782f80e
list: add clipboard actions for delete and copy; notify
This adds an optional dependency on notify-rust, which we use to display
notifications when an entry is deleted or copied. If the user thinks a
TUI using desktop notifications is *not* desirable, it can be disabled
with the `notifications` feature flag.

We now support copying entries to the clipboard with `Enter` and
deleting entries with `Shift+D`. Both of those will show notifications.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69642d0c13a1359b3b51125cc4b691cd5679
2025-10-09 11:08:50 +03:00
a41d72fb6b
stash: refactor error handling and entry deduplication
This includes breaking changes to the database entries, where we have
started deduplicating based on hashes instead of full entries. Entry
collisions are possible, but highly unlikely.

Additionally we use `Box<str>` for error variants to reduce allocations.
This is *yet* to give me a non-marginal performance benefit but doesn't
hurt to be more correct.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964d0a33392da61372214ca3088551564ac
2025-09-19 14:08:15 +03:00
d05ad311a9
wayland: remove closed toplevels on event
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69644f5e067b3533a7f62c42d4a6d01be00b
2025-09-19 14:08:14 +03:00
36c183742d
stash: blocking persistent entries by window class
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964061bd97b4ffc4e84d835072331a966c6
2025-09-19 11:22:58 +03:00
c9a73b462d
commands: more consistent error propagation
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69647a0eb8de028e4251465fbb94f0a14cef
2025-08-20 18:38:05 +03:00
ae98cc0b86
stash: replace atty with is_terminal from std::io
It's deprecated, oops.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69646dc5a20ff1fde23ea9a846a7a3fdd16a
2025-08-20 18:38:04 +03:00
Rexiel Scarlet
ef0d05cbad
reset auto increment on stash wipe 2025-08-20 18:53:46 +04:00
b1a220400d
stash: add help text for cliphist compat flags
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964aa5c4ab66d13fe6e0d38400cdde5de1a
2025-08-20 11:06:53 +03:00
1ed518a3b6
stash: move import logic into stash::commmands
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964f8fb8c9b14049ba3a343bb453ca59004
2025-08-20 11:06:52 +03:00
f39937d3ca
stash: import all entries by default; log if db import fails
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964804698d2e83a37ec2688e9c126cf412b
2025-08-20 09:57:45 +03:00
6a5cd9b95d
treewide: format with rustfmt
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69642c2865f41a4b141ddf39a198a3fc2e09
2025-08-20 09:57:44 +03:00
47fd5e4964
db: support other image formats supported by imagesize
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69646b72b8bc223fe9729be3dbefbae2b353
2025-08-15 08:04:36 +03:00
7c26947437
commands/list: resolve clippy warnings
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964e1bb8c22b5026ce65889e3aec1b90a71
2025-08-15 08:04:35 +03:00
83d45c6414
list: if we're in a TTY, output data in a TUI
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a696493f2e7ca911b6c1e2692b67f357a4b6b
2025-08-15 08:04:24 +03:00
0547376a9e
chore: apply clippy fixes; suppress "too many lines" lint
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a696476135218b9979677c66c4be4d96aced8
2025-08-14 17:31:26 +03:00
f3089148e0
db: allow explicitly skipping sensitive entries
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964ed1deaac0215ae9c6f4c70cfdc50164d
2025-08-14 17:24:20 +03:00
86001652cd
stash: allow confirming destructive operations with --ask
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69644c23734a8b088e20473d381390d532b4
2025-08-14 17:24:01 +03:00
f6bf5586ad
import: nesting is ew yuck
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964becfe6f31b0411110b75d4cdfe2b9c63
2025-08-14 10:53:40 +03:00
64c923480e
decode: fallback to relaying current clipboard to stdout on failure
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a696451def3e367afa9e8b0dd6ae626906e53
2025-08-13 18:46:02 +03:00
db6a962c75
stash: create database directory automatically if missing
Oops.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964866a1711971322c81ea194aa062466da
2025-08-13 17:07:06 +03:00
9d0ad95e07
db: treat valid UTF-8 entries as text/plain
Makes JSON output more... servicable.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964f642a02e990979f93f53a8b69764b469
2025-08-12 23:01:12 +03:00
9d40dde63a
commands/watch: make it trait-based; move out of main
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964c16396f2013e7f8a5c1a6c0c3bb2aeaa
2025-08-12 22:57:20 +03:00
d9b0908ada
db: allow listing database contents as JSON
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964a756588168f476d984d18f9e8d65bc4e
2025-08-12 22:57:19 +03:00
7d1aa21cdd
db: switch from image to imagesize
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964ab449f38999b5036d6e5554ccae7c049
2025-08-12 21:54:00 +03:00
5bcc23b6f9
stash: don't initialize watch daemon with None
Fixes the daemon always updating the latest entry.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a696489a2e9a0928ff799a4210c160014c485
2025-08-12 21:53:59 +03:00
6c5408abd1
stash: make watch loop async
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69641a4f39f0368de1bcf5780afbe8e5c0b1
2025-08-12 21:53:47 +03:00
fcaf5fb14f
stash: print --help text if no subcommand is provided
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69646361b7ade52ee73a6aa11be859132a94
2025-08-12 19:21:13 +03:00
4f725425fc
db: switch to sqlite as the primary backend
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69648f81d0d094e11a3e0f0a19d3b8eccd5d
2025-08-12 19:07:38 +03:00
efcbe17d73
stash: add watch subcommand
Watches primary clipboard for changes and stores them in the database.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964de9949bbe6d8b9301ca97ae785852b46
2025-08-12 19:07:26 +03:00
aa602edbee
treewide: fix remaining clippy warnings
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964a4f18b72e3fa774cec6b81baa8267cb6
2025-08-12 17:34:43 +03:00
7ebe514e3a
stash: deduplicate error reporting
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964f0f3f13190dde392fc859718716b56a8
2025-08-12 17:34:42 +03:00
6e21021306
treewide: improve logging; custom error types with thiserror
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a696464e4123d15cfaedf4727776e55948369
2025-08-12 17:34:41 +03:00
c23c5af8c1
stash: allow controlling verbosity from the command line
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69641d5d727b1d95f8c9e2b851b3a194315a
2025-08-12 17:34:39 +03:00
d8d27fab22
stash: remove redundant log messages
Ported from print-based logging, now redundant

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964c1ba52c792bd3c2a3e15a97a3b03260e
2025-08-12 17:34:38 +03:00
0e4f4018ab
stash: use more granular STASH_CLIPBOARD_STATE
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964d59d2ce974ba482aee9b1c8f20cdb44e
2025-08-12 17:34:37 +03:00
0c8003d636
stash: remove redundant import flag
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964348f1ad4915890f0b4ccd59619cc3e1a
2025-08-12 17:34:36 +03:00