Compare commits
2 Commits
cf3b7ca651
...
f9432efc82
Author | SHA1 | Date | |
---|---|---|---|
f9432efc82 | |||
8d9bdd5cb8 |
@ -7,7 +7,7 @@ import "git.tebibyte.media/tomo/nasin"
|
||||
import "git.tebibyte.media/tomo/objects"
|
||||
import "git.tebibyte.media/tomo/tomo/input"
|
||||
import "git.tebibyte.media/tomo/objects/layouts"
|
||||
import "git.tebibyte.media/tomo/nasin/internal/theme/xdgicons"
|
||||
import "git.tebibyte.media/tomo/nasin/internal/theme/icons/xdg"
|
||||
|
||||
const scrollIcons = true
|
||||
|
||||
|
6
go.mod
@ -3,9 +3,9 @@ module git.tebibyte.media/tomo/nasin
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
git.tebibyte.media/tomo/backend v0.1.0
|
||||
git.tebibyte.media/tomo/objects v0.15.0
|
||||
git.tebibyte.media/tomo/tomo v0.34.0
|
||||
git.tebibyte.media/tomo/x v0.9.0
|
||||
git.tebibyte.media/tomo/xdg v0.1.0
|
||||
golang.org/x/image v0.11.0
|
||||
)
|
||||
@ -15,6 +15,6 @@ require (
|
||||
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
|
||||
github.com/jezek/xgb v1.1.0 // indirect
|
||||
github.com/jezek/xgbutil v0.0.0-20230603163917-04188eb39cf0 // indirect
|
||||
github.com/jezek/xgb v1.1.1 // indirect
|
||||
github.com/jezek/xgbutil v0.0.0-20231116234834-47f30c120111 // indirect
|
||||
)
|
||||
|
10
go.sum
@ -1,12 +1,12 @@
|
||||
git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q=
|
||||
git.tebibyte.media/tomo/backend v0.1.0 h1:+P2Pm8bii99VC7AGbQuY2Fqqi9OF3HZGgBWr1TJYi6c=
|
||||
git.tebibyte.media/tomo/backend v0.1.0/go.mod h1:VZ3/63ua9z5GjCTXND5GlAoOfld0s2vHul5N9rS74HE=
|
||||
git.tebibyte.media/tomo/objects v0.15.0 h1:xCrRqOwCz8jDJk/sWw0B1HyrRCJafAuaPWN9nZj8V1U=
|
||||
git.tebibyte.media/tomo/objects v0.15.0/go.mod h1:++pM0y/xuzhgmu1RpHTWQlqrmyHLfPEF9ahyrH8Tqvk=
|
||||
git.tebibyte.media/tomo/tomo v0.34.0 h1:r5yJPks9rtzdDI2RyAUdqa1qb6BebG0QFe2cTmcFi+0=
|
||||
git.tebibyte.media/tomo/tomo v0.34.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
|
||||
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/x v0.9.0 h1:wMcbK0MOE7ea7wcU2Mgrr86ZprVGLRY2PgOG0vDJR6Y=
|
||||
git.tebibyte.media/tomo/x v0.9.0/go.mod h1:OO4PYXhzrh4ZAY12d7bg+l/P4MbkFPu6f+YVXNDRhog=
|
||||
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=
|
||||
@ -15,10 +15,12 @@ github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298 h1:1qlsVAQJ
|
||||
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298/go.mod h1:D+QujdIlUNfa0igpNMk6UIvlb6C252URs4yupRUV4lQ=
|
||||
github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966 h1:lTG4HQym5oPKjL7nGs+csTgiDna685ZXjxijkne828g=
|
||||
github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966/go.mod h1:Mid70uvE93zn9wgF92A/r5ixgnvX8Lh68fxp9KQBaI0=
|
||||
github.com/jezek/xgb v1.1.0 h1:wnpxJzP1+rkbGclEkmwpVFQWpuE2PUGNUzP8SbfFobk=
|
||||
github.com/jezek/xgb v1.1.0/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk=
|
||||
github.com/jezek/xgbutil v0.0.0-20230603163917-04188eb39cf0 h1:Pf/0BAbppEOq4azPH6fnvUX2dycAwZdGkdxFn25j44c=
|
||||
github.com/jezek/xgb v1.1.1 h1:bE/r8ZZtSv7l9gk6nU0mYx51aXrvnyb44892TwSaqS4=
|
||||
github.com/jezek/xgb v1.1.1/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFlk=
|
||||
github.com/jezek/xgbutil v0.0.0-20230603163917-04188eb39cf0/go.mod h1:AHecLyFNy6AN9f/+0AH/h1MI7X1+JL5bmCz4XlVZk7Y=
|
||||
github.com/jezek/xgbutil v0.0.0-20231116234834-47f30c120111 h1:cX/mTy4LgFtWqr5dCadtdJ4zdh/KtPco5yFLsliaFyU=
|
||||
github.com/jezek/xgbutil v0.0.0-20231116234834-47f30c120111/go.mod h1:AHecLyFNy6AN9f/+0AH/h1MI7X1+JL5bmCz4XlVZk7Y=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
|
@ -3,13 +3,14 @@ package registrar
|
||||
|
||||
import "os"
|
||||
import "log"
|
||||
import "git.tebibyte.media/tomo/x"
|
||||
import "git.tebibyte.media/tomo/backend/x"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/nasin/internal/theme/default"
|
||||
import "git.tebibyte.media/tomo/nasin/internal/theme/xdgicons"
|
||||
import "git.tebibyte.media/tomo/nasin/internal/theme/icons/xdg"
|
||||
import "git.tebibyte.media/tomo/nasin/internal/theme/icons/fallback"
|
||||
import "git.tebibyte.media/tomo/nasin/internal/theme/style/fallback"
|
||||
|
||||
func Init () error {
|
||||
theme := defaultTheme.Theme()
|
||||
theme := fallbackStyle.New()
|
||||
|
||||
iconThemeName := os.Getenv("TOMO_XDG_ICON_THEME")
|
||||
if iconThemeName != "" {
|
||||
@ -20,8 +21,12 @@ func Init () error {
|
||||
log.Printf("nasin: could not load icon theme '%s': %v", iconThemeName, err)
|
||||
}
|
||||
}
|
||||
|
||||
if theme.IconTheme == nil {
|
||||
theme.IconTheme = fallbackIcons.New()
|
||||
}
|
||||
|
||||
tomo.SetTheme(theme)
|
||||
tomo.Register(1, x.NewBackend)
|
||||
tomo.Register(1, x.New)
|
||||
return nil
|
||||
}
|
||||
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@ -1,4 +1,4 @@
|
||||
package defaultTheme
|
||||
package fallbackIcons
|
||||
|
||||
import "bytes"
|
||||
import "image"
|
||||
@ -7,6 +7,7 @@ import _ "image/png"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/tomo/data"
|
||||
import "git.tebibyte.media/tomo/tomo/canvas"
|
||||
import dataTheme "git.tebibyte.media/tomo/nasin/internal/theme"
|
||||
|
||||
//go:embed assets/icons-small.png
|
||||
var atlasSmallBytes []byte
|
||||
@ -416,6 +417,11 @@ type iconTheme struct {
|
||||
texturesLarge map[tomo.Icon] canvas.Texture
|
||||
}
|
||||
|
||||
// New creates a new fallback icon theme.
|
||||
func New () dataTheme.IconTheme {
|
||||
return new(iconTheme)
|
||||
}
|
||||
|
||||
func (this *iconTheme) ensure () {
|
||||
if this.texturesSmall != nil { return }
|
||||
this.texturesSmall = generateSource(atlasSmallBytes, 16)
|
@ -54,14 +54,14 @@ func (this *iconTheme) xdgIcon (name string, size tomo.IconSize) (canvas.Texture
|
||||
iconFile, err := os.Open(icon.Path)
|
||||
if err != nil {
|
||||
// this failing indicates a broken icon theme
|
||||
log.Println("nasin: icon file '%s' is inaccessible: %v", icon.Path, err)
|
||||
log.Printf("nasin: icon file '%s' is inaccessible: %v\n", icon.Path, err)
|
||||
return nil, false
|
||||
}
|
||||
|
||||
iconImage, _, err := image.Decode(iconFile)
|
||||
if err != nil {
|
||||
// this failing indicates a broken icon theme
|
||||
log.Println("nasin: icon file '%s' is broken: %v", icon.Path, err)
|
||||
log.Printf("nasin: icon file '%s' is broken: %v\n", icon.Path, err)
|
||||
return nil, false
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package defaultTheme
|
||||
package fallbackStyle
|
||||
|
||||
import "image/color"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
@ -295,4 +295,15 @@ var rules = []dataTheme.Rule {
|
||||
dataTheme.AttrColor { Color: tomo.ColorAccent },
|
||||
),
|
||||
},
|
||||
|
||||
// *.File[*]
|
||||
dataTheme.Rule {
|
||||
Role: tomo.R("", "File", ""),
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrColor { Color: color.Transparent },
|
||||
),
|
||||
Focused: dataTheme.AS (
|
||||
dataTheme.AttrColor { Color: tomo.ColorAccent },
|
||||
),
|
||||
},
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package defaultTheme
|
||||
package fallbackStyle
|
||||
|
||||
import "image/color"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import dataTheme "git.tebibyte.media/tomo/nasin/internal/theme"
|
||||
|
||||
// Theme returns Wintergreen, the default Tomo tomo. It is neutral-gray with
|
||||
// green and turquoise accents.
|
||||
func Theme () *dataTheme.Theme {
|
||||
// New returns Wintergreen, the default Tomo tomo. It is neutral-gray with green
|
||||
// and turquoise accents.
|
||||
func New () *dataTheme.Theme {
|
||||
return &dataTheme.Theme {
|
||||
Colors: map[tomo.Color] color.Color {
|
||||
tomo.ColorBackground: colorBackground,
|
||||
@ -16,6 +16,5 @@ func Theme () *dataTheme.Theme {
|
||||
tomo.ColorAccent: colorFocus,
|
||||
},
|
||||
Rules: rules,
|
||||
IconTheme: &iconTheme { },
|
||||
}
|
||||
}
|