Introduce Rofi adapter, Serpensortia theme, and additional scripts for anime playback and theme customization

This commit is contained in:
2026-02-20 18:53:24 +01:00
parent ed6dc1d54b
commit ff0be9b328
8 changed files with 988 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
package rofi
import (
"Sithego/themer"
"os"
"path/filepath"
"text/template"
)
type Adapter struct {
OutputDir string
}
type Option func(*Adapter)
func WithOutputDir(dir string) Option {
return func(a *Adapter) {
a.OutputDir = dir
}
}
func New(opt ...Option) *Adapter {
home, _ := os.UserHomeDir()
a := &Adapter{
OutputDir: filepath.Join(home, ".themes"),
}
for _, o := range opt {
o(a)
}
return a
}
func (a *Adapter) Name() string {
return "Rofi"
}
func (a *Adapter) Generate(t themer.Theme) error {
templatePath := filepath.Join("themer/adapters/rofi", "theme.rasi")
templ, err := template.ParseFiles(templatePath)
if err != nil {
return err
}
outputPath := filepath.Join(a.OutputDir, t.Meta.Name, "rofi", "theme.rasi")
if err := os.MkdirAll(filepath.Dir(outputPath), 0755); err != nil {
return err
}
file, err := os.Create(outputPath)
if err != nil {
return err
}
defer file.Close()
err = templ.Execute(file, struct {
Theme themer.Theme
}{
Theme: t,
})
if err != nil {
return err
}
return nil
}
+62
View File
@@ -0,0 +1,62 @@
* {
/* Colors */
background: {{ .Theme.Colors.Semantic.Background.RGBA 80 }};
background-alt: {{ .Theme.Colors.Semantic.Surface.RGBA 80 }};
background-bar: {{ .Theme.Colors.Semantic.SurfaceAlt.RGBA 80 }};
foreground: {{ .Theme.Colors.Semantic.Text.Value }};
foreground-alt: {{ .Theme.Colors.Semantic.Text.Value }};
accent: {{ .Theme.Colors.Semantic.Accent.Value }};
border: {{ .Theme.Colors.Semantic.Accent.Value }};
border-alt: {{ .Theme.Colors.Semantic.Accent.Value }};
selected: {{ .Theme.Colors.Semantic.SurfaceAlt.RGBA 80 }};
urgent: {{ .Theme.Colors.Semantic.Warn.Value }};
on-selected: {{ .Theme.Colors.Semantic.Text.Value }};
separator: {{ .Theme.Colors.Semantic.Border.Value }};
list-bg: {{ .Theme.Colors.Semantic.Background.RGBA 80 }};
message-bg: {{ .Theme.Colors.Semantic.Surface.RGBA 80 }};
error-bg: {{ .Theme.Colors.Semantic.Warn.Value }};
error-border: {{ .Theme.Colors.Semantic.Border.Value }};
/* Standard Rofi variables for legacy support or internal use */
normal-foreground: @foreground;
normal-background: transparent;
selected-normal-foreground: @on-selected;
selected-normal-background: @selected;
urgent-foreground: @urgent;
urgent-background: transparent;
selected-urgent-foreground: @foreground;
selected-urgent-background: @urgent;
active-foreground: @accent;
active-background: transparent;
selected-active-foreground: @on-selected;
selected-active-background: @selected;
alternate-normal-foreground: @foreground;
alternate-normal-background: transparent;
alternate-urgent-foreground: @urgent;
alternate-urgent-background: transparent;
alternate-active-foreground: @accent;
alternate-active-background: transparent;
/* Spacing, Padding, Margin */
main-spacing: {{ .Theme.Spacing.MarginSmall }};
main-padding: {{ .Theme.Spacing.PaddingLarge }};
element-spacing: {{ .Theme.Spacing.MarginSmall }};
element-padding: {{ .Theme.Spacing.PaddingSmall }};
input-padding: {{ .Theme.Spacing.Padding }};
message-margin: {{ .Theme.Spacing.MarginSmall }};
/* Borders and Radius */
main-border: 1px;
main-radius: {{ .Theme.Spacing.RadiusLarge }};
element-border: 1px;
element-radius: {{ .Theme.Spacing.RadiusSmall }};
button-border: 1px;
button-selected-border: 1px;
button-selected-radius: {{ .Theme.Spacing.RadiusSmall }};
list-border: 1px;
list-radius: {{ .Theme.Spacing.RadiusSmall }};
sidebar-border: 1px;
}