Clipboard example works

This commit is contained in:
Sasha Koshka 2023-05-03 01:34:48 -04:00
parent 6e1369da5c
commit 4f8469c359
12 changed files with 16 additions and 19 deletions

View File

@ -7,13 +7,9 @@ import _ "image/gif"
import _ "image/jpeg"
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/data"
import "git.tebibyte.media/sashakoshka/tomo/nasin"
import "git.tebibyte.media/sashakoshka/tomo/popups"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
func main () {
tomo.Run(run)
}
var validImageTypes = []data.Mime {
data.M("image", "png"),
@ -21,8 +17,16 @@ var validImageTypes = []data.Mime {
data.M("image", "jpeg"),
}
func run () {
window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 256, 0))
func main () {
nasin.Run(Application { })
}
type Application struct { }
func (Application) Init () error {
window, err:= nasin.NewWindow(tomo.Bounds(0, 0, 256, 0))
if err != nil { return err }
window.SetTitle("Clipboard")
container := elements.NewVBox(elements.SpaceBoth)
@ -114,8 +118,9 @@ func run () {
container.Adopt(controlRow)
window.Adopt(container)
window.OnClose(tomo.Stop)
window.OnClose(nasin.Stop)
window.Show()
return nil
}
func imageWindow (parent tomo.Window, image image.Image) {

View File

@ -5,7 +5,6 @@ import "image"
import _ "image/png"
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
func main () {
tomo.Run(run)

View File

@ -4,7 +4,6 @@ import "os"
import "path/filepath"
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
func main () {
tomo.Run(run)

View File

@ -2,7 +2,6 @@ package main
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
func main () {
tomo.Run(run)

View File

@ -8,7 +8,6 @@ import "github.com/jezek/xgbutil/gopher"
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/popups"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
func main () {
tomo.Run(run)

View File

@ -2,7 +2,6 @@ package main
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
func main () {
tomo.Run(run)

View File

@ -4,7 +4,6 @@ import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/popups"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import "git.tebibyte.media/sashakoshka/tomo/elements/testing"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
func main () {
tomo.Run(run)

View File

@ -4,7 +4,6 @@ import "fmt"
import "image"
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
func main () {
tomo.Run(run)

View File

@ -3,7 +3,6 @@ package main
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/popups"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
func main () {
tomo.Run(run)

View File

@ -4,7 +4,6 @@ import "time"
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/popups"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
func main () {
tomo.Run(run)

View File

@ -2,7 +2,6 @@ package main
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
func main () {
tomo.Run(run)

View File

@ -42,6 +42,9 @@ func NewBackend () (output tomo.Backend, err error) {
doChannel: make(chan func (), 32),
open: true,
}
backend.SetTheme(nil)
backend.SetConfig(nil)
// connect to X
backend.connection, err = xgbutil.NewConn()
@ -115,7 +118,6 @@ func (backend *backend) SetConfig (config tomo.Config) {
} else {
backend.config = config
}
backend.config = config
for _, window := range backend.windows {
window.handleConfigChange()
}