diff --git a/desktop/internal/i18n/shared.generated.go b/desktop/internal/i18n/shared.generated.go index c9654a1e8f..3be67d385f 100644 --- a/desktop/internal/i18n/shared.generated.go +++ b/desktop/internal/i18n/shared.generated.go @@ -1497,6 +1497,7 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.tools.dragHint": "Drag to move elsewhere", "desktop.tools.moveTo": "Move to", "desktop.tools.structure": "Structure", + "desktop.tools.withShortcut": "{name} {keys}", "desktop.updates.available": "Lithe {version} is available. Open Settings > Updates to install it.", "desktop.vcs.commitDirectly": "Commits are sent to the repository right away; there is no separate push.", "desktop.viewer.actualSize": "Actual Size", @@ -3945,6 +3946,7 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.tools.dragHint": "可拖动到其他位置", "desktop.tools.moveTo": "移动到", "desktop.tools.structure": "结构", + "desktop.tools.withShortcut": "{name} {keys}", "desktop.updates.available": "Lithe {version} 已发布,可在“设置 > 更新”中安装。", "desktop.vcs.commitDirectly": "提交会立即发送到仓库,没有单独的推送步骤。", "desktop.viewer.actualSize": "实际大小", diff --git a/desktop/internal/toolicons/NOTICE b/desktop/internal/toolicons/NOTICE new file mode 100644 index 0000000000..6673a1fe11 --- /dev/null +++ b/desktop/internal/toolicons/NOTICE @@ -0,0 +1,16 @@ +Tool window stripe icons of the Lithe desktop client. + +The SVGs in svg/ are IntelliJ Platform Community New UI tool window icons, downloaded byte for +byte from the JetBrains IntelliJ Platform Community repository +(https://github.com/JetBrains/intellij-community) at revision +c7f91397daa3a961b4e78bc634fe467a0a7d9ade. Copyright 2000-2025 JetBrains s.r.o. and contributors; +distributed under the Apache License 2.0, see ../fileicons/LICENSE-APACHE-2.0.txt. + +- build, commit, debug, find, notifications, problems, project, run, services, structure and + vcs @20x20.svg: platform/icons/src/expui/toolwindows/. +- terminal@20x20.svg: plugins/terminal/resources/icons/expui/toolwindow/. + +Only the light variants are kept: each @20x20_dark.svg draws the same shapes in another color, +and Lithe tints these icons itself. scripts/desktop/generate-desktop-file-icons.sh turns their +strokes into fills, unions the shapes of each icon into one path and drops the color, so the +compiled icons keep the geometry only. diff --git a/desktop/internal/toolicons/doc.go b/desktop/internal/toolicons/doc.go new file mode 100644 index 0000000000..d4138c2646 --- /dev/null +++ b/desktop/internal/toolicons/doc.go @@ -0,0 +1,10 @@ +// Package toolicons holds the IntelliJ New UI tool window icons the tool stripes of the Lithe +// desktop client draw, compiled into gfx.Icon values by +// scripts/desktop/generate-desktop-file-icons.sh. +// +// Each icon is one filled shape in a 20 point view box with no color of its own, so the +// stripe tints it like a Lucide icon: grey at rest, the text color under the pointer and the +// primary foreground on an open window's button. icons.go is generated: do not edit it. To add +// or change an icon, put the unmodified IntelliJ SVG in svg/, record its source in NOTICE and +// run the script again. +package toolicons diff --git a/desktop/internal/toolicons/icons.go b/desktop/internal/toolicons/icons.go new file mode 100644 index 0000000000..94534c2656 --- /dev/null +++ b/desktop/internal/toolicons/icons.go @@ -0,0 +1,597 @@ +// Code generated by viva icons. DO NOT EDIT. +// Tool window stripe icons of the Lithe desktop client. +// +// The SVGs in svg/ are IntelliJ Platform Community New UI tool window icons, downloaded byte for +// byte from the JetBrains IntelliJ Platform Community repository +// (https://github.com/JetBrains/intellij-community) at revision +// c7f91397daa3a961b4e78bc634fe467a0a7d9ade. Copyright 2000-2025 JetBrains s.r.o. and contributors; +// distributed under the Apache License 2.0, see ../fileicons/LICENSE-APACHE-2.0.txt. +// +// - build, commit, debug, find, notifications, problems, project, run, services, structure and +// vcs @20x20.svg: platform/icons/src/expui/toolwindows/. +// - terminal@20x20.svg: plugins/terminal/resources/icons/expui/toolwindow/. +// +// Only the light variants are kept: each @20x20_dark.svg draws the same shapes in another color, +// and Lithe tints these icons itself. scripts/desktop/generate-desktop-file-icons.sh turns their +// strokes into fills, unions the shapes of each icon into one path and drops the color, so the +// compiled icons keep the geometry only. + +package toolicons + +import "github.com/vivaui/viva/gfx" + +// build is a compiled vector icon. +var Build = gfx.Icon{ + ViewBox: 20.0, + Stroke: 0.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Commands: []gfx.PathCommand{ + gfx.MoveTo(4.25, 1.0), + gfx.CubicTo(4.449, 1.0, 4.64, 1.079, 4.78, 1.22), + gfx.LineTo(5.561, 2.0), + gfx.LineTo(6.439, 2.0), + gfx.LineTo(7.22, 1.22), + gfx.LineTo(7.334, 1.126), + gfx.CubicTo(7.456, 1.044, 7.601, 1.0, 7.75, 1.0), + gfx.LineTo(13.125, 1.0), + gfx.CubicTo(14.947, 1.0, 16.428, 1.88, 17.435, 3.081), + gfx.CubicTo(18.432, 4.271, 19.0, 5.815, 19.0, 7.25), + gfx.CubicTo(19.0, 7.517, 18.857, 7.764, 18.626, 7.898), + gfx.CubicTo(18.395, 8.032, 18.11, 8.034, 17.878, 7.901), + gfx.LineTo(15.426, 6.5), + gfx.LineTo(14.061, 6.5), + gfx.LineTo(13.0, 7.561), + gfx.LineTo(13.0, 18.25), + gfx.CubicTo(13.0, 18.664, 12.664, 19.0, 12.25, 19.0), + gfx.LineTo(7.75, 19.0), + gfx.CubicTo(7.336, 19.0, 7.0, 18.664, 7.0, 18.25), + gfx.LineTo(7.0, 7.561), + gfx.LineTo(6.439, 7.0), + gfx.LineTo(5.561, 7.0), + gfx.LineTo(4.78, 7.78), + gfx.CubicTo(4.64, 7.921, 4.449, 8.0, 4.25, 8.0), + gfx.LineTo(1.75, 8.0), + gfx.CubicTo(1.336, 8.0, 1.0, 7.664, 1.0, 7.25), + gfx.LineTo(1.0, 1.75), + gfx.CubicTo(1.0, 1.336, 1.336, 1.0, 1.75, 1.0), + gfx.ClosePath(), + gfx.MoveTo(2.5, 6.5), + gfx.LineTo(3.939, 6.5), + gfx.LineTo(4.72, 5.72), + gfx.LineTo(4.834, 5.626), + gfx.CubicTo(4.956, 5.544, 5.101, 5.5, 5.25, 5.5), + gfx.LineTo(6.75, 5.5), + gfx.CubicTo(6.949, 5.5, 7.14, 5.579, 7.28, 5.72), + gfx.LineTo(8.061, 6.5), + gfx.LineTo(11.939, 6.5), + gfx.LineTo(13.22, 5.22), + gfx.LineTo(13.334, 5.126), + gfx.CubicTo(13.456, 5.044, 13.601, 5.0, 13.75, 5.0), + gfx.LineTo(15.625, 5.0), + gfx.CubicTo(15.755, 5.0, 15.884, 5.034, 15.997, 5.099), + gfx.LineTo(17.264, 5.822), + gfx.CubicTo(17.06, 5.192, 16.729, 4.574, 16.284, 4.044), + gfx.CubicTo(15.51, 3.12, 14.428, 2.5, 13.125, 2.5), + gfx.LineTo(8.061, 2.5), + gfx.LineTo(7.28, 3.28), + gfx.CubicTo(7.14, 3.421, 6.949, 3.5, 6.75, 3.5), + gfx.LineTo(5.25, 3.5), + gfx.CubicTo(5.051, 3.5, 4.86, 3.421, 4.72, 3.28), + gfx.LineTo(3.939, 2.5), + gfx.LineTo(2.5, 2.5), + gfx.ClosePath(), + gfx.MoveTo(8.5, 17.5), + gfx.LineTo(11.5, 17.5), + gfx.LineTo(11.5, 8.0), + gfx.LineTo(8.5, 8.0), + gfx.ClosePath(), + }, +} + +// commit is a compiled vector icon. +var Commit = gfx.Icon{ + ViewBox: 20.0, + Stroke: 0.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Commands: []gfx.PathCommand{ + gfx.MoveTo(19.25, 9.25), + gfx.CubicTo(19.664, 9.25, 20.0, 9.586, 20.0, 10.0), + gfx.CubicTo(20.0, 10.414, 19.664, 10.75, 19.25, 10.75), + gfx.LineTo(13.93, 10.75), + gfx.CubicTo(13.579, 12.601, 11.953, 14.0, 10.0, 14.0), + gfx.CubicTo(8.047, 14.0, 6.421, 12.601, 6.07, 10.75), + gfx.LineTo(0.75, 10.75), + gfx.CubicTo(0.336, 10.75, 0.0, 10.414, 0.0, 10.0), + gfx.CubicTo(0.0, 9.586, 0.336, 9.25, 0.75, 9.25), + gfx.LineTo(6.07, 9.25), + gfx.CubicTo(6.421, 7.399, 8.047, 6.0, 10.0, 6.0), + gfx.CubicTo(11.953, 6.0, 13.579, 7.399, 13.93, 9.25), + gfx.ClosePath(), + gfx.MoveTo(10.0, 12.5), + gfx.CubicTo(11.381, 12.5, 12.5, 11.381, 12.5, 10.0), + gfx.CubicTo(12.5, 8.619, 11.381, 7.5, 10.0, 7.5), + gfx.CubicTo(8.619, 7.5, 7.5, 8.619, 7.5, 10.0), + gfx.CubicTo(7.5, 11.381, 8.619, 12.5, 10.0, 12.5), + gfx.ClosePath(), + }, +} + +// debug is a compiled vector icon. +var Debug = gfx.Icon{ + ViewBox: 20.0, + Stroke: 0.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Commands: []gfx.PathCommand{ + gfx.MoveTo(1.5, 11.75), + gfx.CubicTo(1.086, 11.75, 0.75, 11.414, 0.75, 11.0), + gfx.CubicTo(0.75, 10.586, 1.086, 10.25, 1.5, 10.25), + gfx.LineTo(4.5, 10.25), + gfx.LineTo(4.5, 9.0), + gfx.QuadTo(4.5, 8.631, 4.558, 8.287), + gfx.LineTo(2.143, 6.988), + gfx.CubicTo(1.778, 6.791, 1.641, 6.337, 1.837, 5.972), + gfx.CubicTo(2.034, 5.607, 2.488, 5.47, 2.853, 5.666), + gfx.LineTo(5.102, 6.875), + gfx.QuadTo(5.34, 6.504, 5.672, 6.172), + gfx.QuadTo(6.075, 5.769, 6.536, 5.504), + gfx.CubicTo(6.512, 5.339, 6.5, 5.172, 6.5, 5.0), + gfx.CubicTo(6.5, 3.067, 8.067, 1.5, 10.0, 1.5), + gfx.CubicTo(11.933, 1.5, 13.5, 3.067, 13.5, 5.0), + gfx.CubicTo(13.5, 5.114, 13.495, 5.226, 13.484, 5.337), + gfx.QuadTo(14.558, 5.776, 15.06, 6.787), + gfx.LineTo(17.145, 5.666), + gfx.CubicTo(17.51, 5.47, 17.965, 5.607, 18.161, 5.972), + gfx.CubicTo(18.357, 6.337, 18.22, 6.791, 17.855, 6.988), + gfx.LineTo(15.464, 8.274), + gfx.QuadTo(15.5, 8.619, 15.5, 9.0), + gfx.LineTo(15.5, 10.25), + gfx.LineTo(18.5, 10.25), + gfx.CubicTo(18.914, 10.25, 19.25, 10.586, 19.25, 11.0), + gfx.CubicTo(19.25, 11.414, 18.914, 11.75, 18.5, 11.75), + gfx.LineTo(15.5, 11.75), + gfx.LineTo(15.5, 12.5), + gfx.QuadTo(15.5, 13.116, 15.382, 13.682), + gfx.LineTo(17.855, 15.012), + gfx.CubicTo(18.22, 15.209, 18.357, 15.663, 18.161, 16.028), + gfx.CubicTo(17.965, 16.393, 17.51, 16.53, 17.145, 16.334), + gfx.LineTo(14.861, 15.106), + gfx.QuadTo(14.485, 15.793, 13.889, 16.389), + gfx.QuadTo(12.278, 18.0, 10.0, 18.0), + gfx.QuadTo(7.722, 18.0, 6.111, 16.389), + gfx.QuadTo(5.515, 15.793, 5.139, 15.105), + gfx.LineTo(2.853, 16.334), + gfx.CubicTo(2.488, 16.53, 2.034, 16.393, 1.837, 16.028), + gfx.CubicTo(1.641, 15.663, 1.778, 15.209, 2.143, 15.012), + gfx.LineTo(4.617, 13.681), + gfx.QuadTo(4.5, 13.115, 4.5, 12.5), + gfx.LineTo(4.5, 11.75), + gfx.ClosePath(), + gfx.MoveTo(8.5, 6.5), + gfx.QuadTo(6.0, 6.5, 6.0, 9.0), + gfx.LineTo(6.0, 12.5), + gfx.QuadTo(6.0, 16.5, 10.0, 16.5), + gfx.QuadTo(11.657, 16.5, 12.828, 15.328), + gfx.QuadTo(14.0, 14.157, 14.0, 12.5), + gfx.LineTo(14.0, 9.0), + gfx.QuadTo(14.0, 6.5, 11.5, 6.5), + gfx.ClosePath(), + gfx.MoveTo(8.0, 5.028), + gfx.QuadTo(8.244, 5.0, 8.5, 5.0), + gfx.LineTo(11.5, 5.0), + gfx.QuadTo(11.758, 5.0, 12.0, 5.017), + gfx.LineTo(12.0, 5.0), + gfx.CubicTo(12.0, 3.895, 11.105, 3.0, 10.0, 3.0), + gfx.CubicTo(8.895, 3.0, 8.0, 3.895, 8.0, 5.0), + gfx.LineTo(8.0, 5.028), + gfx.ClosePath(), + }, +} + +// find is a compiled vector icon. +var Find = gfx.Icon{ + ViewBox: 20.0, + Stroke: 0.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Commands: []gfx.PathCommand{ + gfx.MoveTo(13.358, 14.478), + gfx.CubicTo(12.163, 15.431, 10.648, 16.0, 9.0, 16.0), + gfx.CubicTo(5.134, 16.0, 2.0, 12.866, 2.0, 9.0), + gfx.CubicTo(2.0, 5.134, 5.134, 2.0, 9.0, 2.0), + gfx.CubicTo(12.866, 2.0, 16.0, 5.134, 16.0, 9.0), + gfx.CubicTo(16.0, 10.648, 15.431, 12.163, 14.478, 13.358), + gfx.CubicTo(14.509, 13.381, 14.538, 13.406, 14.566, 13.434), + gfx.LineTo(18.566, 17.434), + gfx.CubicTo(18.878, 17.747, 18.878, 18.253, 18.566, 18.566), + gfx.CubicTo(18.253, 18.878, 17.747, 18.878, 17.434, 18.566), + gfx.LineTo(13.434, 14.566), + gfx.CubicTo(13.406, 14.538, 13.381, 14.509, 13.358, 14.478), + gfx.ClosePath(), + gfx.MoveTo(14.5, 9.0), + gfx.CubicTo(14.5, 5.962, 12.038, 3.5, 9.0, 3.5), + gfx.CubicTo(5.962, 3.5, 3.5, 5.962, 3.5, 9.0), + gfx.CubicTo(3.5, 12.038, 5.962, 14.5, 9.0, 14.5), + gfx.CubicTo(12.038, 14.5, 14.5, 12.038, 14.5, 9.0), + gfx.ClosePath(), + }, +} + +// notifications is a compiled vector icon. +var Notifications = gfx.Icon{ + ViewBox: 20.0, + Stroke: 0.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Commands: []gfx.PathCommand{ + gfx.MoveTo(4.0, 7.0), + gfx.QuadTo(4.0, 3.941, 6.062, 2.312), + gfx.QuadTo(7.725, 1.0, 10.0, 1.0), + gfx.QuadTo(12.275, 1.0, 13.938, 2.312), + gfx.QuadTo(16.0, 3.941, 16.0, 7.0), + gfx.LineTo(16.0, 10.0), + gfx.LineTo(18.136, 14.271), + gfx.QuadTo(18.433, 14.867, 18.083, 15.434), + gfx.QuadTo(17.733, 16.0, 17.067, 16.0), + gfx.LineTo(2.933, 16.0), + gfx.QuadTo(2.267, 16.0, 1.917, 15.434), + gfx.QuadTo(1.567, 14.867, 1.864, 14.271), + gfx.LineTo(4.0, 10.0), + gfx.ClosePath(), + gfx.MoveTo(5.342, 10.671), + gfx.LineTo(3.427, 14.5), + gfx.LineTo(16.573, 14.5), + gfx.LineTo(14.659, 10.671), + gfx.QuadTo(14.5, 10.354, 14.5, 10.0), + gfx.LineTo(14.5, 7.0), + gfx.QuadTo(14.5, 4.668, 13.008, 3.49), + gfx.QuadTo(11.754, 2.5, 10.0, 2.5), + gfx.QuadTo(8.246, 2.5, 6.992, 3.49), + gfx.QuadTo(5.5, 4.668, 5.5, 7.0), + gfx.LineTo(5.5, 10.0), + gfx.QuadTo(5.5, 10.354, 5.342, 10.671), + gfx.ClosePath(), + gfx.MoveTo(12.173, 17.0), + gfx.LineTo(11.841, 17.783), + gfx.QuadTo(11.689, 18.14, 11.414, 18.414), + gfx.QuadTo(10.828, 19.0, 10.0, 19.0), + gfx.QuadTo(9.172, 19.0, 8.586, 18.414), + gfx.QuadTo(8.311, 18.14, 8.16, 17.783), + gfx.LineTo(7.827, 17.0), + gfx.ClosePath(), + }, +} + +// problems is a compiled vector icon. +var Problems = gfx.Icon{ + ViewBox: 20.0, + Stroke: 0.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Commands: []gfx.PathCommand{ + gfx.MoveTo(10.0, 19.0), + gfx.QuadTo(6.272, 19.0, 3.636, 16.364), + gfx.QuadTo(1.0, 13.728, 1.0, 10.0), + gfx.QuadTo(1.0, 6.272, 3.636, 3.636), + gfx.QuadTo(6.272, 1.0, 10.0, 1.0), + gfx.QuadTo(13.728, 1.0, 16.364, 3.636), + gfx.QuadTo(19.0, 6.272, 19.0, 10.0), + gfx.QuadTo(19.0, 13.728, 16.364, 16.364), + gfx.QuadTo(13.728, 19.0, 10.0, 19.0), + gfx.ClosePath(), + gfx.MoveTo(10.0, 17.5), + gfx.QuadTo(13.107, 17.5, 15.303, 15.303), + gfx.QuadTo(17.5, 13.107, 17.5, 10.0), + gfx.QuadTo(17.5, 6.893, 15.303, 4.697), + gfx.QuadTo(13.107, 2.5, 10.0, 2.5), + gfx.QuadTo(6.893, 2.5, 4.697, 4.697), + gfx.QuadTo(2.5, 6.893, 2.5, 10.0), + gfx.QuadTo(2.5, 13.107, 4.697, 15.303), + gfx.QuadTo(6.893, 17.5, 10.0, 17.5), + gfx.ClosePath(), + gfx.MoveTo(11.0, 6.0), + gfx.LineTo(11.0, 10.0), + gfx.QuadTo(11.0, 10.414, 10.707, 10.707), + gfx.QuadTo(10.414, 11.0, 10.0, 11.0), + gfx.QuadTo(9.586, 11.0, 9.293, 10.707), + gfx.QuadTo(9.0, 10.414, 9.0, 10.0), + gfx.LineTo(9.0, 6.0), + gfx.QuadTo(9.0, 5.586, 9.293, 5.293), + gfx.QuadTo(9.586, 5.0, 10.0, 5.0), + gfx.QuadTo(10.414, 5.0, 10.707, 5.293), + gfx.QuadTo(11.0, 5.586, 11.0, 6.0), + gfx.ClosePath(), + gfx.MoveTo(10.0, 15.2), + gfx.CubicTo(9.337, 15.2, 8.8, 14.663, 8.8, 14.0), + gfx.CubicTo(8.8, 13.337, 9.337, 12.8, 10.0, 12.8), + gfx.CubicTo(10.663, 12.8, 11.2, 13.337, 11.2, 14.0), + gfx.CubicTo(11.2, 14.663, 10.663, 15.2, 10.0, 15.2), + gfx.ClosePath(), + }, +} + +// project is a compiled vector icon. +var Project = gfx.Icon{ + ViewBox: 20.0, + Stroke: 0.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Commands: []gfx.PathCommand{ + gfx.MoveTo(11.0, 5.0), + gfx.LineTo(17.0, 5.0), + gfx.QuadTo(17.828, 5.0, 18.414, 5.586), + gfx.QuadTo(19.0, 6.172, 19.0, 7.0), + gfx.LineTo(19.0, 15.167), + gfx.QuadTo(19.0, 17.5, 16.75, 17.5), + gfx.LineTo(3.25, 17.5), + gfx.QuadTo(1.0, 17.5, 1.0, 15.167), + gfx.LineTo(1.0, 4.833), + gfx.QuadTo(1.0, 2.5, 3.25, 2.5), + gfx.LineTo(7.638, 2.5), + gfx.QuadTo(8.0, 2.5, 8.278, 2.732), + gfx.ClosePath(), + gfx.MoveTo(10.04, 6.152), + gfx.LineTo(7.457, 4.0), + gfx.LineTo(3.25, 4.0), + gfx.QuadTo(2.5, 4.0, 2.5, 4.833), + gfx.LineTo(2.5, 15.167), + gfx.QuadTo(2.5, 16.0, 3.25, 16.0), + gfx.LineTo(16.75, 16.0), + gfx.QuadTo(17.5, 16.0, 17.5, 15.167), + gfx.LineTo(17.5, 7.0), + gfx.QuadTo(17.5, 6.5, 17.0, 6.5), + gfx.LineTo(10.457, 6.5), + gfx.ClosePath(), + }, +} + +// run is a compiled vector icon. +var Run = gfx.Icon{ + ViewBox: 20.0, + Stroke: 0.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Commands: []gfx.PathCommand{ + gfx.MoveTo(16.5, 11.732), + gfx.LineTo(6.0, 17.794), + gfx.QuadTo(5.0, 18.372, 4.0, 17.794), + gfx.QuadTo(3.0, 17.217, 3.0, 16.062), + gfx.LineTo(3.0, 3.938), + gfx.QuadTo(3.0, 2.783, 4.0, 2.206), + gfx.QuadTo(5.0, 1.628, 6.0, 2.206), + gfx.LineTo(16.5, 8.268), + gfx.QuadTo(17.5, 8.845, 17.5, 10.0), + gfx.QuadTo(17.5, 11.155, 16.5, 11.732), + gfx.ClosePath(), + gfx.MoveTo(15.75, 10.433), + gfx.QuadTo(16.0, 10.289, 16.0, 10.0), + gfx.QuadTo(16.0, 9.711, 15.75, 9.567), + gfx.LineTo(5.25, 3.505), + gfx.QuadTo(5.0, 3.36, 4.75, 3.505), + gfx.QuadTo(4.5, 3.649, 4.5, 3.938), + gfx.LineTo(4.5, 16.062), + gfx.QuadTo(4.5, 16.351, 4.75, 16.495), + gfx.QuadTo(5.0, 16.64, 5.25, 16.495), + gfx.ClosePath(), + }, +} + +// services is a compiled vector icon. +var Services = gfx.Icon{ + ViewBox: 20.0, + Stroke: 0.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Commands: []gfx.PathCommand{ + gfx.MoveTo(19.334, 9.1), + gfx.QuadTo(19.875, 10.0, 19.334, 10.9), + gfx.LineTo(15.434, 17.4), + gfx.QuadTo(14.925, 18.25, 13.934, 18.25), + gfx.LineTo(6.066, 18.25), + gfx.QuadTo(5.075, 18.25, 4.566, 17.4), + gfx.LineTo(0.666, 10.9), + gfx.QuadTo(0.125, 10.0, 0.666, 9.1), + gfx.LineTo(4.566, 2.6), + gfx.QuadTo(5.075, 1.75, 6.066, 1.75), + gfx.LineTo(13.934, 1.75), + gfx.QuadTo(14.925, 1.75, 15.434, 2.6), + gfx.ClosePath(), + gfx.MoveTo(18.048, 9.871), + gfx.LineTo(14.148, 3.371), + gfx.QuadTo(14.075, 3.25, 13.934, 3.25), + gfx.LineTo(6.066, 3.25), + gfx.QuadTo(5.925, 3.25, 5.852, 3.371), + gfx.LineTo(1.952, 9.871), + gfx.QuadTo(1.875, 10.0, 1.952, 10.129), + gfx.LineTo(5.852, 16.629), + gfx.QuadTo(5.925, 16.75, 6.066, 16.75), + gfx.LineTo(13.934, 16.75), + gfx.QuadTo(14.075, 16.75, 14.148, 16.629), + gfx.LineTo(18.048, 10.129), + gfx.QuadTo(18.125, 10.0, 18.048, 9.871), + gfx.ClosePath(), + gfx.MoveTo(14.5, 10.866), + gfx.LineTo(8.5, 14.33), + gfx.QuadTo(8.0, 14.619, 7.5, 14.33), + gfx.QuadTo(7.0, 14.042, 7.0, 13.464), + gfx.LineTo(7.0, 6.536), + gfx.QuadTo(7.0, 5.959, 7.5, 5.67), + gfx.QuadTo(8.0, 5.381, 8.5, 5.67), + gfx.LineTo(14.5, 9.134), + gfx.QuadTo(15.0, 9.423, 15.0, 10.0), + gfx.QuadTo(15.0, 10.577, 14.5, 10.866), + gfx.ClosePath(), + gfx.MoveTo(13.0, 10.0), + gfx.LineTo(8.5, 7.402), + gfx.LineTo(8.5, 12.598), + gfx.ClosePath(), + }, +} + +// structure is a compiled vector icon. +var Structure = gfx.Icon{ + ViewBox: 20.0, + Stroke: 0.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Commands: []gfx.PathCommand{ + gfx.MoveTo(2.75, 1.0), + gfx.CubicTo(3.164, 1.0, 3.5, 1.336, 3.5, 1.75), + gfx.LineTo(3.5, 4.0), + gfx.LineTo(6.0, 4.0), + gfx.LineTo(6.0, 3.0), + gfx.CubicTo(6.0, 1.895, 6.895, 1.0, 8.0, 1.0), + gfx.LineTo(16.0, 1.0), + gfx.CubicTo(17.105, 1.0, 18.0, 1.895, 18.0, 3.0), + gfx.LineTo(18.0, 7.0), + gfx.CubicTo(18.0, 8.105, 17.105, 9.0, 16.0, 9.0), + gfx.LineTo(8.0, 9.0), + gfx.CubicTo(6.895, 9.0, 6.0, 8.105, 6.0, 7.0), + gfx.LineTo(6.0, 5.5), + gfx.LineTo(3.5, 5.5), + gfx.LineTo(3.5, 14.0), + gfx.LineTo(6.0, 14.0), + gfx.LineTo(6.0, 13.0), + gfx.CubicTo(6.0, 11.895, 6.895, 11.0, 8.0, 11.0), + gfx.LineTo(16.0, 11.0), + gfx.CubicTo(17.105, 11.0, 18.0, 11.895, 18.0, 13.0), + gfx.LineTo(18.0, 17.0), + gfx.CubicTo(18.0, 18.105, 17.105, 19.0, 16.0, 19.0), + gfx.LineTo(8.0, 19.0), + gfx.CubicTo(6.895, 19.0, 6.0, 18.105, 6.0, 17.0), + gfx.LineTo(6.0, 15.5), + gfx.LineTo(3.5, 15.5), + gfx.LineTo(3.5, 18.25), + gfx.CubicTo(3.5, 18.664, 3.164, 19.0, 2.75, 19.0), + gfx.CubicTo(2.336, 19.0, 2.0, 18.664, 2.0, 18.25), + gfx.LineTo(2.0, 1.75), + gfx.CubicTo(2.0, 1.336, 2.336, 1.0, 2.75, 1.0), + gfx.ClosePath(), + gfx.MoveTo(8.0, 2.5), + gfx.CubicTo(7.724, 2.5, 7.5, 2.724, 7.5, 3.0), + gfx.LineTo(7.5, 7.0), + gfx.CubicTo(7.5, 7.276, 7.724, 7.5, 8.0, 7.5), + gfx.LineTo(16.0, 7.5), + gfx.CubicTo(16.276, 7.5, 16.5, 7.276, 16.5, 7.0), + gfx.LineTo(16.5, 3.0), + gfx.CubicTo(16.5, 2.724, 16.276, 2.5, 16.0, 2.5), + gfx.ClosePath(), + gfx.MoveTo(16.0, 12.5), + gfx.LineTo(8.0, 12.5), + gfx.CubicTo(7.724, 12.5, 7.5, 12.724, 7.5, 13.0), + gfx.LineTo(7.5, 17.0), + gfx.CubicTo(7.5, 17.276, 7.724, 17.5, 8.0, 17.5), + gfx.LineTo(16.0, 17.5), + gfx.CubicTo(16.276, 17.5, 16.5, 17.276, 16.5, 17.0), + gfx.LineTo(16.5, 13.0), + gfx.CubicTo(16.5, 12.724, 16.276, 12.5, 16.0, 12.5), + gfx.ClosePath(), + }, +} + +// terminal is a compiled vector icon. +var Terminal = gfx.Icon{ + ViewBox: 20.0, + Stroke: 0.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Commands: []gfx.PathCommand{ + gfx.MoveTo(3.0, 2.0), + gfx.LineTo(17.0, 2.0), + gfx.QuadTo(17.828, 2.0, 18.414, 2.586), + gfx.QuadTo(19.0, 3.172, 19.0, 4.0), + gfx.LineTo(19.0, 16.0), + gfx.QuadTo(19.0, 18.0, 17.0, 18.0), + gfx.LineTo(3.0, 18.0), + gfx.QuadTo(1.0, 18.0, 1.0, 16.0), + gfx.LineTo(1.0, 4.0), + gfx.QuadTo(1.0, 3.172, 1.586, 2.586), + gfx.QuadTo(2.172, 2.0, 3.0, 2.0), + gfx.ClosePath(), + gfx.MoveTo(3.0, 3.5), + gfx.QuadTo(2.793, 3.5, 2.646, 3.646), + gfx.QuadTo(2.5, 3.793, 2.5, 4.0), + gfx.LineTo(2.5, 16.0), + gfx.QuadTo(2.5, 16.5, 3.0, 16.5), + gfx.LineTo(17.0, 16.5), + gfx.QuadTo(17.5, 16.5, 17.5, 16.0), + gfx.LineTo(17.5, 4.0), + gfx.QuadTo(17.5, 3.5, 17.0, 3.5), + gfx.ClosePath(), + gfx.MoveTo(5.22, 11.22), + gfx.LineTo(7.439, 9.0), + gfx.LineTo(5.22, 6.78), + gfx.QuadTo(5.0, 6.561, 5.0, 6.25), + gfx.QuadTo(5.0, 5.939, 5.22, 5.72), + gfx.QuadTo(5.439, 5.5, 5.75, 5.5), + gfx.QuadTo(6.061, 5.5, 6.28, 5.72), + gfx.LineTo(9.03, 8.47), + gfx.QuadTo(9.25, 8.689, 9.25, 9.0), + gfx.QuadTo(9.25, 9.311, 9.03, 9.53), + gfx.LineTo(6.28, 12.28), + gfx.QuadTo(6.061, 12.5, 5.75, 12.5), + gfx.QuadTo(5.439, 12.5, 5.22, 12.28), + gfx.QuadTo(5.0, 12.061, 5.0, 11.75), + gfx.QuadTo(5.0, 11.439, 5.22, 11.22), + gfx.ClosePath(), + gfx.MoveTo(9.0, 13.279), + gfx.CubicTo(9.0, 12.865, 9.336, 12.529, 9.75, 12.529), + gfx.LineTo(14.25, 12.5), + gfx.CubicTo(14.664, 12.5, 15.0, 12.836, 15.0, 13.25), + gfx.CubicTo(15.0, 13.664, 14.664, 14.0, 14.25, 14.0), + gfx.LineTo(9.75, 14.029), + gfx.CubicTo(9.336, 14.029, 9.0, 13.693, 9.0, 13.279), + gfx.ClosePath(), + }, +} + +// vcs is a compiled vector icon. +var Vcs = gfx.Icon{ + ViewBox: 20.0, + Stroke: 0.0, + Cap: gfx.CapRound, + Join: gfx.JoinRound, + Commands: []gfx.PathCommand{ + gfx.MoveTo(9.0, 4.5), + gfx.CubicTo(9.0, 6.176, 7.823, 7.576, 6.25, 7.919), + gfx.LineTo(6.25, 13.25), + gfx.LineTo(9.5, 13.25), + gfx.CubicTo(10.209, 13.25, 10.703, 13.25, 11.09, 13.223), + gfx.CubicTo(11.471, 13.197, 11.692, 13.149, 11.861, 13.079), + gfx.CubicTo(12.412, 12.85, 12.85, 12.412, 13.079, 11.861), + gfx.CubicTo(13.149, 11.692, 13.197, 11.471, 13.223, 11.09), + gfx.CubicTo(13.244, 10.785, 13.249, 10.412, 13.25, 9.919), + gfx.CubicTo(11.677, 9.576, 10.5, 8.175, 10.5, 6.5), + gfx.CubicTo(10.5, 4.567, 12.067, 3.0, 14.0, 3.0), + gfx.CubicTo(15.933, 3.0, 17.5, 4.567, 17.5, 6.5), + gfx.CubicTo(17.5, 8.176, 16.323, 9.576, 14.75, 9.92), + gfx.CubicTo(14.749, 10.418, 14.744, 10.838, 14.72, 11.193), + gfx.CubicTo(14.689, 11.649, 14.623, 12.053, 14.465, 12.435), + gfx.CubicTo(14.084, 13.354, 13.354, 14.084, 12.435, 14.465), + gfx.CubicTo(12.053, 14.623, 11.649, 14.689, 11.193, 14.72), + gfx.CubicTo(10.748, 14.75, 10.203, 14.75, 9.527, 14.75), + gfx.LineTo(6.25, 14.75), + gfx.LineTo(6.25, 18.0), + gfx.CubicTo(6.25, 18.414, 5.914, 18.75, 5.5, 18.75), + gfx.CubicTo(5.086, 18.75, 4.75, 18.414, 4.75, 18.0), + gfx.LineTo(4.75, 7.919), + gfx.CubicTo(3.177, 7.576, 2.0, 6.176, 2.0, 4.5), + gfx.CubicTo(2.0, 2.567, 3.567, 1.0, 5.5, 1.0), + gfx.CubicTo(7.433, 1.0, 9.0, 2.567, 9.0, 4.5), + gfx.ClosePath(), + gfx.MoveTo(7.5, 4.5), + gfx.CubicTo(7.5, 3.395, 6.605, 2.5, 5.5, 2.5), + gfx.CubicTo(4.395, 2.5, 3.5, 3.395, 3.5, 4.5), + gfx.CubicTo(3.5, 5.605, 4.395, 6.5, 5.5, 6.5), + gfx.CubicTo(6.605, 6.5, 7.5, 5.605, 7.5, 4.5), + gfx.ClosePath(), + gfx.MoveTo(16.0, 6.5), + gfx.CubicTo(16.0, 5.395, 15.105, 4.5, 14.0, 4.5), + gfx.CubicTo(12.895, 4.5, 12.0, 5.395, 12.0, 6.5), + gfx.CubicTo(12.0, 7.605, 12.895, 8.5, 14.0, 8.5), + gfx.CubicTo(15.105, 8.5, 16.0, 7.605, 16.0, 6.5), + gfx.ClosePath(), + }, +} diff --git a/desktop/internal/toolicons/svg/build@20x20.svg b/desktop/internal/toolicons/svg/build@20x20.svg new file mode 100644 index 0000000000..ccb32e2641 --- /dev/null +++ b/desktop/internal/toolicons/svg/build@20x20.svg @@ -0,0 +1,4 @@ + + + + diff --git a/desktop/internal/toolicons/svg/commit@20x20.svg b/desktop/internal/toolicons/svg/commit@20x20.svg new file mode 100644 index 0000000000..070e2e57b0 --- /dev/null +++ b/desktop/internal/toolicons/svg/commit@20x20.svg @@ -0,0 +1,4 @@ + + + + diff --git a/desktop/internal/toolicons/svg/debug@20x20.svg b/desktop/internal/toolicons/svg/debug@20x20.svg new file mode 100644 index 0000000000..c82ab9f0b8 --- /dev/null +++ b/desktop/internal/toolicons/svg/debug@20x20.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/desktop/internal/toolicons/svg/find@20x20.svg b/desktop/internal/toolicons/svg/find@20x20.svg new file mode 100644 index 0000000000..849d84129e --- /dev/null +++ b/desktop/internal/toolicons/svg/find@20x20.svg @@ -0,0 +1,4 @@ + + + + diff --git a/desktop/internal/toolicons/svg/notifications@20x20.svg b/desktop/internal/toolicons/svg/notifications@20x20.svg new file mode 100644 index 0000000000..60a688fabe --- /dev/null +++ b/desktop/internal/toolicons/svg/notifications@20x20.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/desktop/internal/toolicons/svg/problems@20x20.svg b/desktop/internal/toolicons/svg/problems@20x20.svg new file mode 100644 index 0000000000..c8e2782b04 --- /dev/null +++ b/desktop/internal/toolicons/svg/problems@20x20.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/desktop/internal/toolicons/svg/project@20x20.svg b/desktop/internal/toolicons/svg/project@20x20.svg new file mode 100644 index 0000000000..fc1b767c74 --- /dev/null +++ b/desktop/internal/toolicons/svg/project@20x20.svg @@ -0,0 +1,4 @@ + + + + diff --git a/desktop/internal/toolicons/svg/run@20x20.svg b/desktop/internal/toolicons/svg/run@20x20.svg new file mode 100644 index 0000000000..209f31bd35 --- /dev/null +++ b/desktop/internal/toolicons/svg/run@20x20.svg @@ -0,0 +1,4 @@ + + + + diff --git a/desktop/internal/toolicons/svg/services@20x20.svg b/desktop/internal/toolicons/svg/services@20x20.svg new file mode 100644 index 0000000000..ced9a8da66 --- /dev/null +++ b/desktop/internal/toolicons/svg/services@20x20.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/desktop/internal/toolicons/svg/structure@20x20.svg b/desktop/internal/toolicons/svg/structure@20x20.svg new file mode 100644 index 0000000000..dd00efe005 --- /dev/null +++ b/desktop/internal/toolicons/svg/structure@20x20.svg @@ -0,0 +1,4 @@ + + + + diff --git a/desktop/internal/toolicons/svg/terminal@20x20.svg b/desktop/internal/toolicons/svg/terminal@20x20.svg new file mode 100644 index 0000000000..2c59dc57f6 --- /dev/null +++ b/desktop/internal/toolicons/svg/terminal@20x20.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/desktop/internal/toolicons/svg/vcs@20x20.svg b/desktop/internal/toolicons/svg/vcs@20x20.svg new file mode 100644 index 0000000000..e4b2fc5b22 --- /dev/null +++ b/desktop/internal/toolicons/svg/vcs@20x20.svg @@ -0,0 +1,4 @@ + + + + diff --git a/desktop/internal/workbench/catalog.go b/desktop/internal/workbench/catalog.go index 3fec507969..4e76b3e96d 100644 --- a/desktop/internal/workbench/catalog.go +++ b/desktop/internal/workbench/catalog.go @@ -8,6 +8,7 @@ import ( "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" "github.com/1lck/Lithe-IDEA/desktop/internal/icons" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginservice" + "github.com/1lck/Lithe-IDEA/desktop/internal/toolicons" "github.com/vivaui/viva/gfx" "github.com/vivaui/viva/ui" ) @@ -189,9 +190,12 @@ type item struct { zone zone // the default zone; its surface is the only one the item may sit in // icon is the glyph of the button; nil for a status item that is text only. icon *gfx.Icon - // label is the button's name, shown as its tooltip and read by assistive - // technology. + // label is the button's name, read by assistive technology and, on a button that is only + // an icon, shown as its tooltip. label func(*i18n.Messages) string + // shortcut is the shortcut catalog action (shortcuts.Catalog) that does what a click on + // the button does, whose keys the tooltip shows after the name; empty for none. + shortcut string // panel reports that the button opens a tool window in its zone's slot. panel bool // open reports that the tool window is open in the default layout. @@ -203,33 +207,47 @@ type item struct { vcs *vcsWindow } +// stripeLucideStroke is the stroke, in Lucide's 24 unit view box, of a Lucide icon drawn in a +// tool stripe: at the stripe's 20 point icon size it is the 1.5 points the IntelliJ tool window +// icons draw with, where Lucide's own 2 units would be 1.67. +const stripeLucideStroke = 1.8 + +// stripeLucide is a Lucide icon at the weight of the IntelliJ tool window icons, for a stripe +// button IntelliJ has no icon for. +func stripeLucide(icon gfx.Icon) *gfx.Icon { + icon.Stroke = stripeLucideStroke + return &icon +} + // catalog is every rearrangeable button, in the default order of each zone. The -// kernel owns the layout rules; this is only the host's list of what exists. +// kernel owns the layout rules; this is only the host's list of what exists. A tool +// stripe button shows the IntelliJ New UI icon of its window (toolicons), or a Lucide icon +// at the same weight when IntelliJ has none. var catalog = []item{ - {id: itemProject, zone: zoneLeftTop, icon: &icons.Folder, label: func(m *i18n.Messages) string { return m.Tools.Project }, panel: true, open: true}, - {id: itemCommit, zone: zoneLeftTop, icon: &icons.GitCommitHorizontal, label: func(m *i18n.Messages) string { return m.Tools.Commit }, panel: true}, - {id: itemStructure, zone: zoneLeftTop, icon: &icons.ListTree, label: func(m *i18n.Messages) string { return m.Tools.Structure }, panel: true}, - {id: itemFind, zone: zoneLeftTop, icon: &icons.Search, label: func(m *i18n.Messages) string { return m.Tools.Find }, panel: true}, - - {id: itemGit, zone: zoneBottomLeft, icon: &icons.GitBranch, label: func(m *i18n.Messages) string { return m.Tools.Git }, panel: true}, - {id: itemTerminal, zone: zoneBottomLeft, icon: &icons.SquareTerminal, label: func(m *i18n.Messages) string { return m.Tools.Terminal }, panel: true}, - {id: itemProblems, zone: zoneBottomLeft, icon: &icons.CircleAlert, label: func(m *i18n.Messages) string { return m.Tools.Problems }, panel: true}, - {id: itemReferences, zone: zoneBottomLeft, icon: &icons.Locate, label: func(m *i18n.Messages) string { return m.Tools.References }, panel: true}, - {id: itemRun, zone: zoneBottomLeft, icon: &icons.Play, label: func(m *i18n.Messages) string { return m.Tools.Run }, panel: true}, - {id: itemTests, zone: zoneBottomLeft, icon: &icons.CircleCheck, label: func(m *i18n.Messages) string { return m.Tools.Tests }, panel: true}, - {id: itemSecurity, zone: zoneBottomLeft, icon: &icons.ShieldCheck, label: func(m *i18n.Messages) string { return m.Tools.Security }, panel: true}, - {id: itemDebug, zone: zoneBottomLeft, icon: &icons.Bug, label: func(m *i18n.Messages) string { return m.Tools.Debug }, panel: true}, - - {id: itemBuild, zone: zoneRightTop, icon: &icons.Wrench, label: func(m *i18n.Messages) string { return m.Tools.Build }, panel: true}, - {id: itemNotifications, zone: zoneRightTop, icon: &icons.Bell, label: func(m *i18n.Messages) string { return m.Tools.Notifications }, panel: true}, - - {id: itemUpdates, zone: zoneBottomRight, icon: &icons.RefreshCw, label: func(m *i18n.Messages) string { return m.Tools.Updates }, panel: true}, - {id: itemBackground, zone: zoneBottomRight, icon: &icons.Image, label: func(m *i18n.Messages) string { return m.Tools.Background }}, + {id: itemProject, zone: zoneLeftTop, icon: &toolicons.Project, label: func(m *i18n.Messages) string { return m.Tools.Project }, panel: true, open: true}, + {id: itemCommit, zone: zoneLeftTop, icon: &toolicons.Commit, label: func(m *i18n.Messages) string { return m.Tools.Commit }, panel: true}, + {id: itemStructure, zone: zoneLeftTop, icon: &toolicons.Structure, label: func(m *i18n.Messages) string { return m.Tools.Structure }, panel: true}, + {id: itemFind, zone: zoneLeftTop, icon: &toolicons.Find, label: func(m *i18n.Messages) string { return m.Tools.Find }, panel: true}, + + {id: itemGit, zone: zoneBottomLeft, icon: &toolicons.Vcs, label: func(m *i18n.Messages) string { return m.Tools.Git }, panel: true}, + {id: itemTerminal, zone: zoneBottomLeft, icon: &toolicons.Terminal, label: func(m *i18n.Messages) string { return m.Tools.Terminal }, panel: true}, + {id: itemProblems, zone: zoneBottomLeft, icon: &toolicons.Problems, label: func(m *i18n.Messages) string { return m.Tools.Problems }, panel: true}, + {id: itemReferences, zone: zoneBottomLeft, icon: stripeLucide(icons.Locate), label: func(m *i18n.Messages) string { return m.Tools.References }, panel: true}, + {id: itemRun, zone: zoneBottomLeft, icon: &toolicons.Run, label: func(m *i18n.Messages) string { return m.Tools.Run }, panel: true}, + {id: itemTests, zone: zoneBottomLeft, icon: stripeLucide(icons.CircleCheck), label: func(m *i18n.Messages) string { return m.Tools.Tests }, panel: true}, + {id: itemSecurity, zone: zoneBottomLeft, icon: stripeLucide(icons.ShieldCheck), label: func(m *i18n.Messages) string { return m.Tools.Security }, panel: true}, + {id: itemDebug, zone: zoneBottomLeft, icon: &toolicons.Debug, label: func(m *i18n.Messages) string { return m.Tools.Debug }, panel: true}, + + {id: itemBuild, zone: zoneRightTop, icon: &toolicons.Build, label: func(m *i18n.Messages) string { return m.Tools.Build }, panel: true}, + {id: itemNotifications, zone: zoneRightTop, icon: &toolicons.Notifications, label: func(m *i18n.Messages) string { return m.Tools.Notifications }, panel: true}, + + {id: itemUpdates, zone: zoneBottomRight, icon: stripeLucide(icons.RefreshCw), label: func(m *i18n.Messages) string { return m.Tools.Updates }, panel: true}, + {id: itemBackground, zone: zoneBottomRight, icon: stripeLucide(icons.Image), label: func(m *i18n.Messages) string { return m.Tools.Background }}, {id: itemRunConfig, zone: zoneTitle, icon: &icons.FileCode, label: func(m *i18n.Messages) string { return m.Title.RunConfiguration }}, {id: itemTitleRun, zone: zoneTitle, icon: &icons.Play, label: func(m *i18n.Messages) string { return m.Title.Run }}, {id: itemTitleDebug, zone: zoneTitle, icon: &icons.Bug, label: func(m *i18n.Messages) string { return m.Title.Debug }}, - {id: itemTitleSearch, zone: zoneTitle, icon: &icons.Search, label: func(m *i18n.Messages) string { return m.Title.Search }}, + {id: itemTitleSearch, zone: zoneTitle, icon: &icons.Search, label: func(m *i18n.Messages) string { return m.Title.Search }, shortcut: "search.everywhere"}, {id: itemTitleSettings, zone: zoneTitle, icon: &icons.Settings, label: func(m *i18n.Messages) string { return m.Title.Settings }}, {id: itemCaret, zone: zoneStatus, label: func(m *i18n.Messages) string { return m.Status.Caret }}, diff --git a/desktop/internal/workbench/chrome.go b/desktop/internal/workbench/chrome.go index c65f4abfad..9a6a670d69 100644 --- a/desktop/internal/workbench/chrome.go +++ b/desktop/internal/workbench/chrome.go @@ -13,12 +13,18 @@ const gearMenuWidth = 224 const ( // chromeIconButton is the side of a title bar icon button and the height of the - // other title bar controls; chromeToolButton is the side of a stripe button. Both - // are even and fit their bar with a whole pixel above and below, so nothing is - // laid out on a half pixel. + // other title bar controls. It is even and fits its bar with a whole pixel above and + // below, so nothing is laid out on a half pixel. chromeIconButton = 28 - chromeToolButton = 32 chromeIconSize = 16 + // A tool stripe button is laid out as in IntelliJ's New UI: a chromeToolButton square + // highlight around a chromeToolIcon icon, chromeToolInset from the stripe's sides, and + // chromeToolGap between two buttons, so a button follows every 40 points. The sizes are + // even and the inset whole, so the icon too stands on whole pixels. + chromeToolButton = 30 + chromeToolIcon = 20 + chromeToolInset = (stripeWidth - chromeToolButton) / 2 + chromeToolGap = 10 // chromeMarkSize is the size of a chevron or a status glyph. chromeMarkSize = 12 chromeGap = 4 diff --git a/desktop/internal/workbench/chrome_view.go b/desktop/internal/workbench/chrome_view.go index a21b02b047..56e99950a2 100644 --- a/desktop/internal/workbench/chrome_view.go +++ b/desktop/internal/workbench/chrome_view.go @@ -21,8 +21,9 @@ import ( // its drag source, and returns it for its content to be declared in. A container is used // instead of a Button because these buttons carry icons, take their colors from the palette // and report their state to assistive technology. value is the reading of a status item, -// empty for the other buttons. -func (a *App) chromeBox(row ui.Box, id gfx.ID, i int, open bool, value string) ui.Box { +// empty for the other buttons. A button that is only an icon (iconOnly) shows its name in a +// tooltip, since nothing else on it says what it is. +func (a *App) chromeBox(row ui.Box, id gfx.ID, i int, open bool, value string, iconOnly bool) ui.Box { it := a.chrome.catalog[i] label := it.label(a.text) if it.id == itemChanges { @@ -30,6 +31,11 @@ func (a *App) chromeBox(row ui.Box, id gfx.ID, i int, open bool, value string) u label = value } options := gfx.HitOptions{Role: gfx.RoleButton, Hint: a.text.Tools.DragHint, Selected: open, Value: value} + if iconOnly { + // Viva hands a tooltip to assistive technology as the hint, so the drag hint, which + // that would replace, is announced as the description instead. + options.Hint, options.Description = "", a.text.Tools.DragHint + } if it.zone.surface() != surfaceStatus { // The status items only show a reading, so they do not offer a click. options.Cursor = gfx.PointerCursorHand @@ -37,6 +43,9 @@ func (a *App) chromeBox(row ui.Box, id gfx.ID, i int, open bool, value string) u row = row.Radius(a.theme.Metrics.RadiusItem()). HitWith(id, label, options). Pressed(ui.Look{}.Background(a.colors.Active)) + if iconOnly { + row = row.Tooltip(a.chromeTooltip(i, label)) + } if open { fill := a.colors.Active if it.zone.surface() == surfaceStripes { @@ -53,14 +62,49 @@ func (a *App) chromeBox(row ui.Box, id gfx.ID, i int, open bool, value string) u return a.chrome.place(i, row.DragSource(&a.dnd.tool)) } -// chromeGlyph declares a square button that shows the icon of catalog item i and reports a -// click on it. The icon is rest while the pointer is away and hover while it is over the -// button. -func (a *App) chromeGlyph(c ui.C, i int, side float32, rest, hover gfx.Color, open bool) (ui.Box, bool) { +// chromeTooltip is the tooltip of the icon button of catalog item i named label: the name, +// followed by the keys of the item's shortcut when it has one and they are bound. +func (a *App) chromeTooltip(i int, label string) string { + id := a.chrome.catalog[i].shortcut + if id == "" { + return label + } + keys := a.settings.Keymap.Label(id) + if keys == "" { + return label + } + return i18n.SharedFormat(a.language(), "desktop.tools.withShortcut", map[string]string{"name": label, "keys": keys}) +} + +// glyphLayout is how a row of chrome icon buttons lays out each button: the side of the +// square, the side of its icon and the side of the button its tooltip opens on. +type glyphLayout struct { + side, icon float32 + tooltip ui.TooltipSide +} + +// titleGlyph lays out a title bar button. Its tooltip opens below it, into the window. +var titleGlyph = glyphLayout{side: chromeIconButton, icon: chromeIconSize, tooltip: ui.TooltipBottom} + +// stripeGlyph lays out a button of the left or the right tool stripe. Its tooltip opens on +// the stripe's inner side, over the workbench rather than off the window's edge. +func stripeGlyph(left bool) glyphLayout { + tooltip := ui.TooltipLeft + if left { + tooltip = ui.TooltipRight + } + return glyphLayout{side: chromeToolButton, icon: chromeToolIcon, tooltip: tooltip} +} + +// chromeGlyph declares a square button that shows the icon of catalog item i, laid out by +// layout, and reports a click on it. The icon is rest while the pointer is away and hover +// while it is over the button; the item's name shows in a tooltip. +func (a *App) chromeGlyph(c ui.C, i int, layout glyphLayout, rest, hover gfx.Color, open bool) (ui.Box, bool) { k := c.KeyInt(i) - box := a.chromeBox(ui.Row(k).Size(side, side).Shrink(0).Center(), ui.ID(k), i, open, "") + box := a.chromeBox(ui.Row(k).Size(layout.side, layout.side).Shrink(0).Center(), ui.ID(k), i, open, "", true). + TooltipOn(layout.tooltip) box.Children(func() { - ui.Icon(k, *a.chrome.catalog[i].icon).Size(chromeIconSize, chromeIconSize).Color(rest). + ui.Icon(k, *a.chrome.catalog[i].icon).Size(layout.icon, layout.icon).Color(rest). StateFrom(box).Hover(ui.Look{}.Color(hover)) }) return box, box.Clicked() @@ -154,7 +198,7 @@ func (a *App) chromeTitleButton(c ui.C, i int) bool { case itemRunConfig: k := c.KeyInt(i) wasOpen := a.title.runConfigOpen - box := a.chromeBox(ui.Row(k).Height(chromeIconButton).Shrink(0).Items(ui.Center).Gap(chromeGap).PadX(chromeEdge), ui.ID(k), i, wasOpen, "") + box := a.chromeBox(ui.Row(k).Height(chromeIconButton).Shrink(0).Items(ui.Center).Gap(chromeGap).PadX(chromeEdge), ui.ID(k), i, wasOpen, "", false) box.Children(func() { ui.Icon(k, *a.chrome.catalog[i].icon).Size(chromeIconSize, chromeIconSize).Color(a.colors.Subtle) ui.Text(k, a.titleRunLabel()).Color(a.colors.Text).LineHeight(chromeLineHeight).Ellipsis().MaxWidth(chromeProjectMax) @@ -170,10 +214,10 @@ func (a *App) chromeTitleButton(c ui.C, i int) bool { return false case itemTitleRun: // Run is the one button that keeps its color at rest: green says what it does. - _, clicked := a.chromeGlyph(c, i, chromeIconButton, a.colors.Success, a.colors.Success, false) + _, clicked := a.chromeGlyph(c, i, titleGlyph, a.colors.Success, a.colors.Success, false) return clicked case itemTitleSettings: - box, clicked := a.chromeGlyph(c, i, chromeIconButton, a.colors.Text, a.colors.Text, a.title.gearOpen) + box, clicked := a.chromeGlyph(c, i, titleGlyph, a.colors.Text, a.colors.Text, a.title.gearOpen) wasOpen := a.title.gearOpen if wasOpen { a.gearMenu(c, box) @@ -185,7 +229,7 @@ func (a *App) chromeTitleButton(c ui.C, i int) bool { } return false } - _, clicked := a.chromeGlyph(c, i, chromeIconButton, a.colors.Text, a.colors.Text, false) + _, clicked := a.chromeGlyph(c, i, titleGlyph, a.colors.Text, a.colors.Text, false) return clicked } @@ -206,15 +250,15 @@ func (a *App) stripe(c ui.C, left bool) { dragging := a.draggingToolButton() // As in the title bar, a click is acted on once the stripe is declared. clicked := -1 - ui.Column(c).Width(stripeWidth).FillHeight().Shrink(0).Background(a.chromeFill()).Pad(chromeGap).Children(func() { - if i := a.stripeZone(c, top, dragging); i >= 0 { + ui.Column(c).Width(stripeWidth).FillHeight().Shrink(0).Background(a.chromeFill()).Pad(chromeToolInset).Children(func() { + if i := a.stripeZone(c, top, left, dragging); i >= 0 { clicked = i } ui.Spacer(c) - if i := a.stripeZone(c, split, dragging); i >= 0 { + if i := a.stripeZone(c, split, left, dragging); i >= 0 { clicked = i } - if i := a.stripeZone(c, end, dragging); i >= 0 { + if i := a.stripeZone(c, end, left, dragging); i >= 0 { clicked = i } // The line on the editor's side is out of the flow, so the buttons sit in the middle @@ -231,13 +275,15 @@ func (a *App) stripe(c ui.C, left bool) { } } -// stripeZone declares one zone of a stripe and returns the catalog index of the button -// clicked in it, or -1. Each zone is as high as its buttons; the spacer in stripe pushes the +// stripeZone declares one zone of the left stripe (left) or the right one and returns the +// catalog index of the button clicked in it, or -1. Each zone is as high as its buttons; the +// spacer in stripe pushes the // split and bottom groups to the stripe's end. While a tool button is dragged, every zone is // at least one button high, which makes an empty zone a place the button can be dropped. -func (a *App) stripeZone(c ui.C, z zone, dragging bool) int { +func (a *App) stripeZone(c ui.C, z zone, left, dragging bool) int { clicked := -1 - column := ui.Column(c).Gap(chromeGap) + layout := stripeGlyph(left) + column := ui.Column(c).Gap(chromeToolGap) if dragging { column = column.MinHeight(chromeToolButton) } @@ -257,7 +303,7 @@ func (a *App) stripeZone(c ui.C, z zone, dragging bool) int { if open { hover = a.theme.PrimaryForeground } - box, hit := a.chromeGlyph(c, i, chromeToolButton, rest, hover, open) + box, hit := a.chromeGlyph(c, i, layout, rest, hover, open) switch { case background: // As the title bar's gear: the press on the button that dismisses the open @@ -312,7 +358,7 @@ func (a *App) statusBar(c ui.C) { func (a *App) chromeStatusItem(c ui.C, i int) bool { text := a.chromeStatusText(i) k := c.KeyInt(i) - box := a.chromeBox(ui.Row(k).Height(chromeStatusItem).Shrink(0).Items(ui.Center).Gap(chromeGap).PadX(chromeEdge), ui.ID(k), i, false, text) + box := a.chromeBox(ui.Row(k).Height(chromeStatusItem).Shrink(0).Items(ui.Center).Gap(chromeGap).PadX(chromeEdge), ui.ID(k), i, false, text, false) box.Children(func() { switch a.chrome.catalog[i].id { case itemLock: diff --git a/desktop/internal/workbench/drag.go b/desktop/internal/workbench/drag.go index ae4d5576c1..30ef39f13d 100644 --- a/desktop/internal/workbench/drag.go +++ b/desktop/internal/workbench/drag.go @@ -36,14 +36,14 @@ const ( // column without leaving its stripe. dragSnappedGhostSize = chromeToolButton // dragSnappedGhostIconInset centers the usual stripe icon inside its snapped button. - dragSnappedGhostIconInset = (dragSnappedGhostSize - chromeIconSize) / 2 + dragSnappedGhostIconInset = (dragSnappedGhostSize - chromeToolIcon) / 2 // dragFloatingGhostSize, dragFloatingGhostRadius, and dragFloatingGhostBorderWidth size // the detached image to match the previous client's floating tool button. dragFloatingGhostSize = 30 dragFloatingGhostRadius = 6 dragFloatingGhostBorderWidth = 1 // dragFloatingGhostIconInset centers the usual stripe icon inside the detached image. - dragFloatingGhostIconInset = (dragFloatingGhostSize - chromeIconSize) / 2 + dragFloatingGhostIconInset = (dragFloatingGhostSize - chromeToolIcon) / 2 // dragFloatingGhostOpacity is applied to the detached image's surface and icon. dragFloatingGhostOpacity = 0.85 // These are the rounded square's border and fill colors in the two workbench themes. @@ -236,8 +236,10 @@ func (a *App) dragInsertion(item int, z zone, x, y float32) (string, gfx.Rect) { vertical := z.vertical() zr := a.chrome.zoneRects[z] // position is where the line starts along the zone; before is the button it precedes. - position, before := zr.X+dragMarkLead, "" + // gap is the space between two buttons of the zone, which the line stands in the middle of. + position, before, gap := zr.X+dragMarkLead, "", float32(chromeGap) if vertical { + gap = chromeToolGap position = zr.Y + dragMarkLead if z == zoneBottomLeft || z == zoneBottomRight { // The empty bottom group sits at the stripe's end, so its mark belongs there. @@ -255,10 +257,10 @@ func (a *App) dragInsertion(item int, z zone, x, y float32) (string, gfx.Rect) { } if pointer < start+extent/2 { // The line sits in the middle of the gap in front of the button. - position, before = start-(chromeGap+dragMark)/2, a.chrome.catalog[other].id + position, before = start-(gap+dragMark)/2, a.chrome.catalog[other].id break } - position = start + extent + (chromeGap-dragMark)/2 + position = start + extent + (gap-dragMark)/2 } if vertical { position = min(max(position, zr.Y), zr.Y+zr.Height-dragMark) diff --git a/desktop/internal/workbench/plugintools.go b/desktop/internal/workbench/plugintools.go index 881d3267b1..c3ac2244f6 100644 --- a/desktop/internal/workbench/plugintools.go +++ b/desktop/internal/workbench/plugintools.go @@ -11,6 +11,7 @@ import ( "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" "github.com/1lck/Lithe-IDEA/desktop/internal/icons" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginservice" + "github.com/1lck/Lithe-IDEA/desktop/internal/toolicons" "github.com/vivaui/viva/gfx" "github.com/vivaui/viva/ui" ) @@ -39,37 +40,39 @@ func placementZone(placement string) zone { } // pluginToolIcon is the host icon a window declared by ID, or the generic tool window icon for -// an ID the host does not map. The IDs are the public ones the manifest contract lists. +// an ID the host does not map. The IDs are the public ones the manifest contract lists. As for +// the built-in windows, an ID IntelliJ has a tool window icon for shows that icon, and the +// others a Lucide icon at its weight. func pluginToolIcon(host string) *gfx.Icon { switch host { case "database", "services": - return &icons.Server + return &toolicons.Services case "terminal": - return &icons.SquareTerminal + return &toolicons.Terminal case "search": - return &icons.Search + return &toolicons.Find case "refresh": - return &icons.RefreshCw + return stripeLucide(icons.RefreshCw) case "reset": - return &icons.Undo2 + return stripeLucide(icons.Undo2) case "run": - return &icons.Play + return &toolicons.Run case "debug": - return &icons.Bug + return &toolicons.Debug case "settings": - return &icons.Settings + return stripeLucide(icons.Settings) case "add": - return &icons.Plus + return stripeLucide(icons.Plus) case "remove": - return &icons.Minus + return stripeLucide(icons.Minus) case "git": - return &icons.GitBranch + return &toolicons.Vcs case "problems": - return &icons.CircleAlert + return &toolicons.Problems case "plugin": - return &icons.Sparkles + return stripeLucide(icons.Sparkles) } - return &icons.LayoutGrid + return stripeLucide(icons.LayoutGrid) } // pluginItems is the built-in catalog followed by an item for each plugin tool window, then @@ -89,7 +92,7 @@ func pluginItems(windows []pluginservice.ToolWindow, vcs []vcsWindow) []item { window := &vcs[i] title := window.DisplayName items = append(items, item{ - id: vcsItemID(window), zone: zoneBottomLeft, icon: &icons.GitBranch, + id: vcsItemID(window), zone: zoneBottomLeft, icon: &toolicons.Vcs, label: func(*i18n.Messages) string { return title }, panel: true, vcs: window, }) } diff --git a/desktop/internal/workbench/stripe_test.go b/desktop/internal/workbench/stripe_test.go new file mode 100644 index 0000000000..a596a95d08 --- /dev/null +++ b/desktop/internal/workbench/stripe_test.go @@ -0,0 +1,133 @@ +package workbench + +import ( + "testing" + + "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" + "github.com/vivaui/viva/app" + "github.com/vivaui/viva/gfx" + "github.com/vivaui/viva/ui" +) + +// tooltips is the text of every tip the last frame painted, with where it stands. +func (h *harness) tooltips() []app.Label { + var tips []app.Label + for _, label := range h.driver.Snapshot().Labels { + if label.Layer == ui.TooltipLayer { + tips = append(tips, label) + } + } + return tips +} + +// buttonHit is the control laid out over the catalog button id in the last frame. +func (h *harness) buttonHit(id string) gfx.Hit { + h.t.Helper() + rect := h.button(id) + for _, hit := range h.driver.Snapshot().Hits { + if hit.Bounds == rect && !hit.IsLabel && !hit.ID.IsZero() { + return hit + } + } + h.t.Fatalf("no control covers the %s button", id) + return gfx.Hit{} +} + +// The stripes lay out their buttons as the tool window bars of IntelliJ's New UI do: a +// 30pt button in the middle of the 40pt stripe, one every 40pt down the stripe. +func TestToolStripeButtonsHaveTheToolWindowBarSizes(t *testing.T) { + h := newHarness(t, &testKernel{Client: core.NewClient()}) + h.open(t.TempDir()) + + snapshot := h.driver.Snapshot() + stripes := dragStripeRects(gfx.Rect{Width: float32(snapshot.Width), Height: float32(snapshot.Height)}) + for _, tc := range []struct { + name string + side stripeSide + ids []string + }{ + {name: "left", side: stripeLeft, ids: []string{itemProject, itemCommit, itemStructure, itemFind}}, + {name: "right", side: stripeRight, ids: []string{itemBuild, itemNotifications}}, + } { + t.Run(tc.name, func(t *testing.T) { + stripe := stripes[tc.side] + if stripe.Width != 40 { + t.Fatalf("the %s stripe is %v wide, want 40", tc.name, stripe.Width) + } + var above gfx.Rect + for i, id := range tc.ids { + rect := h.button(id) + if rect.Width != 30 || rect.Height != 30 { + t.Errorf("the %s button is %vx%v, want 30x30", id, rect.Width, rect.Height) + } + if inset := rect.X - stripe.X; inset != 5 { + t.Errorf("the %s button stands %v in from the %s stripe's edge, want 5", id, inset, tc.name) + } + if i > 0 && rect.Y-above.Y != 40 { + t.Errorf("the %s button is %v below the one above it, want 40", id, rect.Y-above.Y) + } + above = rect + } + }) + } +} + +// A button that is only an icon names itself in a tip while the pointer rests on it: a +// stripe button's tip opens on the side away from the window edge, a title bar button's below +// it, and the Search tip adds the keys of Search Everywhere, which the button opens. The drag +// hint goes to assistive technology as the description, and no tip covers a button's drag. +func TestIconButtonsNameThemselvesInATipBesideThem(t *testing.T) { + h := newHarness(t, &testKernel{Client: core.NewClient()}) + h.open(t.TempDir()) + + keys := h.app.settings.Keymap.Label("search.everywhere") + if keys == "" { + t.Fatal("Search Everywhere has no default keys") + } + search := i18n.SharedFormat(h.app.language(), "desktop.tools.withShortcut", map[string]string{"name": h.app.text.Title.Search, "keys": keys}) + for _, tc := range []struct { + id, tip string + // beside reports whether the tip stands on the button's inner side. + beside func(tip, button gfx.Rect) bool + }{ + {id: itemProject, tip: h.app.text.Tools.Project, beside: func(tip, button gfx.Rect) bool { return tip.X >= button.Right() }}, + {id: itemBuild, tip: h.app.text.Tools.Build, beside: func(tip, button gfx.Rect) bool { return tip.Right() <= button.X }}, + {id: itemTitleSearch, tip: search, beside: func(tip, button gfx.Rect) bool { return tip.Y >= button.Bottom() }}, + } { + t.Run(tc.id, func(t *testing.T) { + if hit := h.buttonHit(tc.id); hit.Hint != tc.tip || hit.Description != h.app.text.Tools.DragHint { + t.Fatalf("the %s button tells assistive technology %q, then %q; want %q, then the drag hint", tc.id, hit.Hint, hit.Description, tc.tip) + } + button := h.button(tc.id) + at := center(button) + if err := h.driver.Move(at.X, at.Y); err != nil { + t.Fatal(err) + } + h.settle() + tips := h.tooltips() + if len(tips) != 1 || tips[0].Value != tc.tip { + t.Fatalf("resting on the %s button shows the tips %+v, want only %q", tc.id, tips, tc.tip) + } + if !tc.beside(tips[0].Bounds, button) { + t.Fatalf("the %s tip at %+v is not on the inner side of the button at %+v", tc.id, tips[0].Bounds, button) + } + }) + } + + from := center(h.button(itemCommit)) + if err := h.driver.Press(from.X, from.Y, gfx.PointerButtonPrimary); err != nil { + t.Fatal(err) + } + if err := h.driver.Move(from.X+2*dragThreshold, from.Y+2*dragThreshold); err != nil { + t.Fatal(err) + } + h.settle() + if tips := h.tooltips(); len(tips) != 0 { + t.Errorf("dragging the commit button shows the tips %+v", tips) + } + if err := h.driver.Cancel(); err != nil { + t.Fatal(err) + } + h.settle() +} diff --git a/scripts/desktop/generate-desktop-file-icons.sh b/scripts/desktop/generate-desktop-file-icons.sh index db0eb9889e..b0b1c2e1fb 100755 --- a/scripts/desktop/generate-desktop-file-icons.sh +++ b/scripts/desktop/generate-desktop-file-icons.sh @@ -1,25 +1,41 @@ #!/bin/zsh -# Regenerates the compiled file-type icons of the Viva desktop client -# (desktop/internal/fileicons/icons.go and icons_tree.go) from the SVGs in -# desktop/internal/fileicons/svg/. Pass --tree-only to regenerate disclosure icons without -# changing the existing file-type and folder vectors. +# Regenerates the compiled IntelliJ icons of the Viva desktop client: # -# The SVGs are IntelliJ Community icons (see desktop/internal/fileicons/NOTICE). Many of them -# draw colored strokes, and the Viva icon compiler keeps the colors of filled shapes only, so -# each SVG first goes through picosvg, which turns every stroke into a filled outline of the same -# color. picosvg drops the fill of a path that relied on the SVG default (black), so the script +# desktop/internal/fileicons/icons.go file-type and folder icons, from fileicons/svg/ +# desktop/internal/fileicons/icons_tree.go disclosure icons, from fileicons/svg/tree/ +# desktop/internal/toolicons/icons.go tool window stripe icons, from toolicons/svg/ +# +# With no argument the script regenerates all three. Pass --tree-only to regenerate the +# disclosure icons alone, or --tools-only to regenerate the tool window icons alone; the other +# vectors stay as they are. +# +# The SVGs are IntelliJ Community icons (see the NOTICE of each package). Many of them draw +# strokes, so each SVG first goes through picosvg, which turns every stroke into a filled outline +# of the same color. +# +# File-type icons keep their colors, because the Viva icon compiler keeps the colors of filled +# shapes. picosvg drops the fill of a path that relied on the SVG default (black), so the script # writes that default back. Every underscore of a file name becomes a hyphen, which the compiler # reads as a word break: _dark.svg becomes the Go name Dark, and the IntelliJ name # db_set_breakpoint.svg becomes DbSetBreakpoint. # -# To add or change an icon, edit svg/ and run this script again; do not edit icons.go by hand. -# Python 3.9 or 3.11, picosvg and its dependencies are fixed to versions that reproduce the -# existing icon vectors. Set LITHE_ICON_PYTHON to a supported executable when it is not on PATH. -# Dependencies are installed in a fresh temporary virtual environment that is removed on exit; -# nothing is written outside desktop/internal/fileicons/. The compiler is built into the same -# temporary directory (also removed on exit) from the Viva source that desktop/go.mod resolves to -# (through its replace directive, the Lithe-IDEA/viva fork) with Viva's own go.mod and go.sum. -# "go run @" would ignore the replace. +# Tool window icons lose their single color instead: the stripe tints them by state. The compiler +# draws all uncolored shapes of an icon as one path filled with the nonzero rule, where two shapes +# that overlap with opposite windings would cut holes into each other, so the script unions the +# shapes of each icon into one outline with skia-pathops, writes it without a fill and marks the +# root stroke-width="0", which tells the compiler the tinted shapes are filled rather than stroked. +# @20x20.svg becomes the Go name . Only the light variants are kept: the dark ones draw +# the same shapes in another color. +# +# To add or change an icon, edit the svg/ directory and run this script again; do not edit the +# generated files by hand. Python 3.9 or 3.11, picosvg and its dependencies are fixed to versions +# that reproduce the existing icon vectors. Set LITHE_ICON_PYTHON to a supported executable when +# it is not on PATH. Dependencies are installed in a fresh temporary virtual environment that is +# removed on exit; nothing is written outside desktop/internal/fileicons/ and +# desktop/internal/toolicons/. The compiler is built into the same temporary directory (also +# removed on exit) from the Viva source that desktop/go.mod resolves to (through its replace +# directive, the Lithe-IDEA/viva fork) with Viva's own go.mod and go.sum. "go run +# @" would ignore the replace. set -euo pipefail ROOT_DIR="${0:A:h:h:h}" @@ -32,11 +48,15 @@ ICON_DIR="$ROOT_DIR/desktop/internal/fileicons" OUT_FILE="$ICON_DIR/icons.go" TREE_OUT_FILE="$ICON_DIR/icons_tree.go" NOTICE_FILE="$ICON_DIR/NOTICE" -TREE_ONLY=false -if [[ "${1:-}" == "--tree-only" && $# == 1 ]]; then - TREE_ONLY=true +TOOL_DIR="$ROOT_DIR/desktop/internal/toolicons" +TOOL_OUT_FILE="$TOOL_DIR/icons.go" +MODE=all +if [[ $# == 1 && "${1:-}" == "--tree-only" ]]; then + MODE=tree +elif [[ $# == 1 && "${1:-}" == "--tools-only" ]]; then + MODE=tools elif [[ $# != 0 ]]; then - print -u2 -- "Usage: $0 [--tree-only]" + print -u2 -- "Usage: $0 [--tree-only | --tools-only]" exit 2 fi @@ -70,7 +90,7 @@ trap 'rm -rf "$TMP_DIR"' EXIT "$TMP_DIR/venv/bin/python" -m pip install --quiet --disable-pip-version-check \ "picosvg==0.22.3" "skia-pathops==0.8.0.post2" "lxml==6.1.3" "absl-py==2.3.1" -# Built once for both compile_icons calls; the binary lives in the temporary directory only. +# Built once for every compile below; the binary lives in the temporary directory only. go -C "$VIVA_DIR" build -o "$TMP_DIR/viva" ./cmd/viva compile_icons() { @@ -90,17 +110,74 @@ compile_icons() { rmdir "$converted_dir" } -if [[ "$TREE_ONLY" == false ]]; then +# UNION_SHAPES reads a picosvg output (argv[1]) and writes it (argv[2]) with all its shapes +# unioned into one uncolored path under a root marked stroke-width="0". It refuses an icon of more +# than one color, or one that keeps anything but paths after picosvg, rather than flatten it. +UNION_SHAPES=' +import sys + +import pathops +from lxml import etree +from picosvg.svg_pathops import skia_path, svg_commands +from picosvg.svg_types import SVGPath + +SVG = "{http://www.w3.org/2000/svg}" +source, target = sys.argv[1], sys.argv[2] +tree = etree.parse(source) +root = tree.getroot() +for defs in root.findall(SVG + "defs"): + if len(defs): + sys.exit(source + ": definitions are not supported in a tool window icon") + root.remove(defs) +others = [child.tag for child in root if child.tag != SVG + "path"] +if others: + sys.exit(source + ": unexpected elements " + ", ".join(others)) +paths = list(root) +if len({path.get("fill") for path in paths}) != 1: + sys.exit(source + ": a tool window icon must draw in one color") +outline = pathops.Path() +for path in paths: + shape = skia_path(SVGPath(d=path.get("d")).as_cmd_seq(), path.get("fill-rule", "nonzero")) + outline = pathops.op(outline, shape, pathops.PathOp.UNION) + root.remove(path) +etree.SubElement(root, SVG + "path", d=SVGPath.from_commands(svg_commands(outline)).round_floats(3).d) +root.set("stroke-width", "0") +tree.write(target) +' + +compile_tool_icons() { + local converted_dir="$TMP_DIR/tools" name source + mkdir "$converted_dir" + for source in "$TOOL_DIR"/svg/*@20x20.svg; do + name="${source:t:r}" + name="${name%@20x20}" + (cd "$TMP_DIR" && "$TMP_DIR/venv/bin/picosvg" "$source") > "$TMP_DIR/$name.tool.pico" + # -I keeps the interpreter from importing anything from the working directory. + "$TMP_DIR/venv/bin/python" -I -c "$UNION_SHAPES" "$TMP_DIR/$name.tool.pico" "$converted_dir/$name.svg" + done + "$TMP_DIR/viva" icons \ + -o "$TOOL_OUT_FILE" -pkg toolicons -license "$TOOL_DIR/NOTICE" "$converted_dir"/*.svg + rm "$converted_dir"/*.svg + rmdir "$converted_dir" +} + +OUTPUTS=() +if [[ "$MODE" == all ]]; then compile_icons "$ICON_DIR/svg" "$OUT_FILE" + OUTPUTS+=("$OUT_FILE") +fi +if [[ "$MODE" != tools ]]; then + compile_icons "$ICON_DIR/svg/tree" "$TREE_OUT_FILE" + OUTPUTS+=("$TREE_OUT_FILE") +fi +if [[ "$MODE" != tree ]]; then + compile_tool_icons + OUTPUTS+=("$TOOL_OUT_FILE") fi -compile_icons "$ICON_DIR/svg/tree" "$TREE_OUT_FILE" -UNFORMATTED="$(gofmt -l "$OUT_FILE" "$TREE_OUT_FILE")" +UNFORMATTED="$(gofmt -l "${OUTPUTS[@]}")" if [[ -n "$UNFORMATTED" ]]; then print -u2 -- "gofmt reports that the generated file is not formatted: $UNFORMATTED" exit 1 fi -if [[ "$TREE_ONLY" == false ]]; then - print -r -- "$OUT_FILE" -fi -print -r -- "$TREE_OUT_FILE" +print -rl -- "${OUTPUTS[@]}" diff --git a/shared/i18n/locales/en-US.json b/shared/i18n/locales/en-US.json index 817d09a2af..105d606762 100644 --- a/shared/i18n/locales/en-US.json +++ b/shared/i18n/locales/en-US.json @@ -1579,6 +1579,7 @@ "desktop.toolchains.unavailable": "Unavailable: {reason}", "desktop.tools.background": "Background", "desktop.tools.dragHint": "Drag to move elsewhere", + "desktop.tools.withShortcut": "{name} {keys}", "desktop.tools.structure": "Structure", "desktop.welcome.emptyHint": "Open a local folder to start working.", "desktop.welcome.emptyTitle": "No recent projects", diff --git a/shared/i18n/locales/zh-CN.json b/shared/i18n/locales/zh-CN.json index 3e27885c6e..1e52430a5e 100644 --- a/shared/i18n/locales/zh-CN.json +++ b/shared/i18n/locales/zh-CN.json @@ -1579,6 +1579,7 @@ "desktop.toolchains.unavailable": "不可用:{reason}", "desktop.tools.background": "背景", "desktop.tools.dragHint": "可拖动到其他位置", + "desktop.tools.withShortcut": "{name} {keys}", "desktop.tools.structure": "结构", "desktop.welcome.emptyHint": "打开本地文件夹开始工作。", "desktop.welcome.emptyTitle": "没有最近项目", diff --git a/shared/i18n/messages.json b/shared/i18n/messages.json index b8e34e4e3b..0ff7b4256a 100644 --- a/shared/i18n/messages.json +++ b/shared/i18n/messages.json @@ -16928,6 +16928,17 @@ "desktop" ] }, + { + "id": "desktop.tools.withShortcut", + "description": "Tooltip of a tool stripe or title bar icon button: the button's name, then the keys of its shortcut", + "platforms": [ + "desktop" + ], + "parameters": { + "name": "string", + "keys": "string" + } + }, { "id": "desktop.tools.structure", "description": "Desktop tools: Structure", diff --git a/shared/platform-feature-matrix/features/workbench-activity-rail-window-edge.json b/shared/platform-feature-matrix/features/workbench-activity-rail-window-edge.json index b837d62497..75de58de53 100644 --- a/shared/platform-feature-matrix/features/workbench-activity-rail-window-edge.json +++ b/shared/platform-feature-matrix/features/workbench-activity-rail-window-edge.json @@ -40,5 +40,5 @@ "verificationStatus": "pending" } }, - "notes": "Viva:chrome_view.go 的 stripe 以 stripeWidth 贴窗口左右边缘绘制,按钮在内部 Pad(chromeGap);六区布局定义在 catalog.go。" + "notes": "Viva:chrome_view.go 的 stripe 以 stripeWidth(40pt)贴窗口左右边缘绘制,按 IDEA New UI 工具窗口栏布局:30pt 按钮由 Pad(chromeToolInset)=5pt 居中,按钮间距 chromeToolGap=10pt,图标 20pt;六区布局定义在 catalog.go。" } diff --git a/shared/platform-feature-matrix/features/workbench-activity-tooltips.json b/shared/platform-feature-matrix/features/workbench-activity-tooltips.json index e22cf2d066..ed246b93bf 100644 --- a/shared/platform-feature-matrix/features/workbench-activity-tooltips.json +++ b/shared/platform-feature-matrix/features/workbench-activity-tooltips.json @@ -8,7 +8,8 @@ "verificationStatus": "pending", "evidence": [ "desktop/internal/workbench/chrome_view.go", - "desktop/internal/workbench/catalog.go" + "desktop/internal/workbench/catalog.go", + "desktop/internal/workbench/stripe_test.go" ] }, "windows": { @@ -16,11 +17,12 @@ "verificationStatus": "pending", "evidence": [ "desktop/internal/workbench/chrome_view.go", - "desktop/internal/workbench/catalog.go" + "desktop/internal/workbench/catalog.go", + "desktop/internal/workbench/stripe_test.go" ] }, "owner": "Workbench", - "verification": "逐一悬停左上导航、左下工具入口及右侧通知/插件/Maven,快速切换图标并移出活动栏;确认始终只显示当前图标说明,面板更新和滚动后不残留旧提示,禁用入口可显示说明,短文字自适应且提示不超出窗口边缘。", + "verification": "逐一悬停左右工具栏和标题栏的纯图标按钮,确认指针停上去就显示该按钮名称;左侧工具栏的提示开在按钮右边,右侧工具栏的开在左边,标题栏的开在下方,贴近窗口边缘时翻到对侧,提示不超出窗口。标题栏搜索按钮的提示在名称后附随处搜索的快捷键(默认 ⇧⌘O)。快速切换图标、移出按钮后不残留旧提示;按下或拖动按钮时不显示提示,松开后移出再移回才重新显示。自动化:stripe_test.go 的 TestIconButtonsNameThemselvesInATipBesideThem。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": { @@ -42,5 +44,5 @@ "verificationStatus": "pending" } }, - "notes": "Viva:chromeBox 把 catalog 的 label 作为 HitWith 的悬停说明,禁用入口和状态项同样声明;未找到专门清理旧提示的代码,依赖 Viva 的命中系统。" + "notes": "Viva:chromeGlyph 给纯图标按钮加 Tooltip(名称),并用 TooltipOn 指向工具栏内侧(标题栏朝下);延迟、翻边、按下时隐藏和移出后清理由 Viva 的 HoverTooltip 负责。Tooltip 会作为命中的 Hint 交给辅助技术,所以拖动说明改放 Description。只有点击效果与快捷键目录里某个动作完全相同的按钮才在提示里附快捷键(目前只有标题栏搜索):内置工具窗口没有切换快捷键,标题栏运行和调试走 titleStart,与 run.selected、debug.start 不同。提示是 Viva 的单色文字,要像 IDEA 那样把快捷键显示成灰色需要先改 Viva。" } diff --git a/shared/platform-feature-matrix/features/workbench-tool-stripe-icons.json b/shared/platform-feature-matrix/features/workbench-tool-stripe-icons.json new file mode 100644 index 0000000000..6aa508bf7c --- /dev/null +++ b/shared/platform-feature-matrix/features/workbench-tool-stripe-icons.json @@ -0,0 +1,37 @@ +{ + "id": "workbench-tool-stripe-icons", + "area": "工作台", + "group": "工作台布局", + "capability": "工具窗口栏使用 IntelliJ New UI 的工具窗口图标和尺寸", + "owner": "Workbench", + "notes": "Viva 共享实现。项目、提交、结构、查找、Git、终端、问题、运行、调试、构建、通知、服务使用 IntelliJ Community(Apache-2.0,修订 c7f91397daa3a961b4e78bc634fe467a0a7d9ade)的 20×20 New UI 工具窗口图标,许可见 desktop/internal/toolicons/NOTICE;IDEA 没有对应图标的入口(引用、测试、安全、更新、背景)使用 Lucide 图标,描边减到 1.8 以接近 IDEA 的线宽;插件声明的通用工具图标名映射到同一套图标。icons.go 由 scripts/desktop/generate-desktop-file-icons.sh --tools-only 从 SVG 生成,运行时不读写文件。尺寸:40pt 工具栏、30pt 按钮、20pt 图标、10pt 间距。", + "verification": "打开工作区,对照 IntelliJ IDEA New UI 检查左右工具窗口栏:图标形状和大小一致,选中按钮为主题主色圆角底配反色图标;拖动按钮时拖动预览里的图标居中,插入线落在两个按钮正中。浅色和深色主题各看一次。自动化:stripe_test.go 的 TestToolStripeButtonsHaveTheToolWindowBarSizes。", + "macos": { + "implementationStatus": "implemented", + "verificationStatus": "pending", + "evidence": [ + "desktop/internal/toolicons/icons.go", + "desktop/internal/toolicons/NOTICE", + "desktop/internal/workbench/catalog.go", + "desktop/internal/workbench/plugintools.go", + "desktop/internal/workbench/chrome.go", + "desktop/internal/workbench/chrome_view.go", + "desktop/internal/workbench/stripe_test.go", + "scripts/desktop/generate-desktop-file-icons.sh" + ] + }, + "windows": { + "implementationStatus": "implemented", + "verificationStatus": "pending", + "evidence": [ + "desktop/internal/toolicons/icons.go", + "desktop/internal/toolicons/NOTICE", + "desktop/internal/workbench/catalog.go", + "desktop/internal/workbench/plugintools.go", + "desktop/internal/workbench/chrome.go", + "desktop/internal/workbench/chrome_view.go", + "desktop/internal/workbench/stripe_test.go", + "scripts/desktop/generate-desktop-file-icons.sh" + ] + } +}