Skip to content

Commit 8df4a38

Browse files
committed
Adds paster
1 parent 465a558 commit 8df4a38

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

paster/main.go

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package main
2+
3+
import (
4+
"github.com/andlabs/ui"
5+
"github.com/atotto/clipboard"
6+
)
7+
8+
func main() {
9+
snippets := [][]string{
10+
{"Upside Down", "🙃"},
11+
{"Eye Roll", "🙄"},
12+
{"Shrug", `¯\_(ツ)_/¯`},
13+
}
14+
15+
err := ui.Main(func() {
16+
17+
box := ui.NewVerticalBox()
18+
19+
for _, s := range snippets {
20+
label, text := s[0], s[1]
21+
button := ui.NewButton(label)
22+
button.OnClicked(func(*ui.Button) {
23+
clipboard.WriteAll(text)
24+
})
25+
26+
box.Append(button, false)
27+
}
28+
29+
window := ui.NewWindow("Paster", 100, 100, false)
30+
window.SetMargined(true)
31+
window.SetChild(box)
32+
window.OnClosing(func(*ui.Window) bool {
33+
ui.Quit()
34+
return true
35+
})
36+
37+
window.Show()
38+
})
39+
40+
if err != nil {
41+
panic(err)
42+
}
43+
}

0 commit comments

Comments
 (0)