diff --git a/a.out b/a.out new file mode 100644 index 0000000..e69de29 diff --git a/app/darktile/cmd/root.go b/app/darktile/cmd/root.go index eb5a162..f83dc38 100644 --- a/app/darktile/cmd/root.go +++ b/app/darktile/cmd/root.go @@ -134,7 +134,7 @@ func (r *Term) Run(ctx *Context) error { g.ShowError(err.Error()) } - return g.Run() + return g.Run(conf) } func getImageFromFilePath(filePath string) (image.Image, error) { f, err := os.Open(filePath) diff --git a/app/darktile/config/config.go b/app/darktile/config/config.go index 2acd90d..a8ae556 100644 --- a/app/darktile/config/config.go +++ b/app/darktile/config/config.go @@ -13,6 +13,8 @@ type Config struct { Opacity float64 `json:"opacity"` Font Font `json:"font"` Cursor Cursor `json:"cursor"` + + Vsync bool `json:"vsync"` } type Font struct { diff --git a/app/darktile/font/manager.go b/app/darktile/font/manager.go index 1d642f9..ab0ade5 100644 --- a/app/darktile/font/manager.go +++ b/app/darktile/font/manager.go @@ -106,7 +106,7 @@ func (m *Manager) createFace(f *opentype.Font) (font.Face, error) { return opentype.NewFace(f, &opentype.FaceOptions{ Size: m.size, DPI: m.dpi, - Hinting: font.HintingFull, + Hinting: font.HintingNone, }) } diff --git a/app/darktile/gui/gui.go b/app/darktile/gui/gui.go index 15afaa5..2708dae 100644 --- a/app/darktile/gui/gui.go +++ b/app/darktile/gui/gui.go @@ -9,6 +9,7 @@ import ( "time" "github.com/hajimehoshi/ebiten/v2" + "tuxpa.in/t/erm/app/darktile/config" "tuxpa.in/t/erm/app/darktile/font" "tuxpa.in/t/erm/app/darktile/gui/popup" "tuxpa.in/t/erm/app/darktile/hinters" @@ -73,7 +74,7 @@ func New(terminal *termutil2.Terminal, options ...Option) (*GUI, error) { return g, nil } -func (g *GUI) Run() error { +func (g *GUI) Run(c *config.Config) error { go func() { if err := g.terminal.Run(g.updateChan, uint16(g.size.X), uint16(g.size.Y)); err != nil { @@ -83,11 +84,17 @@ func (g *GUI) Run() error { os.Exit(0) }() + ebiten.SetWindowTitle("darktile") ebiten.SetScreenTransparent(true) ebiten.SetScreenClearedEveryFrame(true) ebiten.SetWindowResizable(true) ebiten.SetRunnableOnUnfocused(true) - ebiten.SetFPSMode(ebiten.FPSModeVsyncOffMinimum) + ebiten.SetMaxTPS(120) + if c.Vsync { + ebiten.SetFPSMode(ebiten.FPSModeVsyncOn) + } else { + ebiten.SetFPSMode(ebiten.FPSModeVsyncOffMinimum) + } for _, f := range g.startupFuncs { go f(g)