atuin: [Bug]: Copy to clipboard unsuccessful

What did you expect to happen?

Pressing ctrl-y in the search view should copy the selected line to the clipboard

What happened?

Pressing ctrl-y closes atuin but the clipboard content is not set

Atuin doctor output

atuin:
  version: 18.2.0
  sync:
    cloud: false
    records: true
    auto_sync: true
    last_sync: 2024-05-17 11:10:19.493442155 +00:00:00
shell:
  name: fish
  default: unknown
  plugins:
  - atuin
system:
  os: Fedora Linux
  arch: x86_64
  version: '39'
  disks:
  - name: /dev/mapper/luks-a71d0523-7b8b-4cc2-9d60-a73e65041027
    filesystem: btrfs
  - name: /dev/mapper/luks-a71d0523-7b8b-4cc2-9d60-a73e65041027
    filesystem: btrfs
  - name: /dev/nvme0n1p2
    filesystem: ext4
  - name: /dev/nvme0n1p1
    filesystem: vfat

Code of Conduct

  • I agree to follow this project’s Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

atuin 18.4.0 + ubuntu 22.04 = still no luck with copying to clipboard with ctl-y 😦

Well it’s a bit weird because that command is run before the set_text

It likely has the same observable effect IIUC. Once atuin stop’s serving its data, the clipboard manager takes over serving data again (since that’s how it can keep serving data after arbitrary numbers of processes/apps exit). Even though arboard failed to hand the data over, identical data was already in the clipboard manager so the failure is papered over.

It doesn’t look like wl-clipboard-rs has much logging it it, so I think the answer is no 😦. Most of what that crate does is a black box to arboard for better or worse.

Interestingly using this patch make it work. I’m quite confused how/why

diff --git a/crates/atuin/src/command/client/search/interactive.rs b/crates/atuin/src/command/client/search/interactive.rs
index 9185bc0f..5caedeb4 100644
--- a/crates/atuin/src/command/client/search/interactive.rs
+++ b/crates/atuin/src/command/client/search/interactive.rs
@@ -1174,7 +1174,8 @@ pub async fn history(
     any(target_os = "windows", target_os = "macos", target_os = "linux")
 ))]
 fn set_clipboard(s: String) {
-    cli_clipboard::set_contents(s).unwrap();
+    cli_clipboard::set_contents(s.to_owned()).unwrap();
+    assert_eq!(cli_clipboard::get_contents().unwrap(), s);
 }
 
 #[cfg(not(all(