feat(flatpak): Flatpak packaging with Background-portal autostart

deckhud-ui launcher replaces the qml runner where it isn't available,
LayerShellQt is built as a module, Go modules come from proxy.golang.org
archives so the build is offline. Adds desktop entry, AppStream
metainfo, icon, offscreen-rendered store screenshots, and makes 'run'
the default command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013UzjWSBjtVZ2zi8fJxS2hH
This commit is contained in:
ziadarafatandClaude Opus 5.5 committed 2026-10-30 16:56:10 -06:00
1 parent 4dbe8bcb2b
commit 8308128fed
23 files changed
+509 -19

No files matched your search

+4
View File
@@ -1,3 +1,7 @@
/bin/
*.test
/testdata/hid/local/
/vendor/
/.flatpak-builder/
/build-flatpak/
/.flatpak-repo/
+14 -4
View File
@@ -4,9 +4,10 @@ On-screen HUD for Steam Input in **KDE Plasma (Wayland) Desktop Mode** on the St
- **Radial menu HUD**: see which radial item you're selecting, as in Game Mode.
- **Key-chord toasts**: see which keys a button just sent (`[R4] → Meta + Shift + .`).
- **Action set / layer banner**: see when you switch sets or hold a layer (cheat sheet next).
- **Layer cheat sheet**: see what every control does when you switch action sets or hold a layer,
or on demand with `deckhudd peek`. Bind that command to a KDE shortcut, then map a Steam button to it.
Overlays are translucent and click-through, and follow your KDE accent colour, including wallpaper-derived accents.
Overlays are translucent and click-through, and follow your KDE accent colour live (via the settings portal), even with a wallpaper slideshow.
> Status: early development. See [docs/PLAN.md](docs/PLAN.md).
@@ -15,7 +16,7 @@ Overlays are translucent and click-through, and follow your KDE accent colour, i
`deckhudd` (Go) reads the Deck controller's raw HID reports passively alongside Steam. It also parses
your active Steam Input config, using Steam's `controller.txt` log to find it, and replays Steam's
activator/layer/radial logic. Events go over a token-protected loopback WebSocket to a QML overlay,
which runs on SteamOS's own Qt with LayerShellQt and Kirigami. Nothing touches the read-only root, and
which runs on SteamOS's own Qt with LayerShellQt. Nothing touches the read-only root, and
nothing needs root.
## Try it
@@ -29,9 +30,18 @@ mise run build
./bin/deckhudd demo ui # scripted preview of the overlay (no controller needed)
./bin/deckhudd run ui # the real thing, from the source tree
./bin/deckhudd events # no overlay; print events as JSON lines
./bin/deckhudd peek # toggle the layer cheat sheet in the running daemon
```
## Install (per user)
![Radial menu](docs/screenshots/radial.png)
## Install
### Flatpak
See [packaging/flatpak](packaging/flatpak/README.md). Flathub submission is in progress.
### From source (per user)
```sh
mise run install
+21 -5
View File
@@ -15,6 +15,7 @@ import (
"time"
"github.com/RustyRaptor/deckhud/internal/appwatch"
"github.com/RustyRaptor/deckhud/internal/autostart"
"github.com/RustyRaptor/deckhud/internal/binding"
"github.com/RustyRaptor/deckhud/internal/control"
"github.com/RustyRaptor/deckhud/internal/hid"
@@ -24,10 +25,12 @@ import (
const usage = `usage: deckhudd <command>
commands:
run [ui-dir] run the daemon and launch the overlay from ui-dir
run [ui-dir] (default) run the daemon and launch the overlay from ui-dir
(default: ../share/deckhud/ui next to the binary)
events run without the overlay, printing events as JSON lines
demo [ui-dir] play a scripted session through the overlay (no controller needed)
autostart on|off start with Plasma via the Background portal (Flatpak);
native installs use the systemd user unit instead
peek toggle the cheat sheet in the running daemon
(bind it to a KDE shortcut, then map a Steam button to that)
find print the Deck controller hidraw device
@@ -38,8 +41,7 @@ commands:
func main() {
if len(os.Args) < 2 {
fmt.Fprint(os.Stderr, usage)
os.Exit(2)
os.Args = append(os.Args, "run") // launched from the menu or autostart
}
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
defer stop()
@@ -51,7 +53,7 @@ func main() {
if len(os.Args) > 2 {
dir = os.Args[2]
}
err = run(ctx, runOpts{uiDir: dir})
err = run(ctx, runOpts{uiDir: dir, autostart: true})
case "demo":
dir := defaultUIDir()
if len(os.Args) > 2 {
@@ -60,6 +62,12 @@ func main() {
err = demo(ctx, dir)
case "events":
err = run(ctx, runOpts{print: true})
case "autostart":
enable := len(os.Args) < 3 || os.Args[2] != "off"
var granted bool
if granted, err = autostart.Request(ctx, enable, []string{"deckhudd", "run"}); err == nil {
fmt.Println("autostart:", map[bool]string{true: "on", false: "off"}[granted])
}
case "peek":
err = control.Send(control.DefaultPath(), "peek")
case "find":
@@ -156,9 +164,17 @@ func record(ctx context.Context, path string) error {
return err
}
// steamRoot finds the Steam data directory of a native or Flatpak Steam.
func steamRoot() string {
home, _ := os.UserHomeDir()
return filepath.Join(home, ".local", "share", "Steam")
native := filepath.Join(home, ".local", "share", "Steam")
flatpak := filepath.Join(home, ".var", "app", "com.valvesoftware.Steam", ".local", "share", "Steam")
if _, err := os.Stat(native); err != nil {
if _, err := os.Stat(flatpak); err == nil {
return flatpak
}
}
return native
}
// activeConfig replays Steam's controller log and loads the config it points at.
+27 -6
View File
@@ -17,6 +17,7 @@ import (
"github.com/RustyRaptor/deckhud/internal/accent"
"github.com/RustyRaptor/deckhud/internal/appwatch"
"github.com/RustyRaptor/deckhud/internal/autostart"
"github.com/RustyRaptor/deckhud/internal/control"
"github.com/RustyRaptor/deckhud/internal/engine"
"github.com/RustyRaptor/deckhud/internal/hid"
@@ -27,9 +28,10 @@ import (
const protocolVersion = 1
type runOpts struct {
uiDir string // directory holding main.qml; empty = don't launch the UI
print bool // print events as JSON lines on stdout
script []demoStep // play this instead of reading the controller
uiDir string // directory holding main.qml; empty = don't launch the UI
print bool // print events as JSON lines on stdout
autostart bool // ask the Background portal for autostart (Flatpak)
script []demoStep // play this instead of reading the controller
}
// daemon owns the engine and the config it was built from.
@@ -69,6 +71,13 @@ func run(ctx context.Context, opts runOpts) error {
defer srv.Close()
url := fmt.Sprintf("ws://%s/%s", ln.Addr(), token)
if opts.autostart && os.Getenv("FLATPAK_ID") != "" {
go func() { // ask once; KDE remembers the answer
if _, err := autostart.Request(ctx, true, []string{"deckhudd", "run"}); err != nil {
fmt.Fprintln(os.Stderr, "deckhudd: autostart:", err)
}
}()
}
if err := d.reload(true); err != nil {
fmt.Fprintln(os.Stderr, "deckhudd: config:", err)
}
@@ -128,7 +137,8 @@ func (d *daemon) command(cmd string) error {
func accentMsg(hex string) map[string]any { return map[string]any{"type": "accent", "color": hex} }
func (d *daemon) configMsg() map[string]any {
return map[string]any{"type": "config", "app": d.app.App, "title": d.cfg.Title}
icons := filepath.Join(steamRoot(), "tenfoot", "resource", "images", "library", "controller", "binding_icons")
return map[string]any{"type": "config", "app": d.app.App, "title": d.cfg.Title, "iconDir": "file://" + icons}
}
func (d *daemon) emit(v any) {
@@ -228,11 +238,22 @@ func (d *daemon) readController(ctx context.Context) {
}
}
// uiCommand prefers the bundled deckhud-ui launcher (Flatpak, packaged
// installs) and falls back to the system qml runner.
func uiCommand(ctx context.Context, dir, url string) *exec.Cmd {
if exe, err := os.Executable(); err == nil {
launcher := filepath.Join(filepath.Dir(exe), "deckhud-ui")
if _, err := os.Stat(launcher); err == nil {
return exec.CommandContext(ctx, launcher, filepath.Join(dir, "main.qml"), url)
}
}
return exec.CommandContext(ctx, "/usr/lib/qt6/bin/qml", filepath.Join(dir, "main.qml"), "--", url)
}
// superviseUI keeps the QML overlay running, restarting it if it exits.
func superviseUI(ctx context.Context, dir, url string) {
qml := "/usr/lib/qt6/bin/qml"
for ctx.Err() == nil {
cmd := exec.CommandContext(ctx, qml, filepath.Join(dir, "main.qml"), "--", url)
cmd := uiCommand(ctx, dir, url)
cmd.Env = append(os.Environ(), "QT_FORCE_STDERR_LOGGING=1")
cmd.Stdout, cmd.Stderr = os.Stderr, os.Stderr
cmd.SysProcAttr = &syscall.SysProcAttr{Pdeathsig: syscall.SIGTERM}
@@ -0,0 +1,12 @@
[Desktop Entry]
Type=Application
Name=deckhud
GenericName=Steam Input HUD
Comment=On-screen radial menus, key-chord feedback and layer cheat sheets for Steam Input in Desktop Mode
Exec=deckhudd run
Icon=io.github.RustyRaptor.deckhud
Terminal=false
StartupNotify=false
NoDisplay=false
Categories=Utility;
Keywords=steam;deck;controller;gamepad;radial;overlay;hud;input;
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>io.github.RustyRaptor.deckhud</id>
<name>deckhud</name>
<summary>See your Steam Input radial menus, key chords and layers on the desktop</summary>
<metadata_license>CC0-1.0</metadata_license>
<project_license>MIT</project_license>
<developer id="io.github.rustyraptor">
<name>RustyRaptor</name>
</developer>
<description>
<p>
deckhud brings the Steam Deck's controller feedback to KDE Plasma's Desktop Mode, where Steam
does not draw its own overlay. It shows translucent, click-through overlays tinted with your
KDE accent colour:
</p>
<ul>
<li>Radial menu HUD: see which radial item your stick is pointing at before you let go</li>
<li>Key-chord toasts: see which keys a button just sent, for example R4 → Meta + Shift + .</li>
<li>Layer cheat sheet: see what every control does when you switch action sets or hold a layer</li>
</ul>
<p>
deckhud reads your existing Steam Input layout and the controller's state; it never changes
either. It needs KDE Plasma on Wayland and a Steam Deck's built-in controller.
</p>
</description>
<launchable type="desktop-id">io.github.RustyRaptor.deckhud.desktop</launchable>
<url type="homepage">https://github.com/RustyRaptor/deckhud</url>
<url type="bugtracker">https://github.com/RustyRaptor/deckhud/issues</url>
<url type="vcs-browser">https://github.com/RustyRaptor/deckhud</url>
<screenshots>
<screenshot type="default">
<caption>Radial menu selection</caption>
<image>https://raw.githubusercontent.com/RustyRaptor/deckhud/v0.1.0/docs/screenshots/radial.png</image>
</screenshot>
<screenshot>
<caption>Key-chord feedback</caption>
<image>https://raw.githubusercontent.com/RustyRaptor/deckhud/v0.1.0/docs/screenshots/chords.png</image>
</screenshot>
<screenshot>
<caption>Layer cheat sheet</caption>
<image>https://raw.githubusercontent.com/RustyRaptor/deckhud/v0.1.0/docs/screenshots/sheet.png</image>
</screenshot>
</screenshots>
<categories>
<category>Utility</category>
</categories>
<keywords>
<keyword>Steam</keyword>
<keyword>Steam Deck</keyword>
<keyword>controller</keyword>
<keyword>radial menu</keyword>
<keyword>overlay</keyword>
</keywords>
<requires>
<display_length compare="ge">768</display_length>
</requires>
<supports>
<control>gamepad</control>
</supports>
<content_rating type="oars-1.1"/>
<branding>
<color type="primary" scheme_preference="light">#c9c5f2</color>
<color type="primary" scheme_preference="dark">#2b2a3a</color>
</branding>
<releases>
<release version="0.1.0" date="2026-10-30">
<description>
<p>First release: radial menu HUD, key-chord toasts and layer cheat sheet for KDE Plasma on Wayland.</p>
</description>
</release>
</releases>
</component>
+24
View File
@@ -0,0 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128">
<defs>
<linearGradient id="bg" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#2b2a3a"/>
<stop offset="1" stop-color="#16151f"/>
</linearGradient>
</defs>
<rect x="4" y="4" width="120" height="120" rx="26" fill="url(#bg)"/>
<g transform="translate(64 64)" fill="none" stroke-width="22">
<circle r="36" stroke="#3d3b52"/>
<!-- highlighted wedge: one sixth of the ring, centred at the top -->
<path d="M -18 -31.18 A 36 36 0 0 1 18 -31.18" stroke="#9a93e3"/>
</g>
<g transform="translate(64 64)" stroke="#16151f" stroke-width="3">
<line x1="0" y1="-25" x2="0" y2="-47" transform="rotate(30)"/>
<line x1="0" y1="-25" x2="0" y2="-47" transform="rotate(90)"/>
<line x1="0" y1="-25" x2="0" y2="-47" transform="rotate(150)"/>
<line x1="0" y1="-25" x2="0" y2="-47" transform="rotate(210)"/>
<line x1="0" y1="-25" x2="0" y2="-47" transform="rotate(270)"/>
<line x1="0" y1="-25" x2="0" y2="-47" transform="rotate(330)"/>
</g>
<circle cx="64" cy="64" r="16" fill="#9a93e3"/>
<circle cx="64" cy="64" r="7" fill="#16151f"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/RustyRaptor/deckhud
go 1.27.3
go 1.25
require (
github.com/coder/websocket v1.8.15
+72
View File
@@ -0,0 +1,72 @@
// Package autostart asks the XDG Background portal to start deckhud with the
// session. Sandboxed apps can't install systemd units or autostart files
// themselves; the portal does it after asking the user.
package autostart
import (
"context"
"fmt"
"github.com/godbus/dbus/v5"
)
const (
portalDest = "org.freedesktop.portal.Desktop"
portalPath = "/org/freedesktop/portal/desktop"
)
// Request enables (or disables) autostart with commandline and reports
// whether the portal granted it.
func Request(ctx context.Context, enable bool, commandline []string) (bool, error) {
conn, err := dbus.ConnectSessionBus()
if err != nil {
return false, err
}
defer conn.Close()
token := "deckhud_autostart"
sender := conn.Names()[0][1:] // ":1.42" -> "1.42"
for i := range sender {
if sender[i] == '.' {
sender = sender[:i] + "_" + sender[i+1:]
}
}
handle := dbus.ObjectPath("/org/freedesktop/portal/desktop/request/" + sender + "/" + token)
if err := conn.AddMatchSignalContext(ctx,
dbus.WithMatchObjectPath(handle),
dbus.WithMatchInterface("org.freedesktop.portal.Request"),
dbus.WithMatchMember("Response"),
); err != nil {
return false, err
}
signals := make(chan *dbus.Signal, 1)
conn.Signal(signals)
opts := map[string]dbus.Variant{
"handle_token": dbus.MakeVariant(token),
"reason": dbus.MakeVariant("Show the Steam Input HUD whenever you use Desktop Mode"),
"autostart": dbus.MakeVariant(enable),
"commandline": dbus.MakeVariant(commandline),
}
var got dbus.ObjectPath
if err := conn.Object(portalDest, portalPath).CallWithContext(ctx,
"org.freedesktop.portal.Background.RequestBackground", 0, "", opts).Store(&got); err != nil {
return false, err
}
for {
select {
case <-ctx.Done():
return false, ctx.Err()
case s := <-signals:
if s.Path != got || len(s.Body) < 2 {
continue
}
if code, _ := s.Body[0].(uint32); code != 0 {
return false, fmt.Errorf("autostart: request denied (response %d)", code)
}
results, _ := s.Body[1].(map[string]dbus.Variant)
granted, _ := results["autostart"].Value().(bool)
return granted, nil
}
}
}
+7
View File
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.21)
project(deckhud-ui LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
find_package(Qt6 REQUIRED COMPONENTS Gui Qml)
add_executable(deckhud-ui main.cpp)
target_link_libraries(deckhud-ui PRIVATE Qt6::Gui Qt6::Qml)
install(TARGETS deckhud-ui)
+22
View File
@@ -0,0 +1,22 @@
// deckhud-ui: loads the overlay QML. Replaces the system `qml` runner where
// it isn't available (the Flatpak runtime only ships it in the SDK).
// Usage: deckhud-ui <main.qml> <ws://daemon-url>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QUrl>
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
app.setApplicationName(QStringLiteral("deckhud"));
app.setDesktopFileName(QStringLiteral("io.github.RustyRaptor.deckhud"));
if (argc < 2) {
qCritical("usage: deckhud-ui <main.qml> <ws://url>");
return 2;
}
QQmlApplicationEngine engine;
engine.load(QUrl::fromLocalFile(QString::fromLocal8Bit(argv[1])));
if (engine.rootObjects().isEmpty())
return 1;
return app.exec();
}
+34
View File
@@ -0,0 +1,34 @@
# Flatpak
Local build and install (needs `org.flatpak.Builder` from Flathub):
```sh
flatpak run org.flatpak.Builder --user --force-clean --install-deps-from=flathub --install \
--state-dir=.flatpak-builder build-flatpak packaging/flatpak/io.github.RustyRaptor.deckhud.yml
flatpak run io.github.RustyRaptor.deckhud # asks once to start with Plasma
flatpak run io.github.RustyRaptor.deckhud peek # toggle the cheat sheet
flatpak run io.github.RustyRaptor.deckhud autostart off
```
## Flathub
The Flathub manifest is this file with the `type: dir` source replaced by the release tag:
```yaml
- type: git
url: https://github.com/RustyRaptor/deckhud.git
tag: vX.Y.Z
commit: <full sha of the tag>
```
When Go dependencies change, regenerate the `proxy.golang.org` archive sources and the inline
`vendor/modules.txt` (`go mod vendor` prints it) in the manifest.
### Permission rationale (for reviewers)
| Permission | Why |
|---|---|
| `--socket=wayland` only | The overlay is a `wlr-layer-shell` surface, which exists only on Wayland. No X11 fallback is possible |
| `--device=all` | Reads the Steam Deck controller's raw HID reports from `/dev/hidraw*` (read-only, alongside Steam). `--device=input` covers only `/dev/input/event*` |
| `~/.local/share/Steam:ro`, Flatpak Steam's equivalent `:ro` | Reads Steam Input layouts, `logs/controller.txt` (which layout is active) and binding icons. Never writes |
| (portals) | Settings portal for the accent colour, Background portal for autostart |
@@ -0,0 +1,88 @@
# Development manifest: builds the working tree. The Flathub manifest is the
# same with the deckhud source switched to a git tag (see packaging/flatpak/README.md).
id: io.github.RustyRaptor.deckhud
runtime: org.kde.Platform
runtime-version: '6.11'
sdk: org.kde.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.golang
command: deckhudd
finish-args:
# Overlay on KDE Plasma (wlr-layer-shell).
- --socket=wayland
# Raw controller state from /dev/hidraw*; no narrower permission covers hidraw.
- --device=all
# Read-only: Steam Input layouts, controller.txt (active app) and binding icons.
- --filesystem=~/.local/share/Steam:ro
- --filesystem=~/.var/app/com.valvesoftware.Steam/.local/share/Steam:ro
modules:
- name: layer-shell-qt
buildsystem: cmake-ninja
config-opts:
- -DBUILD_TESTING=OFF
sources:
- type: git
url: https://invent.kde.org/plasma/layer-shell-qt.git
tag: v6.7.3
commit: 4761442255ded65396ac3cd2af902969ef5dd5d8
- name: deckhud
buildsystem: simple
build-options:
append-path: /usr/lib/sdk/golang/bin
env:
CGO_ENABLED: '0'
GOFLAGS: -mod=vendor -trimpath
GOTOOLCHAIN: local
GOCACHE: /run/build/deckhud/.gocache
build-commands:
- go build -ldflags "-s -w" -o /app/bin/deckhudd ./cmd/deckhudd
- cmake -S launcher -B build-launcher -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/app
- cmake --build build-launcher
- cmake --install build-launcher
- install -Dm644 -t /app/share/deckhud/ui ui/main.qml
- install -Dm644 -t /app/share/deckhud/ui/components ui/components/*.qml
- install -Dm644 data/io.github.RustyRaptor.deckhud.desktop -t /app/share/applications
- install -Dm644 data/io.github.RustyRaptor.deckhud.metainfo.xml -t /app/share/metainfo
- install -Dm644 data/io.github.RustyRaptor.deckhud.svg -t /app/share/icons/hicolor/scalable/apps
sources:
- type: dir
path: ../..
skip:
- .flatpak-builder
- build-flatpak
- bin
- vendor
# Go modules, rebuilt into vendor/ so the build works offline.
- type: archive
url: https://proxy.golang.org/github.com/coder/websocket/@v/v1.8.15.zip
sha256: 4f1d890bc5131f335737bbb6241e3958758c8774b3e6d1c905f713f604af6209
strip-components: 3
dest: vendor/github.com/coder/websocket
- type: archive
url: https://proxy.golang.org/github.com/godbus/dbus/v5/@v/v5.2.4.zip
sha256: 2a3a2996c274cbb735aa7f634dbcc0b292c0dff154447896d3a95955d078fb83
strip-components: 4
dest: vendor/github.com/godbus/dbus/v5
- type: archive
url: https://proxy.golang.org/golang.org/x/sys/@v/v0.27.0.zip
sha256: e11dcde2289e0d45eabb06ea59aab05080870bab5753f524ed26df23ec8bddee
strip-components: 3
dest: vendor/golang.org/x/sys
- type: inline
dest: vendor
dest-filename: modules.txt
contents: |
# github.com/coder/websocket v1.8.15
## explicit; go 1.23
github.com/coder/websocket
github.com/coder/websocket/internal/bpool
github.com/coder/websocket/internal/errd
github.com/coder/websocket/internal/util
github.com/coder/websocket/internal/wsjs
# github.com/godbus/dbus/v5 v5.2.4
## explicit; go 1.20
github.com/godbus/dbus/v5
# golang.org/x/sys v0.27.0
## explicit; go 1.18
golang.org/x/sys/unix
+1
View File
@@ -0,0 +1 @@
{"type":"radial","radial":{"phase":"open","source":"right_joystick","items":[{"icon":"ghost_045_move_0010.png","keys":["Ctrl","V"]},{"icon":"ghost_070_setting_0300.png","keys":["Ctrl","Z"]},{"icon":"ghost_040_act_0331.png","keys":["Ctrl","X"]},{"icon":"ghost_070_setting_0303.png","keys":["Ctrl","C"]},{"icon":"ghost_070_setting_0304.png","keys":["Ctrl","A"]},{"icon":"ghost_075_utility_020.png","keys":["Ctrl","S"]},{"icon":"ghost_070_setting_0301.png","keys":["Ctrl","Shift","Z"]}],"index":0}}
+97
View File
@@ -0,0 +1,97 @@
import QtQuick
import "../../ui/components"
// Renders store screenshots offscreen:
// QML_XHR_ALLOW_FILE_READ=1 QT_QPA_PLATFORM=offscreen qml packaging/screenshots/render.qml -- <out-dir>
Window {
id: win
width: 1280
height: 800
visible: true
readonly property string outDir: Qt.application.arguments[Qt.application.arguments.length - 1]
property var steps: []
function load(name) {
const xhr = new XMLHttpRequest()
xhr.open("GET", Qt.resolvedUrl(name), false)
xhr.send()
return JSON.parse(xhr.responseText)
}
Rectangle {
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0; color: "#3a4a63" }
GradientStop { position: 1; color: "#1d2433" }
}
Grid {
anchors.centerIn: parent
columns: 8
spacing: 60
Repeater {
model: 40
Rectangle { width: 90; height: 60; radius: 8; color: Qt.rgba(1, 1, 1, 0.05) }
}
}
}
Hud {
id: hud
anchors.fill: parent
accent: "#9a93e3"
sheetTimeout: 100000
toasts.timeout: 100000
}
Image {
id: icon
visible: false
source: "../../data/io.github.RustyRaptor.deckhud.svg"
sourceSize: Qt.size(256, 256)
}
function shoot(item, name, next) {
item.grabToImage(r => { r.saveToFile(outDir + "/" + name); next() })
}
Timer {
interval: 600
running: true
onTriggered: {
const radial = win.load("radial.json")
radial.radial.index = 2
hud.handle(radial)
Qt.callLater(() => wait.start())
}
}
Timer {
id: wait
interval: 500
onTriggered: win.shoot(win.contentItem, "radial.png", () => {
hud.handle({ type: "radial", radial: { phase: "cancel", source: "right_joystick", index: 2 } })
hud.handle({ type: "chord", chord: { button: "R4", keys: ["Meta", "Shift", "."] } })
hud.handle({ type: "chord", chord: { button: "L5", keys: ["Ctrl", "Z"], label: "Undo" } })
hud.handle({ type: "chord", chord: { button: "A", keys: ["Enter"] } })
hud.handle({ type: "chord", chord: { button: "A", keys: ["Enter"] } })
wait2.start()
})
}
Timer {
id: wait2
interval: 500
onTriggered: win.shoot(win.contentItem, "chords.png", () => {
hud.toasts.clear()
hud.handle(win.load("state.json"))
wait3.start()
})
}
Timer {
id: wait3
interval: 500
onTriggered: win.shoot(win.contentItem, "sheet.png", () => {
icon.visible = true
win.shoot(icon, "icon.png", () => Qt.quit())
})
}
}
+1
View File
@@ -0,0 +1 @@
{"type":"state","state":{"set":"Desktop"},"sheet":{"set":"Desktop","controls":[{"glyph":"L2","source":"left_trigger","mode":"trigger","entries":[{"input":"click","activator":"Full_Press","keys":["Right Click"]},{"input":"edge","activator":"Full_Press","keys":["Right Click"]}]},{"glyph":"L1","source":"switch","mode":"switches","entries":[{"activator":"Full_Press","keys":["Alt"]}]},{"glyph":"L4","source":"switch","mode":"switches","entries":[{"activator":"Full_Press","keys":["Del"]},{"activator":"Long_Press","keys":["Action set 2"]}]},{"glyph":"L5","source":"switch","mode":"switches","entries":[{"activator":"Full_Press","keys":["Space"]}]},{"glyph":"View","source":"switch","mode":"switches","entries":[{"activator":"Double_Press","keys":["F11"]},{"activator":"Long_Press","keys":["F12"]},{"activator":"Full_Press","keys":["F10"]}]},{"glyph":"LS","source":"joystick","mode":"scrollwheel","entries":[{"input":"click","activator":"Full_Press","keys":["Middle Click"]},{"input":"scroll_clockwise","activator":"Full_Press","keys":["Scroll ↑"]},{"input":"scroll_counterclockwise","activator":"Full_Press","keys":["Scroll ↓"]}]},{"glyph":"D-pad","source":"dpad","mode":"dpad","entries":[{"input":"dpad_north","activator":"Double_Press","keys":["="]},{"input":"dpad_north","activator":"Full_Press","keys":["↑"]},{"input":"dpad_east","activator":"Full_Press","keys":["→"]},{"input":"dpad_south","activator":"Double_Press","keys":["-"]},{"input":"dpad_south","activator":"Full_Press","keys":["↓"]},{"input":"dpad_west","activator":"Full_Press","keys":["←"]}]},{"glyph":"LPad","source":"left_trackpad","mode":"2dscroll","entries":[{"input":"dpad_north","activator":"Full_Press","keys":["Scroll ↑"]},{"input":"dpad_south","activator":"Full_Press","keys":["Scroll ↓"]}]},{"glyph":"A","source":"button_diamond","mode":"four_buttons","entries":[{"activator":"Full_Press","keys":["Enter"]}]},{"glyph":"B","source":"button_diamond","mode":"four_buttons","entries":[{"activator":"Full_Press","keys":["Esc"]}]},{"glyph":"X","source":"button_diamond","mode":"four_buttons","entries":[{"activator":"Full_Press","keys":["Tab"]}]},{"glyph":"Y","source":"button_diamond","mode":"four_buttons","entries":[{"activator":"Full_Press","keys":["Shift"]}]},{"glyph":"Menu","source":"switch","mode":"switches","entries":[{"activator":"Double_Press","keys":["Screenshot"]},{"activator":"Full_Press","keys":["Meta"]}]},{"glyph":"RPad","source":"right_trackpad","mode":"absolute_mouse","entries":[]},{"glyph":"RS","source":"right_joystick","mode":"radial_menu","entries":[{"input":"touch_menu_button_1","activator":"Full_Press","keys":["Ctrl","V"]},{"input":"touch_menu_button_2","activator":"Full_Press","keys":["Ctrl","Z"]},{"input":"touch_menu_button_3","activator":"chord","keys":["Ctrl","X"]},{"input":"touch_menu_button_4","activator":"Full_Press","keys":["Ctrl","C"]},{"input":"touch_menu_button_5","activator":"Full_Press","keys":["Ctrl","A"]},{"input":"touch_menu_button_6","activator":"Full_Press","keys":["Ctrl","S"]},{"input":"touch_menu_button_7","activator":"Full_Press","keys":["Ctrl","Shift","Z"]}]},{"glyph":"R4","source":"switch","mode":"switches","entries":[{"activator":"Full_Press","keys":["Meta","Shift","."]}]},{"glyph":"R5","source":"switch","mode":"switches","entries":[{"activator":"Full_Press","keys":["Ctrl","V"]},{"activator":"Double_Press","keys":["Ctrl","Shift","V"]}]},{"glyph":"R1","source":"switch","mode":"switches","entries":[{"activator":"Full_Press","keys":["Ctrl"]}]},{"glyph":"R2","source":"right_trigger","mode":"trigger","entries":[{"input":"click","activator":"Full_Press","keys":["Left Click"]},{"input":"edge","activator":"Full_Press","keys":["Left Click"]}]}]}}
+4
View File
@@ -32,6 +32,10 @@ Item {
if (/^#[0-9a-fA-F]{6}$/.test(msg.color ?? ""))
accent = msg.color
break
case "config":
if (msg.iconDir)
iconDir = msg.iconDir
break
case "hello":
quietNextState = true
break
-3
View File
@@ -1,5 +1,4 @@
import QtQuick
import QtCore
import QtWebSockets
import org.kde.layershell as LayerShell
import "components"
@@ -26,8 +25,6 @@ Window {
Hud {
id: hud
anchors.fill: parent
iconDir: StandardPaths.writableLocation(StandardPaths.GenericDataLocation)
+ "/Steam/tenfoot/resource/images/library/controller/binding_icons"
}
WebSocket {
+7
View File
@@ -75,5 +75,12 @@ Item {
wait(600)
compare(h.accent, Qt.color("#f09cca"), "invalid colours are ignored")
}
function test_configSetsIconDir() {
const h = createTemporaryObject(hudComponent, root)
h.handle({ type: "config", app: "413080", title: "desk", iconDir: "file:///steam/icons" })
compare(h.iconDir, "file:///steam/icons")
compare(h.radial.iconDir, "file:///steam/icons")
}
}
}