build: package the desktop instead of the shell
The install list loses the dock, the window helper, the Chrome window arbiter, the notification wrapper, the compositor and bar configs and the GTK icon and stylesheet machinery, and gains a look and feel package, a colour scheme, window rules, Kiosk restrictions and two supervised user services. Dependencies follow: Plasma and SDDM in, sway, waybar, mako and gtk-layer-shell out. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
d87990f0ac
commit
6e4786f448
+44
-27
@@ -1,20 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""Apply the room's UI scale to the whole classroom session.
|
||||
"""Make everything in the room bigger or smaller, once.
|
||||
|
||||
UI_SCALE is a property of the television, not of one program, so it is
|
||||
applied where it reaches everything: sway's output scale. Chrome's tabs
|
||||
and omnibox, its menus, VLC, and the classroom's own dock and
|
||||
notifications are then all measured in the same scaled logical pixels.
|
||||
|
||||
The display mode is untouched — the panel stays at its native
|
||||
resolution. Only the logical coordinate space shrinks, which is what
|
||||
makes everything drawn in it larger.
|
||||
|
||||
Run from the sway config before anything else starts, so surfaces come
|
||||
up at the right size rather than being resized underneath themselves.
|
||||
UI_SCALE is the display's scale factor, so it scales the browser, VLC, the
|
||||
bar and every dialog together rather than each of them separately. Plasma
|
||||
owns display configuration, so this asks Plasma's own tool to do it — which
|
||||
is the whole of what replaced the compositor-specific version.
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -28,27 +22,50 @@ sys.path.insert(
|
||||
from classroom_config import read_device_config, ui_scale # noqa: E402
|
||||
|
||||
|
||||
def main():
|
||||
scale = ui_scale(read_device_config())
|
||||
def outputs():
|
||||
"""Every connected display, by name.
|
||||
|
||||
The JSON form rather than the human one: kscreen-doctor's plain output
|
||||
is full of terminal colour codes, and a regular expression over it
|
||||
silently matched nothing.
|
||||
"""
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["swaymsg", "output", "*", "scale", f"{scale:g}"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
except OSError as error:
|
||||
listing = subprocess.run(
|
||||
["kscreen-doctor", "-j"],
|
||||
capture_output=True, text=True, timeout=20, check=False,
|
||||
).stdout
|
||||
found = json.loads(listing or "{}").get("outputs") or []
|
||||
except (OSError, subprocess.SubprocessError, ValueError) as error:
|
||||
print(f"classroom-scale: {error}", file=sys.stderr)
|
||||
return 1
|
||||
return []
|
||||
|
||||
if result.returncode != 0:
|
||||
print(
|
||||
f"classroom-scale: {result.stderr.strip() or 'sway refused the scale'}",
|
||||
file=sys.stderr,
|
||||
return [
|
||||
output["name"] for output in found
|
||||
if output.get("name") and output.get("connected", True)
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
# classroom_config clamps a nonsense or out-of-range value rather than
|
||||
# obeying it, so a mistyped UI_SCALE cannot leave a room unusable.
|
||||
scale = ui_scale(read_device_config())
|
||||
found = outputs()
|
||||
|
||||
if not found:
|
||||
print("classroom-scale: no outputs", file=sys.stderr)
|
||||
return 0
|
||||
|
||||
for output in found:
|
||||
result = subprocess.run(
|
||||
["kscreen-doctor", f"output.{output}.scale.{scale}"],
|
||||
capture_output=True, text=True, timeout=20, check=False,
|
||||
)
|
||||
return 1
|
||||
|
||||
print(f"classroom-scale: session scale {scale:g}")
|
||||
if result.returncode == 0:
|
||||
print(f"classroom-scale: {output} scale {scale}")
|
||||
else:
|
||||
print(f"classroom-scale: {output}: {result.stderr.strip()}",
|
||||
file=sys.stderr)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user