9 Commits

Author SHA1 Message Date
48990469cf Update fallback style 2024-09-12 15:32:40 -04:00
59f32e6c1f Update backend 2024-09-12 15:31:24 -04:00
11477554b4 Update objects 2024-09-12 15:27:37 -04:00
0f9608a50a NewApplicationWindow takes in a WindowKind 2024-09-12 02:46:35 -04:00
2312b48a28 Fix code relating to cookies 2024-09-12 02:42:55 -04:00
e08d14135b Update Tomo API 2024-09-12 02:36:10 -04:00
888c233181 Give Wintergreen's TabbedContainer a gap 2024-09-03 16:25:15 -04:00
545d553d1a Config impl watches for create *and* write
Editing config files with things like gedit work now
2024-08-28 00:56:40 -04:00
2aea7764d3 Update styles in response to new focus method for MenuItem 2024-08-24 14:43:48 -04:00
10 changed files with 67 additions and 88 deletions

View File

@@ -204,8 +204,8 @@ func RunApplication (application Application) {
// owned by the application. The window's icon will be automatically set by
// looking for an icon with the name of the application's ID. If that is not
// found, the default icon for the application's ApplicationRole will used.
func NewApplicationWindow (application Application, bounds image.Rectangle) (tomo.Window, error) {
window, err := tomo.NewWindow(bounds)
func NewApplicationWindow (application Application, kind tomo.WindowKind, bounds image.Rectangle) (tomo.Window, error) {
window, err := tomo.NewWindow(kind, bounds)
if err != nil { return nil, err }
description := application.Describe()
window.SetTitle(description.Name)

View File

@@ -65,8 +65,8 @@ func NewConfig (user string, system ...string) (ConfigCloser, error) {
func (this *config) lockAndProcessEvent (event fsnotify.Event) {
this.lock.Lock()
defer this.lock.Unlock()
if !(event.Has(fsnotify.Write)) { return }
if _, ok := this.paths.watching[event.Name]; !ok { return }
if !(event.Has(fsnotify.Write | fsnotify.Create)) { return }
if _, ok := this.paths.watching[event.Name]; !ok { return }
if event.Name == this.paths.user {
if !this.ignoreNextUserUpdate {

9
go.mod
View File

@@ -4,16 +4,17 @@ go 1.22.2
require (
git.tebibyte.media/sashakoshka/goparse v0.2.0
git.tebibyte.media/tomo/backend v0.7.1
git.tebibyte.media/tomo/objects v0.22.0
git.tebibyte.media/tomo/tomo v0.46.1
git.tebibyte.media/tomo/backend v0.8.0
git.tebibyte.media/tomo/objects v0.24.0
git.tebibyte.media/tomo/tomo v0.48.0
git.tebibyte.media/tomo/xdg v0.1.0
github.com/fsnotify/fsnotify v1.7.0
golang.org/x/image v0.11.0
)
require (
git.tebibyte.media/tomo/typeset v0.7.1 // indirect
git.tebibyte.media/sashakoshka/goutil v0.3.1 // indirect
git.tebibyte.media/tomo/typeset v0.8.0 // indirect
git.tebibyte.media/tomo/xgbkb v1.0.1 // indirect
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298 // indirect
github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966 // indirect

18
go.sum
View File

@@ -1,14 +1,16 @@
git.tebibyte.media/sashakoshka/goparse v0.2.0 h1:uQmKvOCV2AOlCHEDjg9uclZCXQZzq2PxaXfZ1aIMiQI=
git.tebibyte.media/sashakoshka/goparse v0.2.0/go.mod h1:tSQwfuD+EujRoKr6Y1oaRy74ZynatzkRLxjE3sbpCmk=
git.tebibyte.media/sashakoshka/goutil v0.3.1 h1:zvAMKS+aea96q6oTttCWfNLXqOHisI3IKAwX6BWKfY0=
git.tebibyte.media/sashakoshka/goutil v0.3.1/go.mod h1:Yo/M2sbi9IbzZCFsEj8/Fg7sNwHkDaJ6saTHOha+Dow=
git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q=
git.tebibyte.media/tomo/backend v0.7.1 h1:tWkL5jlX0SLZ3H9dxVrLfW1PCeEe1uhtf1v+RCoge0w=
git.tebibyte.media/tomo/backend v0.7.1/go.mod h1:G3Kh6N2MuiAwsnuPe3h9CwWL65vmmsaqgapA38MPyhk=
git.tebibyte.media/tomo/objects v0.22.0 h1:2t21W32HW2xvPBICqmArVMVWxg9ohhTJw6ChZ0DcdYY=
git.tebibyte.media/tomo/objects v0.22.0/go.mod h1:f5J5tAhO+eN5glVbCJLPSopIeTylXqLgKLVAIg8iAPQ=
git.tebibyte.media/tomo/tomo v0.46.1 h1:/8fT6I9l4TK529zokrThbNDHGRvUsNgif1Zs++0PBSQ=
git.tebibyte.media/tomo/tomo v0.46.1/go.mod h1:WrtilgKB1y8O2Yu7X4mYcRiqOlPR8NuUnoA/ynkQWrs=
git.tebibyte.media/tomo/typeset v0.7.1 h1:aZrsHwCG5ZB4f5CruRFsxLv5ezJUCFUFsQJJso2sXQ8=
git.tebibyte.media/tomo/typeset v0.7.1/go.mod h1:PwDpSdBF3l/EzoIsa2ME7QffVVajnTHZN6l3MHEGe1g=
git.tebibyte.media/tomo/backend v0.8.0 h1:mPP6g60lL7v9GOjyUl/oGkHK/CV4ZJB8OUlw0E7WEhk=
git.tebibyte.media/tomo/backend v0.8.0/go.mod h1:yIWW8XXDsaHfIhAuxg336oYlgX0uCn3lwgaydh8BagE=
git.tebibyte.media/tomo/objects v0.24.0 h1:O91CxHJ1eA5/WJzDNm46lTA3Lm6t1CrLtf8gLKtuX7U=
git.tebibyte.media/tomo/objects v0.24.0/go.mod h1:atTxG2mRqDQBFS/0KoqP9VR50BozFLi7XRz/AkFJtMo=
git.tebibyte.media/tomo/tomo v0.48.0 h1:AE21ElHwUSPsX82ZWCnoNxJFi9Oswyd3dPDPMbxTueQ=
git.tebibyte.media/tomo/tomo v0.48.0/go.mod h1:WrtilgKB1y8O2Yu7X4mYcRiqOlPR8NuUnoA/ynkQWrs=
git.tebibyte.media/tomo/typeset v0.8.0 h1:4qA6oW4/3oPHj6/Zrp+JFJ53OmFSDvxs+J6BhO3DW00=
git.tebibyte.media/tomo/typeset v0.8.0/go.mod h1:PwDpSdBF3l/EzoIsa2ME7QffVVajnTHZN6l3MHEGe1g=
git.tebibyte.media/tomo/xdg v0.1.0 h1:6G2WYPPiM2IXleCpKKHuJA34BxumwNWuLsUoX3yu5zA=
git.tebibyte.media/tomo/xdg v0.1.0/go.mod h1:tuaRwRkyYW7mqlxA7P2+V+e10KzcamNoUzcOgaIYKAY=
git.tebibyte.media/tomo/xgbkb v1.0.1 h1:b3HDUopjdQp1MZrb5Vpil4bOtk3NnNXtfQW27Blw2kE=

View File

@@ -505,11 +505,12 @@ func (this *iconSet) MimeIcon (mime data.Mime, size tomo.IconSize) canvas.Textur
}
}
func (this *iconSet) Close () {
func (this *iconSet) Close () error {
if this.atlasSmall != nil {
this.atlasSmall.Close()
}
if this.atlasLarge != nil {
this.atlasLarge.Close()
}
return nil
}

View File

@@ -101,7 +101,7 @@ func (this *iconTheme) MimeIcon (mime data.Mime, size tomo.IconSize) canvas.Text
}
}
func (this *iconTheme) Close () {
func (this *iconTheme) Close () error {
closeAllIn := func (mp map[tomo.Icon] canvas.TextureCloser) {
for _, texture := range mp {
if texture != nil {
@@ -112,6 +112,7 @@ func (this *iconTheme) Close () {
closeAllIn(this.texturesSmall)
closeAllIn(this.texturesMedium)
closeAllIn(this.texturesLarge)
return nil
}
func (this *iconTheme) icon (icon tomo.Icon, size tomo.IconSize) canvas.TextureCloser {

View File

@@ -198,10 +198,6 @@ $BorderOuterShadow = #a4afc0 ;
Color: #0000;
}
*.MenuItem[hovered] {
Color: $ColorDot;
}
*.MenuItem[focused] {
Color: $ColorDot;
}
@@ -218,10 +214,6 @@ $BorderOuterShadow = #a4afc0 ;
Border: $BorderTearPad / 3, $BorderTear / 1;
}
*.TearLine[hovered] {
Border: $BorderTearPadFocused / 3, $BorderTearFocused / 1;
}
*.TearLine[focused] {
Border: $BorderTearPadFocused / 3, $BorderTearFocused / 1;
}

View File

@@ -1,6 +1,5 @@
package fallbackStyle
import "io"
import "bytes"
import "image"
import _ "embed"
@@ -47,12 +46,6 @@ var borderColorShade = [4]color.Color { colorShade, colorShade, col
//go:embed assets/atlas.png
var atlasBytes []byte
type closerCookie struct { io.Closer }
func (cookie closerCookie) Close () { cookie.Closer.Close() }
func newCloserCookie (closer io.Closer) event.Cookie {
return closerCookie { Closer: closer }
}
// New returns Wintergreen, the default Tomo style. It is neutral-gray with
// green and turquoise accents.
func New () (*style.Style, event.Cookie) {
@@ -66,7 +59,7 @@ func New () (*style.Style, event.Cookie) {
textureHandleVertical := atlasTexture.SubTexture(image.Rect(28, 0, 29, 2))
textureHandleHorizontal := atlasTexture.SubTexture(image.Rect(28, 0, 30, 1))
cookie := event.MultiCookie(newCloserCookie(atlasTexture))
cookie := event.MultiCookie(atlasTexture)
rules := []style.Rule {
// *.*
@@ -152,26 +145,12 @@ rules := []style.Rule {
tomo.AGap(0, 0),
), tomo.R("", "NumberInput")),
// *.Container[sunken]
// *.Root
style.Ru(style.AS (
tomo.ABorder (
outline,
tomo.Border {
Width: tomo.I(1, 0, 0, 1),
Color: borderColorEngraved,
}),
tomo.AColor(tomo.ColorSunken),
// tomo.ATexture(textureCorkboard),
tomo.APadding(8),
), tomo.R("", "Container"), "sunken"),
tomo.AGap(0, 0),
), tomo.R("", "Root")),
// *.Container[outer]
style.Ru(style.AS (
tomo.AttrColor { Color: tomo.ColorBackground },
tomo.AttrPadding(tomo.I(8)),
), tomo.R("", "Container"), "outer"),
// *.Container[menu]
// *.Root[menu]
style.Ru(style.AS (
tomo.AttrBorder {
outline,
@@ -182,7 +161,38 @@ rules := []style.Rule {
},
tomo.AttrColor { Color: tomo.ColorBackground },
tomo.AttrGap { },
), tomo.R("", "Container"), "menu"),
), tomo.R("", "Root"), "menu"),
// *.Pegboard
style.Ru(style.AS (
tomo.ABorder (
outline,
tomo.Border {
Width: tomo.I(1, 0, 0, 1),
Color: borderColorEngraved,
}),
tomo.AColor(tomo.ColorSunken),
// tomo.ATexture(textureCorkboard),
tomo.APadding(8),
), tomo.R("", "Pegboard")),
// *.Segment
style.Ru(style.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(1),
Color: borderColorLifted,
},
},
tomo.AttrColor { Color: tomo.ColorBackground },
tomo.AttrPadding(tomo.I(8)),
), tomo.R("", "Segment")),
// *.Segment[option]
style.Ru(style.AS (
tomo.AttrColor { Color: tomo.ColorSunken },
tomo.AttrPadding(tomo.I(8)),
), tomo.R("", "Segment"), "option"),
// *.Heading
style.Ru(style.AS (
@@ -369,11 +379,6 @@ rules := []style.Rule {
style.Ru(style.AS (
tomo.AttrColor { Color: tomo.ColorAccent },
), tomo.R("", "MenuItem"), "focused"),
// *.MenuItem[hovered]
style.Ru(style.AS (
tomo.AttrColor { Color: tomo.ColorAccent },
), tomo.R("", "MenuItem"), "hovered"),
// *.File
style.Ru(style.AS (
@@ -410,16 +415,6 @@ rules := []style.Rule {
},
},
), tomo.R("", "TearLine"), "focused"),
// *.TearLine[hovered]
style.Ru(style.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(3),
Color: borderColorFocused,
},
},
), tomo.R("", "TearLine"), "hovered"),
// *.Calendar
style.Ru(style.AS (
@@ -460,11 +455,6 @@ rules := []style.Rule {
tomo.AttrColor { Color: colorCalendarWeekend },
), tomo.R("", "CalendarDay"), "weekend"),
// *.TabbedContainer
style.Ru(style.AS (
tomo.AGap(0, 0),
), tomo.R("", "TabbedContainer")),
// *.TabRow
style.Ru(style.AS (
tomo.AttrBorder {

View File

@@ -1,7 +1,6 @@
package tss
import "os"
import "io"
import "fmt"
import "image"
import "errors"
@@ -81,7 +80,7 @@ func (this *styleBuilder) build () (*style.Style, event.Cookie, error) {
// add each texture to the cookies list
for _, texture := range this.textures {
cookies = append(cookies, closerCookie { Closer: texture })
cookies = append(cookies, texture)
}
return sty, event.MultiCookie(cookies...), nil
@@ -398,10 +397,3 @@ func copyBorderValue[T any, U ~[]T] (destination, source U) bool {
return false
}
}
type closerCookie struct {
io.Closer
}
func (cookie closerCookie) Close () {
cookie.Closer.Close()
}

View File

@@ -7,11 +7,6 @@ var manager struct {
count int
}
type funcCookie func ()
func (cookie funcCookie) Close () {
cookie()
}
// WaitFor ensures that the application will stay running while the given window
// is open.
func WaitFor (window tomo.Window) event.Cookie {
@@ -27,7 +22,12 @@ func WaitFor (window tomo.Window) event.Cookie {
}
}
handleWaitClose := func () error {
handleClose();
return nil
}
return event.MultiCookie (
window.OnClose(handleClose),
funcCookie(handleClose))
event.FuncCookie(handleWaitClose))
}