Skip to content

Commit 3b0a799

Browse files
authored
fix: example/x-macos-pasteboard (#56)
1 parent 3221077 commit 3b0a799

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

examples/x-macos-pasteboard/solid-ui/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ xs serve ./store --expose :3021
2121

2222
Bootstrap the store:
2323

24-
```bash
24+
```nushell
2525
# register x-macos-pasteboard as a frame generator
26-
echo "x-macos-pasteboard | lines" | xs append ./store pb.spawn
26+
"x-macos-pasteboard | lines" | .append pb.spawn
2727
2828
# register a handler to map raw clipboard data to content
29-
cat handler-pb.map.nu | xs append ./store pb.map.register
29+
cat handler-pb.map.nu | .append pb.map.register
3030
```
3131

3232
Start UI:
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
{|frame|
1+
{
2+
run: {|frame|
23
if $frame.topic != "pb.recv" { return }
34

45
let data = .cas $frame.hash | from json | get types
56

6-
$data | get "public.png"? | if ($in | is-not-empty) {
7-
$in | decode base64 | .append content --meta {
8-
updates: $frame.id
9-
content_type: "image" }
10-
return
7+
$data | get -i "public.png" | if ($in | is-not-empty) {
8+
$in | decode base64 | .append content --meta {
9+
updates: $frame.id
10+
content_type: "image"
11+
}
12+
return
1113
}
1214

13-
$data | get "public.utf8-plain-text"? | if ($in | is-not-empty) {
14-
$in | decode base64 | decode | .append content --meta {updates: $frame.id}
15-
return
15+
$data | get -i "public.utf8-plain-text" | if ($in | is-not-empty) {
16+
$in | decode base64 | decode | .append content --meta {updates: $frame.id}
17+
return
1618
}
1719

1820
$frame
21+
}
1922
}

0 commit comments

Comments
 (0)