Skip to content

Commit 7628a69

Browse files
committed
paste i think
1 parent 6041898 commit 7628a69

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

src/rovr/functions/ipc_receiver.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from textual import work
1010

1111
from rovr.app import Application
12+
from rovr.functions.cwd import getcwd
1213
from rovr.screens.yes_or_no import YesOrNo
1314
from rovr.variables.constants import config
1415

@@ -91,6 +92,35 @@ async def conn(
9192
}
9293
for option in options
9394
]
95+
case "paste":
96+
if not await check_permission(self, action, args):
97+
ok = False
98+
err = "denied"
99+
else:
100+
selected_items = (
101+
self.Clipboard.selected
102+
) # dont include highlighted
103+
to_copy, to_cut = (
104+
[
105+
item.path
106+
for item in selected_items
107+
if item.type_of_selection == "copy"
108+
],
109+
[
110+
item.path
111+
for item in selected_items
112+
if item.type_of_selection == "cut"
113+
],
114+
)
115+
# we will be ignoring the prompt that PasteButton
116+
# does because we are assuming that ipc paste is
117+
# a prompt (default) else the person kniws what
118+
# they want from rovr
119+
worker = self.app.query_one("ProcessContainer").paste_items(
120+
to_copy, to_cut, getcwd()
121+
)
122+
await worker.wait()
123+
out = {"copy": len(to_copy), "cut": len(to_cut)}
94124
case "copy" | "cut":
95125
if not await check_permission(self, action, args):
96126
ok = False

0 commit comments

Comments
 (0)