Compare commits
3 Commits
7d9d93fa3f
...
bea78be331
Author | SHA1 | Date | |
---|---|---|---|
bea78be331 | |||
0eced435a0 | |||
072eaa6029 |
@ -7,6 +7,7 @@ import "git.tebibyte.media/tomo/nasin"
|
|||||||
import "git.tebibyte.media/tomo/objects"
|
import "git.tebibyte.media/tomo/objects"
|
||||||
import "git.tebibyte.media/tomo/tomo/input"
|
import "git.tebibyte.media/tomo/tomo/input"
|
||||||
import "git.tebibyte.media/tomo/objects/layouts"
|
import "git.tebibyte.media/tomo/objects/layouts"
|
||||||
|
import "git.tebibyte.media/tomo/nasin/internal/theme/xdgicons"
|
||||||
|
|
||||||
const scrollIcons = true
|
const scrollIcons = true
|
||||||
|
|
||||||
@ -389,13 +390,15 @@ func (this *Application) iconPopup (icon tomo.Icon) error {
|
|||||||
icon = "<UNKNOWN>"
|
icon = "<UNKNOWN>"
|
||||||
}
|
}
|
||||||
|
|
||||||
sizesRow := objects.NewInnerContainer (
|
sizesRow := objects.NewSunkenContainer (
|
||||||
layouts.ContractHorizontal,
|
layouts.ContractHorizontal,
|
||||||
objects.NewIcon(icon, tomo.IconSizeSmall),
|
objects.NewIcon(icon, tomo.IconSizeSmall),
|
||||||
objects.NewIcon(icon, tomo.IconSizeMedium),
|
objects.NewIcon(icon, tomo.IconSizeMedium),
|
||||||
objects.NewIcon(icon, tomo.IconSizeLarge))
|
objects.NewIcon(icon, tomo.IconSizeLarge))
|
||||||
|
sizesRow.SetAlign(tomo.AlignMiddle, tomo.AlignMiddle)
|
||||||
|
|
||||||
okButton := objects.NewButton("OK")
|
okButton := objects.NewButton("OK")
|
||||||
|
okButton.SetFocused(true)
|
||||||
okButton.OnClick(popup.Close)
|
okButton.OnClick(popup.Close)
|
||||||
okButton.SetIcon(tomo.IconDialogOkay)
|
okButton.SetIcon(tomo.IconDialogOkay)
|
||||||
controlRow := objects.NewInnerContainer (
|
controlRow := objects.NewInnerContainer (
|
||||||
@ -404,8 +407,9 @@ func (this *Application) iconPopup (icon tomo.Icon) error {
|
|||||||
controlRow.SetAlign(tomo.AlignEnd, tomo.AlignMiddle)
|
controlRow.SetAlign(tomo.AlignEnd, tomo.AlignMiddle)
|
||||||
|
|
||||||
popup.SetRoot(objects.NewOuterContainer (
|
popup.SetRoot(objects.NewOuterContainer (
|
||||||
layouts.NewGrid([]bool { true }, []bool { true, false }),
|
layouts.NewGrid([]bool { true }, []bool { false, false, true, false }),
|
||||||
objects.NewLabel("Icon ID: " + string(icon)),
|
objects.NewLabel("Icon ID: " + string(icon)),
|
||||||
|
objects.NewLabel("XDG Name: " + xdgIcons.XdgIconName(icon)),
|
||||||
sizesRow,
|
sizesRow,
|
||||||
controlRow,
|
controlRow,
|
||||||
))
|
))
|
||||||
|
@ -1,12 +1,27 @@
|
|||||||
//go:build unix && (!darwin)
|
//go:build unix && (!darwin)
|
||||||
package registrar
|
package registrar
|
||||||
|
|
||||||
|
import "os"
|
||||||
|
import "log"
|
||||||
import "git.tebibyte.media/tomo/x"
|
import "git.tebibyte.media/tomo/x"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/nasin/internal/theme/default"
|
import "git.tebibyte.media/tomo/nasin/internal/theme/default"
|
||||||
|
import "git.tebibyte.media/tomo/nasin/internal/theme/xdgicons"
|
||||||
|
|
||||||
func Init () error {
|
func Init () error {
|
||||||
tomo.SetTheme(defaultTheme.Theme())
|
theme := defaultTheme.Theme()
|
||||||
|
|
||||||
|
iconThemeName := os.Getenv("TOMO_XDG_ICON_THEME")
|
||||||
|
if iconThemeName != "" {
|
||||||
|
iconTheme, err := xdgIcons.FindThemeWarn(iconThemeName)
|
||||||
|
if err == nil {
|
||||||
|
theme.IconTheme = iconTheme
|
||||||
|
} else {
|
||||||
|
log.Printf("nasin: could not load icon theme '%s': %v", iconThemeName, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tomo.SetTheme(theme)
|
||||||
tomo.Register(1, x.NewBackend)
|
tomo.Register(1, x.NewBackend)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -154,6 +154,22 @@ var rules = []dataTheme.Rule {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// *.Container[menu]
|
||||||
|
dataTheme.Rule {
|
||||||
|
Role: tomo.R("", "Container", "menu"),
|
||||||
|
Default: dataTheme.AS (
|
||||||
|
dataTheme.AttrBorder {
|
||||||
|
outline,
|
||||||
|
tomo.Border {
|
||||||
|
Width: tomo.I(1),
|
||||||
|
Color: borderColorLifted,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
dataTheme.AttrColor { Color: tomo.ColorBackground },
|
||||||
|
dataTheme.AttrGap { },
|
||||||
|
),
|
||||||
|
},
|
||||||
|
|
||||||
// *.Heading[*]
|
// *.Heading[*]
|
||||||
dataTheme.Rule {
|
dataTheme.Rule {
|
||||||
Role: tomo.R("", "Heading", ""),
|
Role: tomo.R("", "Heading", ""),
|
||||||
@ -263,4 +279,20 @@ var rules = []dataTheme.Rule {
|
|||||||
dataTheme.AttrGap { X: 8, Y: 8 },
|
dataTheme.AttrGap { X: 8, Y: 8 },
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// *.MenuItem[*]
|
||||||
|
dataTheme.Rule {
|
||||||
|
Role: tomo.R("", "MenuItem", ""),
|
||||||
|
Default: dataTheme.AS (
|
||||||
|
dataTheme.AttrPadding(tomo.I(4)),
|
||||||
|
dataTheme.AttrGap { X: 4, Y: 4 },
|
||||||
|
dataTheme.AttrColor { Color: color.Transparent },
|
||||||
|
),
|
||||||
|
Hovered: dataTheme.AS (
|
||||||
|
dataTheme.AttrColor { Color: tomo.ColorAccent },
|
||||||
|
),
|
||||||
|
Focused: dataTheme.AS (
|
||||||
|
dataTheme.AttrColor { Color: tomo.ColorAccent },
|
||||||
|
),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user