Skip to content

Commit

Permalink
Using Pyperclip to copy instead of the terminal emulator
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed May 21, 2024
1 parent eaecc59 commit b7d6965
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions elia_chat/widgets/chatbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ def action_copy_to_clipboard(self) -> None:
message = f"Copied message ({len(text_to_copy)} characters)."
self.notify(message, title="Message copied")

self.app.copy_to_clipboard(text_to_copy)
import pyperclip

pyperclip.copy(text_to_copy)
self.visual_mode = False

def action_next_code_block(self) -> None:
Expand Down Expand Up @@ -204,7 +206,9 @@ def action_copy_to_clipboard(self) -> None:
if not self.selection_mode:
text_to_copy = self.message.message.get("content")
if isinstance(text_to_copy, str):
self.app.copy_to_clipboard(text_to_copy)
import pyperclip

pyperclip.copy(text_to_copy)
message = f"Copied message ({len(text_to_copy)} characters)."
self.notify(message, title="Message copied")
else:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies = [
"litellm==1.35.38",
"greenlet>=3.0.3",
"google-generativeai>=0.5.3",
"pyperclip>=1.8.2",
]
readme = "README.md"
requires-python = ">= 3.11"
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ pygments==2.17.2
pyinstrument==4.6.2
pyparsing==3.1.2
# via httplib2
pyperclip==1.8.2
# via elia-chat
python-dotenv==1.0.1
# via litellm
pyyaml==6.0.1
Expand Down
2 changes: 2 additions & 0 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ pygments==2.17.2
# via rich
pyparsing==3.1.2
# via httplib2
pyperclip==1.8.2
# via elia-chat
python-dotenv==1.0.1
# via litellm
pyyaml==6.0.1
Expand Down

0 comments on commit b7d6965

Please sign in to comment.