Compare commits

..
31 Commits
Author SHA1 Message Date
totmin 92f64dbd9b docs: use HTTPS clone URL in README 2026-08-26 10:36:13 +07:00
totmin 8a0c167924 refactor: restructure to standard Go project layout (cmd/ + internal/)
- Move entry point to cmd/streamdeck-lets-go/
- Split package main into internal packages:
  - internal/deck: hardware control (Deck, events, brightness)
  - internal/render: key rendering, icons, fonts, PageManager
  - internal/web: HTTP API + embedded SPA
  - internal/daemon: event loop, autoswitch, screensaver, actions
- Add ConfigDir() to internal/config
- Export cross-package API (Deck, PageManager, WebServer, etc.)
- Move dist/arch/ → packaging/ with updated PKGBUILD/.SRCINFO
- Add Makefile (build, test, vet, fmt, install)
- Update README with new build commands and project structure
- Delete unused media.go stub
2026-08-26 10:35:20 +07:00
totmin bd8895f9ef fix: correct libusb dependency name in AUR package 2026-08-26 09:33:10 +07:00
totmin 4243ee353b chore: update AUR package URLs to totmin/streamdeck-lets-go 2026-08-26 09:26:07 +07:00
totmin f20a499c0f fix: stale display outputs leaking between pages in web UI
Bug: when the StreamDeck was on a non-main page (e.g. dashboard) and the
web UI was opened in a private browser tab, the frontend defaulted to the
first page in config while display outputs from the other page were still
applied to keys sharing the same index.

Fix 1 (backend): send the current active page via SSE immediately on new
client connection so the frontend knows the correct page from the start.

Fix 2 (frontend): only apply display output text/background to keys that
have a display config, preventing cross-page leakage.
2026-07-12 11:27:10 +07:00
totmin 3709926c4a fix depends: libusb-1.0 -> libusb 2026-07-03 09:30:48 +07:00
totmin 07b475918e release: v0.1.0 2026-07-03 09:29:49 +07:00
totmin 78cb2ebb3a fix AUR maintainer email 2026-07-03 09:22:59 +07:00
totmin 232aea67cf add MIT license, AUR packaging files, and credits 2026-06-23 16:59:15 +07:00
totmin f68f7e372f cli: add 'switch' command to change page on running daemon 2026-06-22 14:59:32 +07:00
totmin 7604d2ec39 cli: remove 'serve', fix --help to show commands 2026-06-22 14:52:16 +07:00
totmin e590c9fbc5 cli: add --page flag to start on a specific page 2026-06-22 14:44:16 +07:00
totmin a9c8a5bb8b reconnect: faster retry (1s) and health check (2s) 2026-06-22 10:28:43 +07:00
totmin 76ea5ae4b8 daemon: pause work on device disconnect to save battery 2026-06-22 10:25:10 +07:00
totmin 1b8fe467b4 text-only keys: transparent bg in web UI, #21252b bg on device 2026-06-22 10:14:06 +07:00
totmin 31f33c303e Dynamic key generators: plugin system for auto-generated pages
Add dynamic_keys support to PageConfig — a contract-based plugin
system where any executable outputs a JSON array of KeyConfig to stdout.
The daemon runs the generator on a configurable interval and renders
the keys dynamically on the Stream Deck.

Core changes:
- config: DynamicKeyGen struct (command/script, interval, timeout, max_keys)
- config: full validation for dynamic_keys fields
- action: execDynamicKeys() with safe JSON parsing (stderr logged separately,
  env vars STREAMDECK_KEY_COUNT / STREAMDECK_CONFIG_DIR)
- page: activeKeys() merges static + dynamic keys (static wins by index)
- page: startDynamicKeys / stopDynamicKeys lifecycle, per-page results cache
- page: rerenderActivePage() with deadlock-safe lock ordering
- daemon: event handler uses activeKeys() for dynamic key actions

Web UI:
- GET /api/pages returns effective_keys (merged static + cached dynamic)
- app.js: gridKeys uses effective_keys when available
- app.js: guard against editing dynamic keys through the UI
- index.html: " dynamic" badge + effective key count in page switcher
- polls /api/pages every 10s to keep the UI in sync

