tconbeer / harlequin

The SQL IDE for Your Terminal.
https://harlequin.sh
MIT License
3.28k stars 76 forks source link

Linux: clipboard on wayland doesn't work #585

Open SalmanFarooqShiekh opened 6 days ago

SalmanFarooqShiekh commented 6 days ago

Before Proceeding, please acknowledge:

Describe the bug Copying text in query editor or query results on wayland compositors with no Xwayland shows an error message: "Could not access system clipboard.". With Xwayland, everything works fine without changing anything.

To Reproduce

  1. Install and start a session of a wayland compositor which doesn't have Xwayland support e.g. niri
  2. Open a terminal window e.g. kitty
  3. Run harlequin duck.db
  4. Type some text in the query editor
  5. Select it with mouse or shift + arrow-keys
  6. Hit control + c
  7. Said error appears in the bottom right corner

Expected behavior Text is copied with no error notification

Actual behavior An error shows up and text is not copied. image

Contributing Are you interested in contributing a fix?

Additional context Not relevant.

What is the output of harlequin --version?

harlequin, version 1.21.0

Installed Adapters:
  - mysql, version 0.1.3
  - odbc, version 0.1.1
  - trino, version 0.1.3
  - databricks, version 0.1.1
  - bigquery, version 1.0.2
  - adbc, version 0.1.1
  - duckdb, version 1.21.0
  - sqlite, version 1.21.0
  - postgres, version 0.2.2

What database adapter are you using with Harlequin? (Default is duckdb) I have tried postgres and duckdb, error is present with both.

What other options are you using when invoking Harlequin? (If you are using a profile, please add relevant items from your profile here). Not relevant.

Can you tell us more about your system?

[!TIP] For example, for my system, these are:

  • Bash
  • Windows Terminal
  • Ubuntu 22.04 / WSL2
  • Windows 11
  • en_US/UTF-8

How did you install Harlequin?

tconbeer commented 6 days ago

It looks like there is a fix for this already upstream (this PR was closed but it was implemented in another commit): https://github.com/asweigart/pyperclip/pull/201

It is probably enough to just bump our pyperclip dependency to the version released last week, v1.9.0

SalmanFarooqShiekh commented 6 days ago

I just edited my original post to say something similar just before your comment :)

Anyways, I know it was a bit hasty on my part but I have already set up the dev environment for harlequin locally on my machine so if you want me to do this and possibly handle any breaking changes to pyperclip, I can do it. Let me know. Thanks.

tconbeer commented 6 days ago

@SalmanFarooqShiekh all good -- I just opened a PR in an upstream project for the textarea widget, which is where Harlequin accesses the clipboard. Once I merge and release that, if you could bump the version of textual-textarea in your local harlequin, that would confirm the fix.

tconbeer commented 6 days ago

ok, textual-textarea v0.13.1 has been released

SalmanFarooqShiekh commented 6 days ago

testing

SalmanFarooqShiekh commented 6 days ago
 1 diff --git a/pyproject.toml b/pyproject.toml
  2 index f903579..b085e22 100644
  3 --- a/pyproject.toml
  4 +++ b/pyproject.toml
  5 @@ -24,7 +24,7 @@ python = ">=3.8.1,<4.0.0"
  6  # textual and component libraries
  7  textual = "==0.56.4"
  8  textual-fastdatatable = "==0.7.1"
  9 -textual-textarea = "==0.13.0"
 10 +textual-textarea = "==0.13.1"
 11  
 12  # click
 13  click = "^8.1.3"

Getting this error:

$ poetry install --sync
Installing dependencies from lock file

pyproject.toml changed significantly since poetry.lock was last generated. Run `poetry lock [--no-update]` to fix the lock file.

$ poetry lock
Updating dependencies
Resolving dependencies... (74.3s)

Because no versions of textual match >0.60,<0.60.1 || >0.60.1,<0.61
 and textual[syntax] (0.60.0) depends on textual (0.60.0), textual[syntax] (>=0.60,<0.60.1 || >0.60.1,<0.61) requires textual (0.60.0).
And because textual[syntax] (0.60.1) depends on textual (0.60.1)
 and textual-textarea (0.13.1) depends on textual[syntax] (>=0.60,<0.61), textual-textarea (0.13.1) requires textual (0.60.0 || 0.60.1).
So, because harlequin depends on both textual (==0.56.4) and textual-textarea (==0.13.1), version solving failed.

Sorry I haven't done python in a while and poetry never.

tconbeer commented 6 days ago

Oh, my bad. Looks like I updated something I shouldn't have in the other project

SalmanFarooqShiekh commented 5 days ago

Any way I can help?

tconbeer commented 3 days ago

Thanks for the offer. No, I need to bump the version of textual we're running in Harlequin. That can be tricky, but I should be able to fight through it next week