From 72b1804f7f73d36ea585f9d009f3d5bc672fe0c9 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Sun, 11 Feb 2024 16:41:48 +0000 Subject: [PATCH 1/3] Add quake mode terminal module --- cmd/fynedesk/main.go | 1 + go.mod | 8 +- go.sum | 11 ++- internal/ui/desk.go | 5 ++ internal/x11/win/client.go | 15 ++++ internal/x11/wm/desk.go | 7 +- modules/desktops/pager.go | 2 +- modules/quaketerm/init.go | 7 ++ modules/quaketerm/term.go | 164 +++++++++++++++++++++++++++++++++++++ test/window.go | 5 +- window.go | 1 + 11 files changed, 217 insertions(+), 9 deletions(-) create mode 100644 modules/quaketerm/init.go create mode 100644 modules/quaketerm/term.go diff --git a/cmd/fynedesk/main.go b/cmd/fynedesk/main.go index f8ad4292..323db1df 100644 --- a/cmd/fynedesk/main.go +++ b/cmd/fynedesk/main.go @@ -6,6 +6,7 @@ import ( _ "fyshos.com/fynedesk/modules/composit" _ "fyshos.com/fynedesk/modules/desktops" _ "fyshos.com/fynedesk/modules/launcher" + _ "fyshos.com/fynedesk/modules/quaketerm" _ "fyshos.com/fynedesk/modules/status" _ "fyshos.com/fynedesk/modules/systray" diff --git a/go.mod b/go.mod index 6fe6dc97..507c6dcf 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/FyshOS/backgrounds v0.0.0-20230616202904-0a8b6ebaa184 github.com/Knetic/govaluate v3.0.0+incompatible github.com/disintegration/imaging v1.6.2 - github.com/fyne-io/image v0.0.0-20221020213044-f609c6a24345 // indirect + github.com/fyne-io/image v0.0.0-20221020213044-f609c6a24345 github.com/godbus/dbus/v5 v5.1.0 github.com/jackmordaunt/icns v1.0.1-0.20200413110149-9e181b441ab2 github.com/mafik/pulseaudio v0.0.0-20200511091429-8449222912dd @@ -20,20 +20,23 @@ require ( require ( fyne.io/systray v1.10.1-0.20231230205326-d160fd363db9 // indirect + github.com/ActiveState/termtest/conpty v0.5.0 // indirect + github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298 // indirect github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966 // indirect + github.com/creack/pty v1.1.11 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fredbi/uri v1.1.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe // indirect github.com/fyne-io/glfw-js v0.0.0-20240101223322-6e1efdc71b7a // indirect + github.com/fyne-io/terminal v0.0.0-20240206170039-2e129cdfd85f github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect github.com/go-gl/glfw/v3.3/glfw v0.0.0-20231223183121-56fa3ac82ce7 // indirect github.com/go-text/render v0.0.0-20230619120952-35bccb6164b8 // indirect github.com/go-text/typesetting v0.0.0-20230616162802-9c17dd34aa4a // indirect github.com/gopherjs/gopherjs v1.17.2 // indirect github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e // indirect - github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect github.com/pkg/errors v0.8.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c // indirect @@ -44,7 +47,6 @@ require ( golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect - gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect ) diff --git a/go.sum b/go.sum index 25d39d01..40309ead 100644 --- a/go.sum +++ b/go.sum @@ -41,6 +41,10 @@ fyne.io/fyne/v2 v2.4.3 h1:v2wncjEAcwXZ8UNmTCWTGL9+sGyPc5RuzBvM96GcC78= fyne.io/fyne/v2 v2.4.3/go.mod h1:1h3BKxmQYRJlr2g+RGVxedzr6vLVQ/AJmFWcF9CJnoQ= fyne.io/systray v1.10.1-0.20231230205326-d160fd363db9 h1:E/gHmMVyk8TuI6JIgNIv/Qu1JABMVFBIkQ8lYRa5gkQ= fyne.io/systray v1.10.1-0.20231230205326-d160fd363db9/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs= +github.com/ActiveState/termtest/conpty v0.5.0 h1:JLUe6YDs4Jw4xNPCU+8VwTpniYOGeKzQg4SM2YHQNA8= +github.com/ActiveState/termtest/conpty v0.5.0/go.mod h1:LO4208FLsxw6DcNZ1UtuGUMW+ga9PFtX4ntv8Ymg9og= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298 h1:1qlsVAQJXZHsaM8b6OLVo6muQUQd4CwkH/D3fnnbHXA= github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298/go.mod h1:D+QujdIlUNfa0igpNMk6UIvlb6C252URs4yupRUV4lQ= github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966 h1:lTG4HQym5oPKjL7nGs+csTgiDna685ZXjxijkne828g= @@ -70,6 +74,8 @@ github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnht github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -96,6 +102,8 @@ github.com/fyne-io/glfw-js v0.0.0-20240101223322-6e1efdc71b7a h1:ybgRdYvAHTn93HW github.com/fyne-io/glfw-js v0.0.0-20240101223322-6e1efdc71b7a/go.mod h1:gsGA2dotD4v0SR6PmPCYvS9JuOeMwAtmfvDE7mbYXMY= github.com/fyne-io/image v0.0.0-20221020213044-f609c6a24345 h1:ONkcbJmsWUOHyjUm0wlnkFc/uaacFFtStVbsG6qJfew= github.com/fyne-io/image v0.0.0-20221020213044-f609c6a24345/go.mod h1:eO7W361vmlPOrykIg+Rsh1SZ3tQBaOsfzZhsIOb/Lm0= +github.com/fyne-io/terminal v0.0.0-20240206170039-2e129cdfd85f h1:i+TynW/8eeknoct3S234fwOLIwobeD2ujxVo3jgpIjA= +github.com/fyne-io/terminal v0.0.0-20240206170039-2e129cdfd85f/go.mod h1:H0b/BtaKEdivaCBKKPIiTEVPt9yG7rLJCj2AR49hi8M= github.com/fyne-io/xgbutil v0.0.0-20191220152344-7d838166824d h1:8+poQtDqiRfAZmeyYRlInuaIBsQEflmxtpJeZklvNuE= github.com/fyne-io/xgbutil v0.0.0-20191220152344-7d838166824d/go.mod h1:vPqYMuTmTyrLNDQWQXy9lqdnV+WRQn6jhaSon8TppBs= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -245,7 +253,6 @@ github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -447,6 +454,7 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200428200454-593003d681fa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -647,7 +655,6 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/internal/ui/desk.go b/internal/ui/desk.go index 32d919b4..73830626 100644 --- a/internal/ui/desk.go +++ b/internal/ui/desk.go @@ -68,6 +68,11 @@ func (l *desktop) SetDesktop(id int) { fyne.NewAnimation(canvas.DurationStandard, func(f float32) { for i, item := range l.wm.Windows() { + // TODO move this to floating once we support them + if item.Properties().SkipTaskbar() { + continue + } + newX := starts[i].X + deltas[i].DX*f newY := starts[i].Y + deltas[i].DY*f diff --git a/internal/x11/win/client.go b/internal/x11/win/client.go index 7e8fefd2..de585cf4 100644 --- a/internal/x11/win/client.go +++ b/internal/x11/win/client.go @@ -211,6 +211,9 @@ func (c *client) Maximized() bool { } func (c *client) Move(pos fyne.Position) { + if c.frame == nil { + return + } screen := fynedesk.Instance().Screens().ScreenForWindow(c) targetX := int16(pos.X * screen.CanvasScale()) @@ -317,7 +320,19 @@ func (c *client) Position() fyne.Position { float32(c.frame.y)/screen.CanvasScale()) } +func (c *client) Resize(s fyne.Size) { + if c.frame == nil { + return + } + screen := fynedesk.Instance().Screens().ScreenForWindow(c) + + c.frame.updateGeometry(c.frame.x, c.frame.y, uint16(s.Width*screen.Scale), uint16(s.Height*screen.Scale), false) +} + func (c *client) Size() fyne.Size { + if c.frame == nil { + return fyne.Size{} + } screen := fynedesk.Instance().Screens().ScreenForWindow(c) return fyne.NewSize( diff --git a/internal/x11/wm/desk.go b/internal/x11/wm/desk.go index c047b93a..76247c8c 100644 --- a/internal/x11/wm/desk.go +++ b/internal/x11/wm/desk.go @@ -84,6 +84,7 @@ const ( keyCodeEscape = 9 keyCodeTab = 23 keyCodeReturn = 36 + keyCodeBacktick = 49 keyCodeAlt = 64 keyCodeSpace = 65 keyCodePrintScreen = 107 @@ -339,10 +340,12 @@ func (x *x11WM) keyNameToCode(n fyne.KeyName) xproto.Keycode { return keyCodeUp case fyne.KeyDown: return keyCodeDown - case deskDriver.KeyPrintScreen: - return keyCodePrintScreen case fyne.KeyTab: return keyCodeTab + case fyne.KeyBackTick: + return keyCodeBacktick + case deskDriver.KeyPrintScreen: + return keyCodePrintScreen case fynedesk.KeyBrightnessDown: return keyCodeBrightLess case fynedesk.KeyBrightnessUp: diff --git a/modules/desktops/pager.go b/modules/desktops/pager.go index 31dc2a19..e21dd8d1 100644 --- a/modules/desktops/pager.go +++ b/modules/desktops/pager.go @@ -87,7 +87,7 @@ func (p *pager) refreshFrom(oldID int) { for j := len(wins) - 1; j >= 0; j-- { win := wins[j] - if win.Iconic() { + if win.Iconic() || win.Properties().SkipTaskbar() { continue } diff --git a/modules/quaketerm/init.go b/modules/quaketerm/init.go new file mode 100644 index 00000000..b722e342 --- /dev/null +++ b/modules/quaketerm/init.go @@ -0,0 +1,7 @@ +package launcher + +import "fyshos.com/fynedesk" + +func init() { + fynedesk.RegisterModule(termMeta) +} diff --git a/modules/quaketerm/term.go b/modules/quaketerm/term.go new file mode 100644 index 00000000..7e3510d8 --- /dev/null +++ b/modules/quaketerm/term.go @@ -0,0 +1,164 @@ +package launcher + +import ( + "time" + + "fyshos.com/fynedesk" + "fyshos.com/fynedesk/internal/ui" + wmTheme "fyshos.com/fynedesk/theme" + "github.com/fyne-io/terminal" + + "fyne.io/fyne/v2" + "fyne.io/fyne/v2/canvas" + "fyne.io/fyne/v2/container" + "fyne.io/fyne/v2/driver/desktop" + "fyne.io/fyne/v2/theme" +) + +const ( + delay = time.Second / 25 + termTitle = "Quake Terminal " + ui.SkipTaskbarHint + height = 240 + step = 40 +) + +var termMeta = fynedesk.ModuleMetadata{ + Name: "\"Quake\" (hover) terminal", + NewInstance: newTerm, +} + +type term struct { + shown bool + win fynedesk.Window + ui fyne.Window +} + +func (t *term) Destroy() { +} + +func (t *term) Metadata() fynedesk.ModuleMetadata { + return termMeta +} + +func (t *term) Shortcuts() map[*fynedesk.Shortcut]func() { + return map[*fynedesk.Shortcut]func(){ + &fynedesk.Shortcut{Name: "Open Quake Terminal", KeyName: fyne.KeyBackTick, Modifier: fynedesk.UserModifier}: func() { + t.toggle() + }} +} + +func (t *term) createTerm() { + win := fyne.CurrentApp().Driver().(desktop.Driver).CreateSplashWindow() + win.SetTitle(termTitle) + + bg := canvas.NewRectangle(theme.BackgroundColor()) + img := canvas.NewImageFromResource(theme.NewDisabledResource(theme.ComputerIcon())) + img.FillMode = canvas.ImageFillContain + img.SetMinSize(fyne.NewSize(200, 200)) + over := canvas.NewRectangle(wmTheme.WidgetPanelBackground()) + matchTheme(bg, over) + + console := terminal.New() + win.SetContent(container.NewStack(bg, img, over, console)) + win.Canvas().Focus(console) + t.ui = win + + go func() { + err := console.RunLocalShell() + if err != nil { + fyne.LogError("Failed to open terminal", err) + } + t.hide() // terminal exited + + t.createTerm() // reset for next usage + }() +} + +func (t *term) getHandle() fynedesk.Window { + // TODO a better way to capture window frame without showing it and waiting... + //t.ui.Resize(fyne.NewSize(0, 0)) + t.ui.Show() + + i := 0 + for { + time.Sleep(time.Second / 50) + + for _, w := range fynedesk.Instance().WindowManager().Windows() { + if w.Properties().Title() == termTitle { + return w + } + } + + i++ + if i > 50 { + return nil // something went wrong + } + } +} + +func (t *term) hide() { + screen := fynedesk.Instance().Screens().Primary() + left := float32(screen.X) / screen.Scale + y := float32(screen.Y) / screen.Scale + end := float32(screen.Y)/screen.Scale - height + for y > end { + t.win.Move(fyne.NewPos(left, y)) + time.Sleep(delay) + y -= step + } + t.win.Move(fyne.NewPos(left, end)) + + t.ui.Hide() + t.shown = false +} + +func (t *term) show() { + screen := fynedesk.Instance().Screens().Primary() + t.win.Resize(fyne.NewSize(float32(screen.Width)/screen.Scale, height)) + // t.ui.Show() + t.win.RaiseToTop() + + left := float32(screen.X) / screen.Scale + y := float32(screen.Y)/screen.Scale - height + end := float32(screen.Y) / screen.Scale + for y < end { + t.win.Resize(fyne.NewSize(float32(screen.Width)/screen.Scale, height)) // force it ASAP + t.win.Move(fyne.NewPos(left, y)) + time.Sleep(delay) + y += step + } + t.win.Move(fyne.NewPos(left, end)) + t.shown = true +} + +func (t *term) toggle() { + if !t.shown { + t.win = t.getHandle() + + t.show() + } else { + t.hide() + t.win = nil + } +} + +func matchTheme(bg, over *canvas.Rectangle) { + ch := make(chan fyne.Settings) + go func() { + for { + <-ch + + bg.FillColor = theme.BackgroundColor() + bg.Refresh() + over.FillColor = wmTheme.WidgetPanelBackground() + over.Refresh() + } + }() + fyne.CurrentApp().Settings().AddChangeListener(ch) +} + +func newTerm() fynedesk.Module { + t := &term{} + t.createTerm() + return t +} diff --git a/test/window.go b/test/window.go index 29955cac..7ae6f133 100644 --- a/test/window.go +++ b/test/window.go @@ -82,7 +82,7 @@ func (w *Window) Maximized() bool { } // Move the window, does nothing in test windows -func (w *Window) Move(fyne.Position) {} +func (w *Window) Move(_ fyne.Position) {} // Parent returns a window that this should be positioned within, if set. func (w *Window) Parent() fynedesk.Window { @@ -94,6 +94,9 @@ func (w *Window) Position() fyne.Position { return fyne.NewPos(0, 0) } +// Resize the window, does nothing in test windows +func (w *Window) Resize(_ fyne.Size) {} + // Size returns 0x0 for test windows func (w *Window) Size() fyne.Size { return fyne.Size{} } diff --git a/window.go b/window.go index 47699e35..2d2188f4 100644 --- a/window.go +++ b/window.go @@ -32,6 +32,7 @@ type Window interface { Position() fyne.Position Size() fyne.Size Move(position fyne.Position) + Resize(fyne.Size) Desktop() int SetDesktop(int) From b09da75ba1a0a223e802f0c29f5b40f8279928a1 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Mon, 19 Feb 2024 21:35:29 +0000 Subject: [PATCH 2/3] Update to latest Fyne --- go.mod | 4 ++-- go.sum | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 507c6dcf..c22cf63b 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module fyshos.com/fynedesk go 1.17 require ( - fyne.io/fyne/v2 v2.4.3 + fyne.io/fyne/v2 v2.4.4 github.com/BurntSushi/xgb v0.0.0-20201008132610-5f9e7b3c49cd github.com/BurntSushi/xgbutil v0.0.0-20160919175755-f7c97cef3b4e github.com/FyshOS/backgrounds v0.0.0-20230616202904-0a8b6ebaa184 @@ -34,7 +34,7 @@ require ( github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect github.com/go-gl/glfw/v3.3/glfw v0.0.0-20231223183121-56fa3ac82ce7 // indirect github.com/go-text/render v0.0.0-20230619120952-35bccb6164b8 // indirect - github.com/go-text/typesetting v0.0.0-20230616162802-9c17dd34aa4a // indirect + github.com/go-text/typesetting v0.1.0 // indirect github.com/gopherjs/gopherjs v1.17.2 // indirect github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e // indirect github.com/pkg/errors v0.8.1 // indirect diff --git a/go.sum b/go.sum index 40309ead..3882efac 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -fyne.io/fyne/v2 v2.4.3 h1:v2wncjEAcwXZ8UNmTCWTGL9+sGyPc5RuzBvM96GcC78= -fyne.io/fyne/v2 v2.4.3/go.mod h1:1h3BKxmQYRJlr2g+RGVxedzr6vLVQ/AJmFWcF9CJnoQ= +fyne.io/fyne/v2 v2.4.4 h1:4efSRpoikcGbqQN83yzC9WmF8UNq9olsaJQ/Ejme6Z8= +fyne.io/fyne/v2 v2.4.4/go.mod h1:VyrxAOZ3NRZRWBvNIJbfqoKOG4DdbewoPk7ozqJKNPY= fyne.io/systray v1.10.1-0.20231230205326-d160fd363db9 h1:E/gHmMVyk8TuI6JIgNIv/Qu1JABMVFBIkQ8lYRa5gkQ= fyne.io/systray v1.10.1-0.20231230205326-d160fd363db9/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs= github.com/ActiveState/termtest/conpty v0.5.0 h1:JLUe6YDs4Jw4xNPCU+8VwTpniYOGeKzQg4SM2YHQNA8= @@ -116,9 +116,9 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20231223183121-56fa3ac82ce7 h1:7tf/0aw5Dx github.com/go-gl/glfw/v3.3/glfw v0.0.0-20231223183121-56fa3ac82ce7/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-text/render v0.0.0-20230619120952-35bccb6164b8 h1:VkKnvzbvHqgEfm351rfr8Uclu5fnwq8HP2ximUzJsBM= github.com/go-text/render v0.0.0-20230619120952-35bccb6164b8/go.mod h1:h29xCucjNsDcYb7+0rJokxVwYAq+9kQ19WiFuBKkYtc= -github.com/go-text/typesetting v0.0.0-20230616162802-9c17dd34aa4a h1:VjN8ttdfklC0dnAdKbZqGNESdERUxtE3l8a/4Grgarc= -github.com/go-text/typesetting v0.0.0-20230616162802-9c17dd34aa4a/go.mod h1:evDBbvNR/KaVFZ2ZlDSOWWXIUKq0wCOEtzLxRM8SG3k= -github.com/go-text/typesetting-utils v0.0.0-20230616150549-2a7df14b6a22 h1:LBQTFxP2MfsyEDqSKmUBZaDuDHN1vpqDyOZjcqS7MYI= +github.com/go-text/typesetting v0.1.0 h1:vioSaLPYcHwPEPLT7gsjCGDCoYSbljxoHJzMnKwVvHw= +github.com/go-text/typesetting v0.1.0/go.mod h1:d22AnmeKq/on0HNv73UFriMKc4Ez6EqZAofLhAzpSzI= +github.com/go-text/typesetting-utils v0.0.0-20231211103740-d9332ae51f04 h1:zBx+p/W2aQYtNuyZNcTfinWvXBQwYtDfme051PR/lAY= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= From 4cb19e0ac8c0eef7e8559d252e9b51d020d1d33d Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 20 Feb 2024 09:01:40 +0000 Subject: [PATCH 3/3] Don't load the UI if the terminal is not used --- modules/quaketerm/term.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/quaketerm/term.go b/modules/quaketerm/term.go index 7e3510d8..f24886cb 100644 --- a/modules/quaketerm/term.go +++ b/modules/quaketerm/term.go @@ -132,6 +132,10 @@ func (t *term) show() { } func (t *term) toggle() { + if t.ui == nil { + t.createTerm() // lazy load UI + } + if !t.shown { t.win = t.getHandle() @@ -158,7 +162,6 @@ func matchTheme(bg, over *canvas.Rectangle) { } func newTerm() fynedesk.Module { - t := &term{} - t.createTerm() - return t + // don't load UI until it is first called on + return &term{} }