Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion desktop/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ require (
github.com/godbus/dbus/v5 v5.2.2 // indirect
)

replace github.com/vivaui/viva => github.com/Lithe-IDEA/viva v0.6.7-0.20261121064427-ecc66fc55042
replace github.com/vivaui/viva => github.com/Lithe-IDEA/viva v0.6.7-0.20261123062230-3c6c46081fe6
4 changes: 2 additions & 2 deletions desktop/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/Lithe-IDEA/viva v0.6.7-0.20261121064427-ecc66fc55042 h1:OCMipbo7UxizI9qLawOemmDPxO4e/LTO/Q+GyqzetUQ=
github.com/Lithe-IDEA/viva v0.6.7-0.20261121064427-ecc66fc55042/go.mod h1:e9In6+J77G7B9ow4enZ2FSOFh7U3q4cQ5iJr3Qn/Olk=
github.com/Lithe-IDEA/viva v0.6.7-0.20261123062230-3c6c46081fe6 h1:w1ZfpHUsHEdY/rlQspiZcAAHsNcIEDH0iQ/NvPzVTJ4=
github.com/Lithe-IDEA/viva v0.6.7-0.20261123062230-3c6c46081fe6/go.mod h1:e9In6+J77G7B9ow4enZ2FSOFh7U3q4cQ5iJr3Qn/Olk=
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ=
Expand Down
2 changes: 1 addition & 1 deletion desktop/internal/logwindow/toolbar.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ func (w *window) rangeEditor(c ui.C, anchor ui.Box) {
w.rangeEnd = end.Format(toolbarTimeFormat)
}
spec := ui.PopoverSpec{Width: toolbarRangeWidth, Align: ui.Start, Offset: toolbarMenuGap}
ui.PopoverWith(c, anchor, spec, &w.menus.timeRange, func() {
ui.PopoverWith(c, anchor, &w.menus.timeRange, spec, func() {
start, startOK := parseRangeTime(w.rangeStart)
end, endOK := parseRangeTime(w.rangeEnd)
readable := startOK && endOK
Expand Down
2 changes: 1 addition & 1 deletion desktop/internal/logwindow/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func (w *window) title(c ui.C) {
if w.model.directory != "" {
title = abbreviateHome(filepath.Join(w.model.directory, w.model.currentSessionPath))
}
leading, trailing := app.TitlebarInsets()
leading, trailing := c.TitlebarInsets()
ui.Stack(c).FillWidth().Height(titleHeight).Shrink(0).Background(w.pal.bg3).MovesWindow().Children(func() {
// The system's window buttons sit at the leading end, so the title keeps clear of
// them on that side and is centered in what is left.
Expand Down
2 changes: 1 addition & 1 deletion desktop/internal/settingswindow/plugin_region_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func (s regionSettings) toolPicker(c ui.C, row ui.Box, language i18n.Language, s
title = i18n.Shared(language, "desktop.buildSettings.optionsProject")
}
spec := ui.PopoverSpec{Align: ui.Start, Width: toolPickerWidth, ConsumeOutsidePress: true, Title: title}
ui.PopoverWith(c, row, spec, open, func() {
ui.PopoverWith(c, row, open, spec, func() {
before := scope.wanted(tool.ID)
current := toolchainCurrent(tool)
ui.Scroll(c.Part("choices")).Scrollbars().FillWidth().MaxHeight(toolPickerMaxHeight).Children(func() {
Expand Down
3 changes: 1 addition & 2 deletions desktop/internal/settingswindow/window_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/1lck/Lithe-IDEA/desktop/internal/fontprefs"
"github.com/1lck/Lithe-IDEA/desktop/internal/i18n"
"github.com/1lck/Lithe-IDEA/desktop/internal/icons"
"github.com/vivaui/viva/app"
"github.com/vivaui/viva/gfx"
"github.com/vivaui/viva/ui"
)
Expand Down Expand Up @@ -77,7 +76,7 @@ func (w *window) keys(c ui.C) {

// title keeps the native window title beside the system controls.
func (w *window) title(c ui.C) {
leading, trailing := app.TitlebarInsets()
leading, trailing := c.TitlebarInsets()
ui.Stack(c).FillWidth().Height(titleHeight).Shrink(0).Background(w.pal.titleBar).MovesWindow().Children(func() {
ui.Row(c).Fill().PadSides(0, max(8, trailing), 0, max(80, leading+10)).Items(ui.Center).Children(func() {
ui.Text(c, w.text.Settings.Title).FontSize(13).Weight(gfx.WeightSemibold).Color(w.pal.text).Ellipsis()
Expand Down
4 changes: 2 additions & 2 deletions desktop/internal/workbench/branch_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func branchInset(depth int) float32 { return chromeEdge + float32(depth)*branchI
func (a *App) drawBranchPopup(c ui.C, p *project, anchor ui.Box) {
b, t := &a.branch, a.text.Branch
spec := ui.PopoverSpec{Align: ui.Start, Offset: chromeMenuOffset, Width: branchPopupWidth, ConsumeOutsidePress: true}
ui.PopoverWith(c, anchor, spec, &b.open, func() {
ui.PopoverWith(c, anchor, &b.open, spec, func() {
ui.Column(c).FillWidth().MaxHeight(branchPopupMaxHeight).Gap(chromeMenuItems).Children(func() {
a.drawBranchPanel(c, p, t)
})
Expand Down Expand Up @@ -199,7 +199,7 @@ func (a *App) drawWorkspaceBranchRepo(c ui.C, p *project, t i18n.BranchMessages,
// The press that closes the panel goes on to the popup, so a click on another repository opens
// that one's panel at once.
spec := ui.PopoverSpec{Side: components.PopoverRight, Align: ui.Start, Offset: chromeMenuOffset, Width: branchPopupWidth}
ui.PopoverWith(c, row, spec, &b.repoOpen, func() {
ui.PopoverWith(c, row, &b.repoOpen, spec, func() {
ui.Column(c).FillWidth().MaxHeight(branchPopupMaxHeight).Gap(chromeMenuItems).Children(func() {
if a.drawBranchActions(c, p, b.currentReference(), query, false) {
ui.Divider(c)
Expand Down
15 changes: 5 additions & 10 deletions desktop/internal/workbench/chrome_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import (
"github.com/1lck/Lithe-IDEA/desktop/internal/core"
"github.com/1lck/Lithe-IDEA/desktop/internal/i18n"
"github.com/1lck/Lithe-IDEA/desktop/internal/icons"
"github.com/vivaui/viva/app"
"github.com/vivaui/viva/components"
"github.com/vivaui/viva/gfx"
"github.com/vivaui/viva/ui"
"runtime"
"slices"
)

Expand Down Expand Up @@ -130,12 +128,9 @@ func (a *App) chromeGlyph(c ui.C, i int, layout glyphLayout, rest, hover gfx.Col
// controls in it take their own presses.
func (a *App) titleBar(c ui.C) {
// The system's window buttons sit at one end of the strip, so the content keeps clear of
// them.
leading, trailing := app.TitlebarInsets()
if a.fullscreen && runtime.GOOS == "darwin" {
// macOS hides the traffic lights in fullscreen; the strip starts at the edge.
leading = 0
}
// them. The window answers for itself: zero in full screen, where macOS hides the
// traffic lights, and under a system titlebar.
leading, trailing := c.TitlebarInsets()
clicked := -1
ui.Row(c).FillWidth().Height(titleBarHeight).Shrink(0).Background(a.chromeFill()).
Items(ui.Center).Gap(chromeGap).PadSides(0, trailing+chromeEdge, 0, leading+chromeEdge).
Expand Down Expand Up @@ -450,7 +445,7 @@ func (a *App) hiddenToolWindowList(c ui.C, anchor ui.Box, z zone) {
if z != zoneLeftTop && z != zoneRightTop {
spec.Align = ui.End
}
ui.PopoverWith(c, anchor, spec, &open, func() {
ui.PopoverWith(c, anchor, &open, spec, func() {
ui.Column(c).FillWidth().Gap(chromeMenuItems).Children(func() {
for _, i := range a.chrome.hidden {
row, clicked := a.hiddenToolWindowRow(c.KeyInt(i), i)
Expand Down Expand Up @@ -634,7 +629,7 @@ func (a *App) projectMenu(c ui.C, anchor ui.Box) {
picked, removed := -1, -1
spec := ui.PopoverSpec{Align: ui.Start, Offset: chromeMenuOffset, Width: chromeMenuWidth, ConsumeOutsidePress: true}
open := true
ui.PopoverWith(c, anchor, spec, &open, func() {
ui.PopoverWith(c, anchor, &open, spec, func() {
ui.Scroll(c).Scrollbars().FillWidth().MaxHeight(chromeMenuMaxHeight).Gap(chromeMenuItems).Children(func() {
created = a.menuAction(c.Part("new"), icons.Plus, a.text.Title.NewProjectItem)
chosen = a.menuAction(c.Part("open"), icons.FolderOpen, a.text.Title.OpenItem)
Expand Down
2 changes: 1 addition & 1 deletion desktop/internal/workbench/commit_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func (a *App) drawCommitOptions(c ui.C, cs *commitState, generates bool) {
// they belong to; they line up with the gear at the bottom and grow upwards, and open on
// the left when the panel is docked at the window's right edge.
spec := ui.PopoverSpec{Side: components.PopoverRight, Align: ui.End, Width: 320}
ui.PopoverWith(c, button, spec, &cs.optionsOpen, func() {
ui.PopoverWith(c, button, &cs.optionsOpen, spec, func() {
ui.Column(c).FillWidth().Gap(8).Children(func() {
a.commitOptionHeading(c, i18n.Shared(lang, "desktop.commit.optionsGit"))
ui.Row(c).FillWidth().Items(ui.Center).Gap(4).Children(func() {
Expand Down
2 changes: 1 addition & 1 deletion desktop/internal/workbench/gitlog_popover_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (a *App) drawLogPopover(c ui.C, p *project, which logPopover, anchor ui.Box
}
open := true
spec := ui.PopoverSpec{Align: ui.Start, Offset: 4, Width: width, ConsumeOutsidePress: true}
ui.PopoverWith(c, anchor, spec, &open, func() {
ui.PopoverWith(c, anchor, &open, spec, func() {
switch l.popover {
case logPopoverBranch:
a.drawLogBranchFilter(c, p)
Expand Down
2 changes: 1 addition & 1 deletion desktop/internal/workbench/markdown_preview.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func (a *App) markdownContentsButton(c ui.C, p *project, d *document) {
top = min(top, h.level)
}
spec := ui.PopoverSpec{Align: ui.End, Width: markdownContentsWidth, ConsumeOutsidePress: true, Title: title}
ui.PopoverWith(c, button, spec, &s.contentsOpen, func() {
ui.PopoverWith(c, button, &s.contentsOpen, spec, func() {
height := min(float32(len(s.headings))*markdownContentsRow, markdownContentsMax)
ui.List(c, &s.contents, len(s.headings), func(row ui.ListRow) {
h := s.headings[row.Index]
Expand Down
2 changes: 1 addition & 1 deletion desktop/internal/workbench/memory_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ func (a *App) memoryDetails(c ui.C, anchor ui.Box) {
c.Canvas().RequestFrameIn(memoryDetailInterval)
language := a.language()
spec := ui.PopoverSpec{Side: components.PopoverTop, Align: ui.End, Offset: chromeMenuOffset, Width: memoryPanelWidth, ConsumeOutsidePress: true}
ui.PopoverWith(c.Key("memoryDetails"), anchor, spec, &m.open, func() {
ui.PopoverWith(c.Key("memoryDetails"), anchor, &m.open, spec, func() {
ui.Column(c).FillWidth().Gap(memorySectionGap).Children(func() {
a.memoryHeader(c, language)
switch {
Expand Down
2 changes: 1 addition & 1 deletion desktop/internal/workbench/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func (a *App) notificationPanel(c ui.C, anchor ui.Box) {
align = ui.Start
}
spec := ui.PopoverSpec{Side: components.PopoverTop, Align: align, Offset: chromeMenuOffset, Width: notificationPanelWidth, ConsumeOutsidePress: true}
ui.PopoverWith(c, anchor, spec, &center.open, func() {
ui.PopoverWith(c, anchor, &center.open, spec, func() {
ui.Row(c).FillWidth().Height(28).Items(ui.Center).Gap(8).Children(func() {
ui.Text(c, i18n.Shared(language, "desktop.notifications.title")).Weight(gfx.WeightSemibold).Grow(1).Ellipsis()
a.notificationClearButton(c)
Expand Down
10 changes: 3 additions & 7 deletions desktop/internal/workbench/project_gradient.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package workbench

import (
"runtime"

"github.com/vivaui/viva/app"
"github.com/vivaui/viva/gfx"
)

Expand Down Expand Up @@ -60,10 +57,9 @@ func (a *App) paintProjectGradient(canvas *gfx.Canvas, bounds gfx.Rect) {
rgb = projectGradientDark[index]
}
peak := gfx.RGB24(rgb)
leading, _ := app.TitlebarInsets()
if a.fullscreen && runtime.GOOS == "darwin" {
leading = 0
}
// The canvas answers for the window it paints: zero in full screen and under a
// system titlebar, where the buttons are not on the strip.
leading, _ := canvas.TitlebarInsets()
anchor := leading + projectGradientAnchor
width := min(anchor+projectGradientWidth, bounds.Width)
if width <= 0 {
Expand Down
4 changes: 2 additions & 2 deletions desktop/internal/workbench/remote_host_files_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ func (a *App) remoteHostFilesPopup(c ui.C) {
ui.Stack(c.Part("remote-host-files-anchor")).Fill().Children(func() {
anchor = ui.Row(c).Absolute().Left((bounds.Width - width) / 2).Top(84).Width(width).Height(1)
})
closed := ui.PopoverWith(c.Part("remote-host-files"), anchor, ui.PopoverSpec{
closed := ui.PopoverWith(c.Part("remote-host-files"), anchor, &f.open, ui.PopoverSpec{
Width: width, Offset: 1, Align: ui.Start, KeepOpenOnAnchor: true,
}, &f.open, func() {
}, func() {
ui.Column(c).FillWidth().Height(height).Gap(8).Children(func() {
ui.Row(c).FillWidth().Items(ui.Center).Gap(8).Children(func() {
ui.Text(c, i18n.Shared(language, "desktop.remote.hostFile.title")).Bold().Shrink(0)
Expand Down
6 changes: 3 additions & 3 deletions desktop/internal/workbench/search_everywhere_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func (a *App) everywherePopup(c ui.C) {
ui.Stack(c).Fill().Children(func() {
anchor = ui.Row(c).Absolute().Left((bounds.Width - width) / 2).Top(84).Width(width).Height(1)
})
closed := ui.PopoverWith(c, anchor, ui.PopoverSpec{
closed := ui.PopoverWith(c, anchor, &v.open, ui.PopoverSpec{
Width: width, Offset: 1, Align: ui.Start, KeepOpenOnAnchor: true,
}, &v.open, func() {
}, func() {
ui.Column(c).FillWidth().Height(height).Gap(8).Children(func() {
if p.everywhereActionsOnly() {
ui.Text(c, i18n.Shared(language, "desktop.everywhere.actions")).Bold()
Expand Down Expand Up @@ -229,7 +229,7 @@ func (a *App) everywhereFilter(c ui.C, p *project, language i18n.Language) {
if button.Clicked() {
v.filterOpen = !v.filterOpen
}
ui.PopoverWith(c, button, ui.PopoverSpec{Align: ui.End, Width: 300}, &v.filterOpen, func() {
ui.PopoverWith(c, button, &v.filterOpen, ui.PopoverSpec{Align: ui.End, Width: 300}, func() {
option := func(label, action string, value *bool) {
before := *value
ui.Checkbox(c, value, label)
Expand Down
2 changes: 1 addition & 1 deletion desktop/internal/workbench/search_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (a *App) searchOptions(c ui.C, language i18n.Language) {
if button.Clicked() {
v.optionsOpen = !v.optionsOpen
}
ui.PopoverWith(c, button, ui.PopoverSpec{Align: ui.End, Width: 300}, &v.optionsOpen, func() {
ui.PopoverWith(c, button, &v.optionsOpen, ui.PopoverSpec{Align: ui.End, Width: 300}, func() {
option := func(label, action string, value *bool) {
before := *value
ui.Checkbox(c, value, label)
Expand Down
2 changes: 1 addition & 1 deletion desktop/internal/workbench/standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (a *App) standaloneWorkbench(c ui.C) {
plan := a.layout.arrange(c.Bounds(), open)
hidden := slotCount
language := a.language()
leading, trailing := app.TitlebarInsets()
leading, trailing := c.TitlebarInsets()
ui.Column(c).Fill().Children(func() {
ui.Row(c).FillWidth().Height(titleBarHeight).Shrink(0).Items(ui.Center).Gap(8).
PadSides(0, trailing+chromeEdge, 0, leading+chromeEdge).MovesWindow().Children(func() {
Expand Down
2 changes: 1 addition & 1 deletion desktop/internal/workbench/tabstrip.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ func (a *App) hiddenTabsButton(c ui.C, place *groupPlace, s *tabStrip, tabs []sh
wasOpen := s.menu
if s.menu {
spec := ui.PopoverSpec{Align: ui.End, Offset: chromeMenuOffset, Width: tabMenuWidth, ConsumeOutsidePress: true}
ui.PopoverWith(c, button, spec, &s.menu, func() {
ui.PopoverWith(c, button, &s.menu, spec, func() {
ui.Scroll(c.Part("hidden")).Scrollbars().FillWidth().MaxHeight(tabMenuMaxHeight).Gap(chromeMenuItems).Children(func() {
for _, member := range s.hidden {
i := slices.IndexFunc(tabs, func(t shownTab) bool { return t.member() == member })
Expand Down
4 changes: 2 additions & 2 deletions desktop/internal/workbench/welcome_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (a *App) welcomePanel(c ui.C) {
// The macOS welcome title sits after the traffic lights; the workbench hides it.
title := ui.Row(c).Absolute().Top(0).Right(0)
if runtime.GOOS == "darwin" {
leading, _ := app.TitlebarInsets()
leading, _ := c.TitlebarInsets()
title.Left(max(84, leading+10)).Height(32).Items(ui.Center)
} else {
title.Left(0).Height(titleBarHeight).Center()
Expand All @@ -50,7 +50,7 @@ func (a *App) welcomePanel(c ui.C) {
})
// The update arrow sits at the top right, as on the workbench's title bar, clear of the
// system's window buttons where they are on that side.
_, trailing := app.TitlebarInsets()
_, trailing := c.TitlebarInsets()
ui.Row(c).Absolute().Top(0).Right(trailing + chromeEdge).Height(titleBarHeight).Items(ui.Center).Children(func() {
a.updateArrow(c)
})
Expand Down
2 changes: 1 addition & 1 deletion desktop/internal/workbench/workbench_background.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ func (a *App) backgroundPopover(c ui.C, anchor ui.Box) {
picked := strength
spec := ui.PopoverSpec{Side: components.PopoverLeft, Align: ui.End, Width: 320, ConsumeOutsidePress: true}
open := true
ui.PopoverWith(c.Key("workbenchBackground"), anchor, spec, &open, func() {
ui.PopoverWith(c.Key("workbenchBackground"), anchor, &open, spec, func() {
ui.Column(c).Gap(8).FillWidth().Children(func() {
ui.Row(c).FillWidth().Items(ui.Center).Gap(6).Children(func() {
ui.Icon(c, icons.Image).Size(14, 14).Color(a.colors.Subtle)
Expand Down
Loading