Image rendering:
- loadImage: gift.ResizeToFill instead of gift.Resize (preserves aspect
  ratio, crops to fill — no more stretched cover art)

Example & docs:
- config.example.json: games page with dynamic_keys + back button
- README.md: comprehensive Dynamic Key Generators section (architecture
  diagram, config reference, generator contract, merge behavior,
  env vars, error handling, Python + Shell examples, tips)
2026-06-21 21:05:32 +07:00
totmin aa3ba02504 Fix keyboard input on Wayland: use ydotool instead of wtype
- Replace wtype with ydotool as primary keyboard input tool on Wayland
  (wtype had a bug sending ESC instead of correct keys to GUI apps)
- Use 'ydotool type' command for better Wine/game compatibility
- Automatically start ydotoold daemon on startup if available
- Keep wtype as fallback for backward compatibility
- Improve keyboard action support for games running in Wine
2026-06-17 22:19:54 +07:00
totmin ae1d860f67 Fix rendering of keys with background only (no icon or label) 2026-06-17 20:28:25 +07:00
totmin 1312e94c3f Improve icon rendering: fix scaling and centering for emoji, FontAwesome, and SVG icons 2026-06-17 20:19:56 +07:00
totmin c858c824bc Apply show_label_background to device rendering and display keys 2026-06-17 20:19:06 +07:00
totmin f7d3b22e0b Add global show_label_background setting with UI control 2026-06-17 20:19:02 +07:00
totmin 72a17dd7aa fix: svg icons now respect icon_scale parameter 2026-06-17 15:12:17 +07:00
totmin 166c4b8719 fix: x-if->x-show for page select to fix x-model+x-for race 2026-06-17 14:00:35 +07:00
totmin 1415c8b644 fix: load FA locally instead of CDN; Alpine color input error via x-init+ 2026-06-17 13:53:48 +07:00
totmin 164660bed8 fix: imageCache key includes targetSize/faScale; Alpine color input error breaks x-if rendering 2026-06-17 13:22:05 +07:00
totmin 3d0ed33c21 fix: honor icon_scale for all icon types in grid view
- index.html: replace three conditional render paths (FA CSS icon,
  image img, label span) with a single img always routed through
  /api/render, which correctly applies icon_scale, font_size, etc.
  FA icons were previously rendered via CSS font classes, bypassing
  the backend render endpoint and ignoring icon_scale
2026-06-17 12:28:26 +07:00
totmin 9b55c6618c fix: restart periodic keys on device page switch, render display output in UI grid
- daemon.go: call stopPeriodicKeys/startPeriodicKeys after page switch
  from device gesture and auto-switch (was missing, causing goroutines
  to never restart for the correct page)
- app.js: forward display output background to /api/render preview URL
- index.html: show preview image and text from display output when key
  has no configured background/icon/label
2026-06-17 11:12:00 +07:00
totmin 5bf8f5d3b0 fix: keep active page on config save, add Cyrillic preview support, fix grid sizing
- daemon.go: save/restore active page on config reload instead of
  always activating default_page (fixes page switch on save)
- render.go: replace basicfont.Face7x13 with parseDisplayFace() for
  unicode/Cyrillic support in edit key preview
- web.go: add SSE endpoint (GET /api/events) for real-time page_changed
  events and POST /api/activate-page API
- app.js: persist active page via localStorage, listen for SSE
  page_changed events
- styles.css, index.html: fix grid sizing (width 100%, minmax(0, 1fr),
  aspect-ratio on key buttons, max-width 525px)
2026-06-17 10:48:31 +07:00
totmin f6f3950d28 Multi-action keys with tap/long-press/double-tap/hold, gesture timing, display output colors, global font, and display output JSON/color parsing
- Multi-action system: each key supports multiple actions with different triggers
  (tap, long_press, double_tap, hold_start, hold_end)
- GestureEngine: timing-based gesture detection with configurable thresholds
- New config types: KeyAction, TimingConfig, DisplayOutput
- Display output now supports JSON format (text/background/text_color) and
  first-line-as-hex-color format for dynamic key backgrounds
