From c1b5f6f1163a46550c2c230f6987802d179b0fb2 Mon Sep 17 00:00:00 2001 From: itsmanjeet Date: Wed, 1 Jan 2025 15:07:11 +0530 Subject: [PATCH] expand env in shell --- apps/files/go.sum | 0 apps/files/main.go | 30 +----- core/cmd/shell/main.go | 4 +- devices/generic/x86_64/toolchain.conf | 1 + graphics/go.mod | 4 - graphics/go.sum | 4 - graphics/pkg/app/app.go | 128 -------------------------- graphics/pkg/canvas/canvas.go | 3 - graphics/pkg/event/event.Event.go | 4 - graphics/pkg/widget/widget.go | 22 ----- 10 files changed, 5 insertions(+), 195 deletions(-) create mode 100644 apps/files/go.sum delete mode 100644 graphics/pkg/app/app.go delete mode 100644 graphics/pkg/canvas/canvas.go delete mode 100644 graphics/pkg/event/event.Event.go delete mode 100644 graphics/pkg/widget/widget.go diff --git a/apps/files/go.sum b/apps/files/go.sum new file mode 100644 index 000000000..e69de29bb diff --git a/apps/files/main.go b/apps/files/main.go index c55a1b582..790580777 100644 --- a/apps/files/main.go +++ b/apps/files/main.go @@ -1,33 +1,5 @@ package main -import ( - "image/color" - "log" - "os" - - "rlxos/graphics/pkg/app" - "rlxos/graphics/pkg/canvas" - "rlxos/graphics/pkg/event" - "rlxos/graphics/pkg/widget" -) - -type Box struct { - widget.BaseWidget - color color.Color -} - -func (b *Box) Draw(c canvas.Canvas) {} - -func (b *Box) Update(e event.Event) {} - func main() { - if err := app.Run(&Box{ - color: color.NRGBA{ - R: 255, - A: 255, - }, - }); err != nil { - log.Println("ERROR:", err) - os.Exit(1) - } + } diff --git a/core/cmd/shell/main.go b/core/cmd/shell/main.go index c250d71f7..34f489486 100644 --- a/core/cmd/shell/main.go +++ b/core/cmd/shell/main.go @@ -13,8 +13,9 @@ import ( func main() { HOME := os.Getenv("HOME") + _ = os.Setenv("SHELL", os.Args[0]) reader, err := readline.NewEx(&readline.Config{ - Prompt: ":> ", + Prompt: "> ", HistoryFile: filepath.Join(HOME, ".history"), EOFPrompt: "exit", HistorySearchFold: true, @@ -31,6 +32,7 @@ func main() { for { line, _ := reader.Readline() + line = os.ExpandEnv(line) args := strings.Fields(line) if len(args) == 0 { diff --git a/devices/generic/x86_64/toolchain.conf b/devices/generic/x86_64/toolchain.conf index f6de7506e..e8ab8efa5 100644 --- a/devices/generic/x86_64/toolchain.conf +++ b/devices/generic/x86_64/toolchain.conf @@ -41,6 +41,7 @@ BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS=y BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SVGA=y BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VIRGL=y BR2_PACKAGE_MESA3D_OSMESA_GALLIUM=y +BR2_PACKAGE_MESA3D_OPENGL_GLX=y BR2_PACKAGE_MESA3D_OPENGL_ES=y BR2_PACKAGE_VULKAN_TOOLS=y BR2_PACKAGE_XORG7=y diff --git a/graphics/go.mod b/graphics/go.mod index 4b2f9554d..f62ebacac 100644 --- a/graphics/go.mod +++ b/graphics/go.mod @@ -1,7 +1,3 @@ module rlxos/graphics go 1.22 - -require github.com/rajveermalviya/go-wayland/wayland v0.0.0-20230130181619-0ad78d1310b2 - -require golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1 // indirect diff --git a/graphics/go.sum b/graphics/go.sum index 2383385a6..e69de29bb 100644 --- a/graphics/go.sum +++ b/graphics/go.sum @@ -1,4 +0,0 @@ -github.com/rajveermalviya/go-wayland/wayland v0.0.0-20230130181619-0ad78d1310b2 h1:tRhbehjSCwQSZL7A2AoZlKrDYhZzaPIAcpnhfaUc0Tw= -github.com/rajveermalviya/go-wayland/wayland v0.0.0-20230130181619-0ad78d1310b2/go.mod h1:PXhW/GoWcMBeiZ39ZdgoMs/xduJEEUE+kxUBB2Kwd+M= -golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1 h1:kwrAHlwJ0DUBZwQ238v+Uod/3eZ8B2K5rYsUHBQvzmI= -golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/graphics/pkg/app/app.go b/graphics/pkg/app/app.go deleted file mode 100644 index 99682598e..000000000 --- a/graphics/pkg/app/app.go +++ /dev/null @@ -1,128 +0,0 @@ -package app - -import ( - "log" - - "rlxos/graphics/pkg/widget" - - "github.com/rajveermalviya/go-wayland/wayland/client" - xdgShell "github.com/rajveermalviya/go-wayland/wayland/stable/xdg-shell" -) - -func Run(w widget.Widget) error { - display, err := client.Connect("") - if err != nil { - return err - } - defer display.Destroy() - - display.SetErrorHandler(func(err client.DisplayErrorEvent) { - log.Println(err) - }) - registry, err := display.GetRegistry() - if err != nil { - return err - } - defer registry.Destroy() - - displayRoundTrip := func() { - c, err := display.Sync() - if err != nil { - log.Fatal(err) - } - defer func() { - if err := c.Destroy(); err != nil { - log.Println(err) - } - }() - - done := false - c.SetDoneHandler(func(_ client.CallbackDoneEvent) { - done = true - }) - for !done { - _ = display.Context().Dispatch() - } - } - - var compositor *client.Compositor - var xdgWmBase *xdgShell.WmBase - //var shm *client.Shm - //var seat *client.Seat - var width, height int32 - - //frame := image.NewRGBA64(image.Rect(0, 0, int(width), int(height))) - - registry.SetGlobalHandler(func(globalEvent client.RegistryGlobalEvent) { - log.Println("discovered an interface:", globalEvent.Interface) - switch globalEvent.Interface { - case "wl_compositor": - compositor = client.NewCompositor(display.Context()) - if err := registry.Bind(globalEvent.Name, globalEvent.Interface, globalEvent.Version, compositor); err != nil { - log.Fatal(err) - } - case "xdg_wm_base": - xdgWmBase = xdgShell.NewWmBase(display.Context()) - if err := registry.Bind(globalEvent.Name, globalEvent.Interface, globalEvent.Version, xdgWmBase); err != nil { - log.Fatal(err) - } - xdgWmBase.SetPingHandler(func(event xdgShell.WmBasePingEvent) { - _ = xdgWmBase.Pong(event.Serial) - }) - - } - }) - defer func() { - _ = compositor.Destroy() - _ = xdgWmBase.Destroy() - }() - - // wait for interfaces to register - displayRoundTrip() - - //// wait for handler events - //displayRoundTrip() - - surface, err := compositor.CreateSurface() - if err != nil { - return err - } - xdgSurface, err := xdgWmBase.GetXdgSurface(surface) - if err != nil { - return err - } - - xdgSurface.SetConfigureHandler(func(event xdgShell.SurfaceConfigureEvent) { - if err := xdgSurface.AckConfigure(event.Serial); err != nil { - log.Fatal(err) - } - - }) - - xdgTopLevel, err := xdgSurface.GetToplevel() - if err != nil { - return err - } - xdgTopLevel.SetConfigureHandler(func(event xdgShell.ToplevelConfigureEvent) { - if event.Width == 0 || event.Height == 0 { - return - } - if event.Width == width || event.Height == height { - return - } - - //frame = image.NewRGBA64(image.Rect(0, 0, int(event.Width), int(event.Height))) - width = event.Width - height = event.Height - }) - - running := true - xdgTopLevel.SetCloseHandler(func(event xdgShell.ToplevelCloseEvent) { - running = false - }) - - for running { - _ = display.Context().Dispatch() - } - return nil -} diff --git a/graphics/pkg/canvas/canvas.go b/graphics/pkg/canvas/canvas.go deleted file mode 100644 index a97ee3d4c..000000000 --- a/graphics/pkg/canvas/canvas.go +++ /dev/null @@ -1,3 +0,0 @@ -package canvas - -type Canvas interface{} diff --git a/graphics/pkg/event/event.Event.go b/graphics/pkg/event/event.Event.go deleted file mode 100644 index 7680cf9ef..000000000 --- a/graphics/pkg/event/event.Event.go +++ /dev/null @@ -1,4 +0,0 @@ -package event - -type Event interface { -} diff --git a/graphics/pkg/widget/widget.go b/graphics/pkg/widget/widget.go deleted file mode 100644 index 5d1ca5182..000000000 --- a/graphics/pkg/widget/widget.go +++ /dev/null @@ -1,22 +0,0 @@ -package widget - -import ( - "image" - - "rlxos/graphics/pkg/canvas" - "rlxos/graphics/pkg/event" -) - -type Widget interface { - Draw(canvas.Canvas) - Update(event.Event) - SetBounds(image.Rectangle) -} - -type BaseWidget struct { - Bounds image.Rectangle -} - -func (b *BaseWidget) SetBounds(rect image.Rectangle) { - b.Bounds = rect -}