File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed
examples/x-macos-pasteboard/solid-ui Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,12 @@ xs serve ./store --expose :3021
2121
2222Bootstrap 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
3232Start UI:
Original file line number Diff line number Diff line change 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}
You can’t perform that action at this time.
0 commit comments