Files
deckrotate/ui/js/args.js
T
Ziad ArafatandClaude Opus 5.5 81d2a986b6 Add deckrotate: Steam Deck screen rotation for Plasma
Go daemon reads the controller's accelerometer from hidraw (re-enabling
the IMU that Steam switches off), debounces it into an orientation and
rotates eDP-1 through kscreen-doctor in auto mode, or offers a
layer-shell tap-to-rotate button in manual mode, with a persistent lock.

Includes a D-Bus service, a CLI for global shortcuts (kglobalaccel
service file), a Plasma system tray applet, a systemd user unit and
hardware notes from probing the Deck OLED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 16:18:17 -07:00

38 lines
1.1 KiB
JavaScript

.pragma library
// Parses the overlay's command line: --vertical top|bottom --horizontal left|right --angle 0|90|180|270
function parse(argv) {
const out = { vertical: "bottom", horizontal: "right", angle: 0 }
for (let i = 0; i + 1 < argv.length; i++) {
const v = argv[i + 1]
switch (argv[i]) {
case "--vertical":
if (v === "top" || v === "bottom") out.vertical = v
break
case "--horizontal":
if (v === "left" || v === "right") out.horizontal = v
break
case "--angle": {
const n = Number(v)
if ([0, 90, 180, 270].includes(n)) out.angle = n
break
}
}
}
return out
}
// The Deck's built-in panel, so the button never lands on an external monitor.
function panelScreen(screens) {
return screens.find(s => s.name.startsWith("eDP")) ?? screens[0] ?? null
}
function edges(opts) {
return {
top: opts.vertical === "top",
bottom: opts.vertical === "bottom",
left: opts.horizontal === "left",
right: opts.horizontal === "right"
}
}