- Display background colors are reflected in the web UI on the grid
- renderUnicodeText/renderUnicodeTextOnImage accept custom text color (fg)
- Global font setting (medium/regular) in Settings UI
- PageManager.defaultFont used as fallback for per-key font
- Alpine.js bundled locally (no CDN dependency)
- Web UI: action tabs (Tap/Long Press/Double Tap/Hold), unified More section
  with appearance + display settings, gesture timing sliders in Settings
- Grid: subtle action type icons in top-left corner matching display indicator style
- Backward compatible: old config 'action' field auto-migrated to 'actions' array
- M+ 1m font files in assets/ for reference
- Updated config.example.json and README with all new features
2026-06-17 00:09:48 +07:00
totmin 35eb27738d Multi-device support, dynamic grid adaptation, keyboard action
- Multi-device: OpenAllDecks(), GET /api/decks, per-deck PageManagers
- Dynamic grid: frontend adapts to connected device layout
- Keyboard action: new action type for sending key combos via wtype/xdotool
- Key recorder UI: click-based modifier toggles + single key capture
- Config: remove hardcoded maxKey validation
- Screensaver and auto-switch sync across all decks
2026-06-16 22:51:39 +07:00
totmin 10250b776d Initial commit: Stream Deck daemon with web UI
- Web-based key editor (Alpine.js SPA)
- Actions: shell commands, scripts, built-in media/volume/brightness, page switching
- Keyboard shortcut action (wtype/xdotool)
- On-device display with periodic command output
- Auto page switching (Hyprland, Sway, Niri, GNOME, KDE, X11)
- Screensaver with idle detection
- Config hot-reload
- Multi-device support
2026-06-16 22:35:14 +07:00
4 changed files with 10 additions and 147 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
/streamdeck-lets-go
streamdeck-lets-go
*.test
*.out
*.exe
-137
View File
@@ -1,137 +0,0 @@
package main
import (
"bytes"
"context"
"encoding/json"
"flag"
"fmt"
"log/slog"
"net/http"
"os"
"os/signal"
"strings"
"syscall"
_ "image/gif"
_ "image/jpeg"
_ "image/png"
"streamdeck-lets-go/internal/config"
"streamdeck-lets-go/internal/daemon"
"streamdeck-lets-go/internal/deck"
)
func main() {
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelInfo})))
fs := flag.NewFlagSet("streamdeck-lets-go", flag.ExitOnError)
configPath := fs.String("config", "", "path to config.json (default: ~/.config/streamdeck-lets-go/config.json)")
httpAddr := fs.String("addr", ":9090", "web UI listen address")
startPage := fs.String("page", "", "page to activate on startup (default: config's default_page)")
noDeck := fs.Bool("no-deck", false, "run without Stream Deck hardware (config editing only)")
verbose := fs.Bool("v", false, "verbose output")
if len(os.Args) < 2 || os.Args[1] == "--help" || os.Args[1] == "-help" || os.Args[1] == "-h" {
fmt.Fprintf(os.Stderr, "Usage: streamdeck-lets-go [flags] [command]\n\n")
fmt.Fprintf(os.Stderr, "Commands:\n")
fmt.Fprintf(os.Stderr, " daemon run the Stream Deck daemon with web UI (default)\n")
fmt.Fprintf(os.Stderr, " switch switch running daemon to a page (e.g. 'switch games')\n")
fmt.Fprintf(os.Stderr, " discover list connected Stream Decks\n")
fmt.Fprintf(os.Stderr, "\nFlags:\n")
fs.PrintDefaults()
os.Exit(0)
}
cmd := os.Args[1]
args := os.Args[2:]
switch cmd {
case "daemon":
fs.Parse(args)
case "switch":
fs.Parse(args)
if fs.NArg() == 0 {
fmt.Fprintf(os.Stderr, "Usage: streamdeck-lets-go switch <page>\n")
os.Exit(1)
}
if err := switchToPage(*httpAddr, fs.Arg(0)); err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
}
fmt.Printf("switched to page %q\n", fs.Arg(0))
return
case "discover":
discover()
return
default:
if cmd == "serve" {
fmt.Fprintf(os.Stderr, "streamdeck-lets-go: 'serve' removed; use 'daemon --no-deck' instead\n")
os.Exit(1)
}
fs.Parse(os.Args[1:])
}
if *verbose {
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelDebug})))
}
cfg, err := config.LoadConfig(*configPath)
if err != nil {
slog.Error("config", "error", err)
os.Exit(1)
}
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer cancel()
httpEnabled := true
if err := daemon.Run(ctx, cfg, daemon.RunOptions{
ConfigPath: *configPath,
HTTPAddr: *httpAddr,
HTTPEnabled: httpEnabled,
NoDeck: *noDeck,
StartPage: *startPage,
}); err != nil {
slog.Error("run", "error", err)
os.Exit(1)
}
}
func discover() {
devices, err := deck.EnumerateDevices()
if err != nil {
slog.Error("discover", "error", err)
os.Exit(1)
}
if len(devices) == 0 {
fmt.Println("No Stream Deck devices found.")
return
}
fmt.Printf("Found %d Stream Deck(s):\n", len(devices))
for _, d := range devices {
fmt.Printf(" Serial: %s Model: %s PID: 0x%04x\n", d.Serial, d.Model, d.PID)
}
}
// switchToPage tells the running daemon (at httpAddr) to activate the given page
// by POSTing to its /api/activate-page endpoint.
func switchToPage(httpAddr, page string) error {
host := httpAddr
if strings.HasPrefix(host, ":") {
host = "127.0.0.1" + host
}
url := "http://" + host + "/api/activate-page"
body, _ := json.Marshal(map[string]string{"page": page})
resp, err := http.Post(url, "application/json", bytes.NewReader(body))
if err != nil {
return fmt.Errorf("daemon not running? %v", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("switch failed (HTTP %d)", resp.StatusCode)
}
return nil
}
+4 -4
View File
@@ -1,7 +1,7 @@
pkgbase = streamdeck-lets-go-git
pkgdesc = Lightweight daemon for controlling Elgato Stream Deck devices with a built-in web UI
pkgver = 0.1.0
pkgrel = 3
pkgver = r0.unknown
pkgrel = 1
url = https://github.com/totmin/streamdeck-lets-go
arch = x86_64
arch = aarch64
@@ -14,8 +14,8 @@ pkgbase = streamdeck-lets-go-git
provides = streamdeck-lets-go
conflicts = streamdeck-lets-go
source = streamdeck-lets-go-git::git+https://github.com/totmin/streamdeck-lets-go.git
source = streamdeck-lets-go.service
source = 90-streamdeck.rules
source = packaging/streamdeck-lets-go.service
source = packaging/90-streamdeck.rules
b2sums = SKIP
b2sums = SKIP
b2sums = SKIP
+5 -5
View File
@@ -3,7 +3,7 @@
pkgname=streamdeck-lets-go-git
_giturl=https://github.com/totmin/streamdeck-lets-go.git
pkgver=0.1.0
pkgrel=3
pkgrel=1
pkgdesc="Lightweight daemon for controlling Elgato Stream Deck devices with a built-in web UI"
arch=('x86_64' 'aarch64')
url="https://github.com/totmin/streamdeck-lets-go"
@@ -16,8 +16,8 @@ provides=('streamdeck-lets-go')
conflicts=('streamdeck-lets-go')
source=("${pkgname}::git+${_giturl}"
"streamdeck-lets-go.service"
"90-streamdeck.rules")
"packaging/streamdeck-lets-go.service"
"packaging/90-streamdeck.rules")
b2sums=('SKIP'
'SKIP'
'SKIP')
@@ -40,9 +40,9 @@ package() {
install -Dm755 streamdeck-lets-go "${pkgdir}/usr/bin/streamdeck-lets-go"
install -Dm644 "${srcdir}/streamdeck-lets-go.service" \
install -Dm644 "${srcdir}/packaging/streamdeck-lets-go.service" \
"${pkgdir}/usr/lib/systemd/user/streamdeck-lets-go.service"
install -Dm644 "${srcdir}/90-streamdeck.rules" \
install -Dm644 "${srcdir}/packaging/90-streamdeck.rules" \
"${pkgdir}/usr/lib/udev/rules.d/90-streamdeck.rules"
}