Release stage_env 1.0.5 with iOmatex desktop branding and engineer terminal
|
|
@ -0,0 +1,51 @@
|
||||||
|
# stage_env 1.0.5
|
||||||
|
|
||||||
|
- Adds iOmatex wallpaper and EVAx10 launchers to the existing Debian LXDE
|
||||||
|
desktop, application menu and bottom panel. Uses the existing iOmatex logo
|
||||||
|
and EVAx10 launcher artwork from the shared client source.
|
||||||
|
- Calculates desktop launcher position at X11 login; preserves other desktop
|
||||||
|
entries and panel plugins, with backups outside LXPanel's panels directory.
|
||||||
|
- Starts the existing `itscreen-x11.service` via a narrowly scoped sudo rule.
|
||||||
|
Opening EVAx10 leaves the desktop for the dedicated client session; it does
|
||||||
|
not launch a competing player or change the next-boot service policy.
|
||||||
|
- Brands LightDM GTK greeter when installed. Other desktop environments receive
|
||||||
|
the application menu entry only. Does not change bootloader/Plymouth artwork.
|
||||||
|
- Apply by updating stage_env and logging into the desktop again. Runtime visual
|
||||||
|
verification on Debian hardware is still required before deployment.
|
||||||
|
|
||||||
|
- Bench follow-up: adds Debian 11 XFCE support after detecting the actual desktop
|
||||||
|
on g-box-8e6af561. Reuses the existing `evax10-return.desktop` identity and
|
||||||
|
`/usr/local/sbin/iomatex-desktop return` transition where available. The branding
|
||||||
|
helper is named `iomatex-desktop-branding` to avoid shadowing that owner.
|
||||||
|
- XFCE preserves the existing panel, adds one launcher, disables bottom-panel
|
||||||
|
autohide, and uses readable dark desktop labels on the light wallpaper.
|
||||||
|
- Five automated tests pass. On 192.168.0.109 the branded greeter and XFCE desktop
|
||||||
|
were visually inspected, and clicking the bottom-panel EVAx10 launcher returned
|
||||||
|
to the existing client service. This was a targeted branding installation, not
|
||||||
|
a full stage_env upgrade or a reboot test.
|
||||||
|
|
||||||
|
- User reference revision: purple wave wallpaper, rounded vector tiles, a
|
||||||
|
two-row launcher layout and compact dock replace the initial light desktop.
|
||||||
|
LightDM and Debian startup now use the supplied IOMATEX BRAIN artwork.
|
||||||
|
- Adds a bounded framebuffer preloader before the graphical session, with
|
||||||
|
explicit shutdown before LightDM or the client X11 service. Firmware/U-Boot
|
||||||
|
FIT contents are not modified. This supersedes the earlier no-splash scope.
|
||||||
|
- Actual reboot validated on g-box-8e6af561: framebuffer artwork rendered at
|
||||||
|
1920x1080 and stopped before the client; EVAx10 and all three reverse tunnels
|
||||||
|
restarted. This validates the userspace boot path, not firmware splash changes.
|
||||||
|
- Replaces the provisional io artwork with the canonical IOMATEX_APP
|
||||||
|
`assets/icon/play_store_512.png`, copied unchanged. Desktop, dock and menu
|
||||||
|
entries are named EVAx10 and share that icon.
|
||||||
|
- Field terminal: LXTerminal replaces the XTerm default through one shared
|
||||||
|
launcher. Initial settings use DejaVu Sans Mono 18, a high-contrast dark theme,
|
||||||
|
10,000 scrollback lines and Ctrl+= / Ctrl+- / Ctrl+0 font zoom shortcuts.
|
||||||
|
Interactive local Bash sessions show a Russian engineer quick reference;
|
||||||
|
`edge-help` repeats it. User font changes survive subsequent branding runs.
|
||||||
|
- Corrects the preceding icon-source entry: uses the dark EVAx10 launcher from
|
||||||
|
the published Edge installer 5.1.42 source commit c75170b6, shared with Windows
|
||||||
|
and Android. The older IOMATEX_APP IO icon is superseded. The exact source and
|
||||||
|
checksum are recorded in stage_env/desktop/app-icon-source.json.
|
||||||
|
|
||||||
|
- Final branding correction: the engineer terminal and its startup help use
|
||||||
|
iOmatex; EVAx10 names only the client application. Six desktop/terminal
|
||||||
|
regression tests pass. Release preserves stage_itscreen 1.0.33 (client 5.1.42).
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"schema": 1,
|
"schema": 1,
|
||||||
"stages": {
|
"stages": {
|
||||||
"stage_env": {
|
"stage_env": {
|
||||||
"version": "1.0.4"
|
"version": "1.0.5"
|
||||||
},
|
},
|
||||||
"stage_wifi": {
|
"stage_wifi": {
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
# Desktop artwork
|
||||||
|
|
||||||
|
- Reference: `desktop-reference.png`, supplied by user as `Descktop style for Debian .png`.
|
||||||
|
- `transition.png`: unchanged copy of user-supplied `new logo 2.png`.
|
||||||
|
- `wallpaper-purple.png`: generated with the built-in image_gen tool from the
|
||||||
|
desktop reference, then copied into this directory. Original output:
|
||||||
|
`/home/andrei/.codex/generated_images/01a0898f-efc3-71e2-b4ca-2d98847887ed/exec-d32123cd-51c2-4e23-959e-08d188a2d7cb.png`.
|
||||||
|
- `iomatex-io.svg` and `icons/*.svg`: editable vector launch icons matching the
|
||||||
|
reference's rounded tiles; native icons, not screenshots of controls.
|
||||||
|
|
||||||
|
Image generation prompt:
|
||||||
|
|
||||||
|
> Edit target: attached desktop reference. Produce ONLY the clean wallpaper
|
||||||
|
> background for a real Linux desktop, 1920x1080 landscape. Preserve the dark
|
||||||
|
> navy/black and purple flowing luminous wave design, bright lavender upper right
|
||||||
|
> glow and sweeping blue-white/lavender light ribbons across the lower half.
|
||||||
|
> Remove ALL icons, labels, text, status bar, bottom dock, avatar, plus buttons,
|
||||||
|
> and the black exterior frame. Extend the background naturally to fill a full
|
||||||
|
> 16:9 image. No text, no symbols, no UI, no logo. Keep the upper middle relatively
|
||||||
|
> dark and calm so actual desktop launcher icons will be readable.
|
||||||
|
|
||||||
|
The generated image is 1672x941; XFCE scales/crops it to the monitor resolution.
|
||||||
|
|
||||||
|
Application icon correction: `evax10.png` is now an unchanged copy of
|
||||||
|
`IOMATEX_APP/assets/icon/play_store_512.png`, selected by that project's
|
||||||
|
`pubspec.yaml` flutter_icons.image_path. The custom `iomatex-io.svg` was removed.
|
||||||
|
All desktop, dock and menu launchers display the name EVAx10 and the same PNG.
|
||||||
|
|
||||||
|
Superseding correction: the IOMATEX_APP icon above was an obsolete product
|
||||||
|
asset. The canonical Edge installer icon is `evax10_launcher.png`, copied
|
||||||
|
unchanged from `Development/It-screenClient`, source commit
|
||||||
|
`c75170b64ccff88b0a80edf9e21d1382960c9834`, as named by the published Windows
|
||||||
|
5.1.42 channel manifest. `packaging/windows/client.iss` uses `images/evax10.ico`;
|
||||||
|
`admonclient.pro` embeds it into the executable used by Windows shortcuts.
|
||||||
|
Android's generator copies `images/evax10_launcher.png` unchanged. Provenance and
|
||||||
|
the PNG checksum are recorded in `app-icon-source.json` beside the asset.
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
# Debian desktop branding
|
||||||
|
|
||||||
|
Owned by stage_env 1.0.5. Supports Debian 11 XFCE and LXDE/PCManFM/LXPanel;
|
||||||
|
does not install or switch the desktop environment, restart X11, or change
|
||||||
|
the client auto-start policy. LightDM GTK greeter receives the same wallpaper.
|
||||||
|
The bootloader and Plymouth splash are separate and unchanged.
|
||||||
|
|
||||||
|
The desktop and panel both use `evax10-return.desktop`. Its launcher starts
|
||||||
|
`itscreen-x11.service`, whose existing Conflicts stops LightDM. Save desktop
|
||||||
|
work before opening EVAx10. Before stage_itscreen is installed it displays an
|
||||||
|
installation message. Service failure details remain in Edge Console/journal.
|
||||||
|
|
||||||
|
Where the client maintenance helper `/usr/local/sbin/iomatex-desktop` exists,
|
||||||
|
the launcher delegates to its `return` command. The branding helper deliberately
|
||||||
|
uses the distinct name `iomatex-desktop-branding`.
|
||||||
|
|
||||||
|
XFCE uses its existing xfconf XML and panel launcher directories. The helper
|
||||||
|
adds a launcher to the bottom panel and makes that panel permanently visible.
|
||||||
|
Desktop position uses the XFCE 4.16 row/column grid near the screen center;
|
||||||
|
GTK labels use dark text for contrast against the light background. The GTK
|
||||||
|
block has managed markers; other user GTK styles are retained. Apply while the
|
||||||
|
desktop is logged out, or at the next X11 login, so xfconfd cannot overwrite
|
||||||
|
offline changes. XFCE 4.20's YAML icon position format is not supported yet.
|
||||||
|
|
||||||
|
`~/.xsessionrc` runs the helper before PCManFM/LXPanel start. XRandR supplies
|
||||||
|
the screen dimensions; headless installation uses a temporary 1280x720 layout,
|
||||||
|
recomputed at desktop login. Hot-plugging a display requires a new login to
|
||||||
|
recenter the shortcut. The helper respects XDG_DESKTOP_DIR and keeps existing
|
||||||
|
desktop items and panel plugins. It adds a compact bottom panel only if none
|
||||||
|
exists. Initial files are backed up under `.iomatex-backups` beside the modified
|
||||||
|
configuration directories, never inside the LXPanel panels directory.
|
||||||
|
|
||||||
|
Artwork: `stage_ui/iomatex_logo_source.png` is the canonical iOmatex logo.
|
||||||
|
`evax10.png` is copied unchanged from It-screenClient's
|
||||||
|
`iomatex_dev:images/evax10_launcher.png`; no client build is included.
|
||||||
|
|
||||||
|
Configuration references:
|
||||||
|
- https://github.com/lxde/pcmanfm/blob/master/src/desktop.c
|
||||||
|
- https://github.com/lxde/lxpanel (launchbar plugin)
|
||||||
|
|
||||||
|
Validation: `python3 -m unittest discover -s stage_env/desktop -p 'test_*.py'`.
|
||||||
|
On a Debian bench, additionally verify login, icon placement, bottom panel,
|
||||||
|
EVAx10 launch, subsequent return to desktop, and a repeated stage_env run.
|
||||||
|
|
||||||
|
## Purple desktop revision
|
||||||
|
|
||||||
|
The user-supplied reference supersedes the original light desktop. XFCE now
|
||||||
|
uses `wallpaper-purple.png`, rounded SVG tiles, six launchers on the first row,
|
||||||
|
Trash and four add-shortcut actions on the second row, and a compact dark dock.
|
||||||
|
Panel definitions are preserved in XML, but the visible plugin ordering is
|
||||||
|
intentionally changed to match the reference. Home opens local Edge Console;
|
||||||
|
Light opens display/power settings; Terminal uses Debian's x-terminal-emulator
|
||||||
|
alternative. Plus buttons open XFCE's native launcher editor.
|
||||||
|
|
||||||
|
`transition.png` is used by LightDM and the bounded Debian userspace preloader.
|
||||||
|
`iomatex-boot-splash.service` paints the existing 32-bit Rockchip DRM framebuffer
|
||||||
|
after local filesystems are available. It exits within 90 seconds and is stopped
|
||||||
|
by display-service ExecStartPre hooks before X11 starts. Unsupported framebuffer
|
||||||
|
layouts fail without blocking the display services. The installer enables the
|
||||||
|
service but never starts it over a running X session.
|
||||||
|
|
||||||
|
The bench's vendor bootanim hook directory is absent, so that service currently
|
||||||
|
draws nothing. The new service owns the Debian userspace preloader. It does not
|
||||||
|
rewrite the U-Boot FIT image, its signature, kernel, DTB or firmware logo.bmp.
|
||||||
|
The very first firmware frame remains outside this userspace customization.
|
||||||
|
|
||||||
|
Bench backups live in `/userdata/iomatex-dev/backups/desktop-before-purple-20261029.tar.gz`.
|
||||||
|
To disable the preloader: `sudo systemctl disable --now iomatex-boot-splash`.
|
||||||
|
Restore the desktop/LightDM files from the backup while logged out, and remove
|
||||||
|
the branding hook from `.xsessionrc` when rolling the customization back.
|
||||||
|
|
||||||
|
## Field terminal
|
||||||
|
|
||||||
|
`iomatex-terminal` delegates to the packaged LXTerminal GTK/VTE terminal. It is
|
||||||
|
the desktop/dock launcher and Debian x-terminal-emulator alternative. stage_env
|
||||||
|
ensures lxterminal and fonts-dejavu-core from the existing offline package set.
|
||||||
|
No client or desktop restart is needed for installation; open a new terminal.
|
||||||
|
|
||||||
|
The first configuration sets DejaVu Sans Mono 18, dark colors, scrollback and
|
||||||
|
font shortcuts. `.config/iomatex/field-terminal-v1` prevents later logins/updates
|
||||||
|
from overwriting engineer preferences. Edit → Preferences → Style → Font saves
|
||||||
|
a permanent font choice; Ctrl+=, Ctrl+- and Ctrl+0 change temporary zoom.
|
||||||
|
|
||||||
|
The managed `.bashrc` hook runs only for interactive local graphical shells;
|
||||||
|
SSH/noninteractive commands receive no startup output. `edge-help` is available
|
||||||
|
in interactive Bash. Original `.bashrc` is backed up inside the user's home at
|
||||||
|
`.local/state/iomatex-desktop/backups/bashrc`.
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"repository": "Development/It-screenClient",
|
||||||
|
"source_commit": "c75170b64ccff88b0a80edf9e21d1382960c9834",
|
||||||
|
"source_path": "images/evax10_launcher.png",
|
||||||
|
"windows_icon": "images/evax10.ico",
|
||||||
|
"release_manifest": "An-J/DOWNLOAD_IOMATEX_APP:Windows_Client:edge-client/windows/latest.json",
|
||||||
|
"release_version": "5.1.42",
|
||||||
|
"sha256": "6292d9350b503d66ad975ce003242284f59039af6d2407d2d617e39005b58578"
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 845 KiB |
|
|
@ -0,0 +1,10 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=EVAx10
|
||||||
|
Comment=Switch from the desktop to the EVAx10 client
|
||||||
|
Comment[ru]=Перейти с рабочего стола в приложение EVAx10
|
||||||
|
Exec=/usr/local/bin/iomatex-open-evax10
|
||||||
|
Icon=/usr/local/share/iomatex/desktop/evax10_launcher.png
|
||||||
|
Terminal=false
|
||||||
|
Categories=Utility;
|
||||||
|
StartupNotify=false
|
||||||
|
After Width: | Height: | Size: 1.8 MiB |
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><defs><linearGradient id="tile" x2="0" y2="1"><stop stop-color="#a68edb"/><stop offset="1" stop-color="#514a78"/></linearGradient></defs><rect x="4" y="4" width="120" height="120" rx="28" fill="url(#tile)" fill-opacity=".6" stroke="#e8e1ff" stroke-opacity=".5"/><path d="M64 42v44M42 64h44" stroke="#c4bce2" stroke-opacity=".7" stroke-width="3"/></svg>
|
||||||
|
After Width: | Height: | Size: 440 B |
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><defs><linearGradient id="tile" x2="0" y2="1"><stop stop-color="#ffffff"/><stop offset="1" stop-color="#ddd9e8"/></linearGradient></defs><rect x="4" y="4" width="120" height="120" rx="28" fill="url(#tile)" fill-opacity="1" stroke="#e8e1ff" stroke-opacity=".5"/><path d="M21 38h32l9 10h45v55H21Z" fill="#ddb26b" stroke="#c79e5d" stroke-width="3"/><rect x="26" y="49" width="75" height="40" rx="5" fill="#81b9b5"/><rect x="29" y="58" width="71" height="35" rx="5" fill="#e9e7d9"/><path d="M18 70h92l-9 36H26Z" fill="#efc986" stroke="#dab578" stroke-width="2"/></svg>
|
||||||
|
After Width: | Height: | Size: 652 B |
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><defs><linearGradient id="tile" x2="0" y2="1"><stop stop-color="#ffffff"/><stop offset="1" stop-color="#ddd9e8"/></linearGradient></defs><rect x="4" y="4" width="120" height="120" rx="28" fill="url(#tile)" fill-opacity="1" stroke="#e8e1ff" stroke-opacity=".5"/><path d="M27 61L64 28 101 61" fill="none" stroke="#ed8078" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/><path d="M37 59v42h54V59" fill="#d9f0f1" stroke="#b6cdce" stroke-width="4"/><path d="M56 101V74h17v27" fill="#f3c4bc"/></svg>
|
||||||
|
After Width: | Height: | Size: 599 B |
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><defs><linearGradient id="tile" x2="0" y2="1"><stop stop-color="#ffffff"/><stop offset="1" stop-color="#ddd9e8"/></linearGradient></defs><rect x="4" y="4" width="120" height="120" rx="28" fill="url(#tile)" fill-opacity="1" stroke="#e8e1ff" stroke-opacity=".5"/><path d="M46 65a26 26 0 1 1 36 0L77 87H51Z" fill="#fff8dc" stroke="#ceced8" stroke-width="3"/><path d="M53 88h22m-20 7h18m-16 7h14" stroke="#96949c" stroke-width="5" stroke-linecap="round"/><path d="M59 84l-5-30 10 9 10-9-5 30" fill="none" stroke="#ddc58a" stroke-width="2"/></svg>
|
||||||
|
After Width: | Height: | Size: 630 B |
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><defs><linearGradient id="tile" x2="0" y2="1"><stop stop-color="#ffffff"/><stop offset="1" stop-color="#ddd9e8"/></linearGradient></defs><rect x="4" y="4" width="120" height="120" rx="28" fill="url(#tile)" fill-opacity="1" stroke="#e8e1ff" stroke-opacity=".5"/><g fill="none" stroke="#62616c" stroke-width="9"><circle cx="64" cy="64" r="26"/><circle cx="64" cy="64" r="10"/><path d="M64 23v12" transform="rotate(0 64 64)"/><path d="M64 23v12" transform="rotate(45 64 64)"/><path d="M64 23v12" transform="rotate(90 64 64)"/><path d="M64 23v12" transform="rotate(135 64 64)"/><path d="M64 23v12" transform="rotate(180 64 64)"/><path d="M64 23v12" transform="rotate(225 64 64)"/><path d="M64 23v12" transform="rotate(270 64 64)"/><path d="M64 23v12" transform="rotate(315 64 64)"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 876 B |
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><defs><linearGradient id="tile" x2="0" y2="1"><stop stop-color="#ffffff"/><stop offset="1" stop-color="#ddd9e8"/></linearGradient></defs><rect x="4" y="4" width="120" height="120" rx="28" fill="url(#tile)" fill-opacity="1" stroke="#e8e1ff" stroke-opacity=".5"/><rect x="16" y="22" width="96" height="84" rx="12" fill="#20252b" stroke="#afb8ba" stroke-width="3"/><path d="M29 43l11 8-11 8m22 4h13" fill="none" stroke="#8ade84" stroke-width="4"/></svg>
|
||||||
|
After Width: | Height: | Size: 538 B |
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><defs><linearGradient id="tile" x2="0" y2="1"><stop stop-color="#a68edb"/><stop offset="1" stop-color="#514a78"/></linearGradient></defs><rect x="4" y="4" width="120" height="120" rx="28" fill="url(#tile)" fill-opacity="1" stroke="#e8e1ff" stroke-opacity=".5"/><path d="M39 41l6 62h38l6-62Z" fill="#ddd3f3" fill-opacity=".55" stroke="#eee7ff" stroke-width="3"/><ellipse cx="64" cy="40" rx="27" ry="7" fill="#a499bb" stroke="#eee7ff" stroke-width="3"/><path d="M51 52l3 39m10-39v39m13-39-3 39" stroke="#f0ebff" stroke-width="2"/></svg>
|
||||||
|
After Width: | Height: | Size: 622 B |
|
|
@ -0,0 +1,81 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
"""Bounded userspace splash for the Rockchip DRM framebuffer; never writes firmware."""
|
||||||
|
import ctypes as c
|
||||||
|
import fcntl
|
||||||
|
import mmap
|
||||||
|
from pathlib import Path
|
||||||
|
import signal
|
||||||
|
import struct
|
||||||
|
import time
|
||||||
|
|
||||||
|
running = True
|
||||||
|
|
||||||
|
|
||||||
|
def stop(*unused):
|
||||||
|
global running
|
||||||
|
running = False
|
||||||
|
|
||||||
|
|
||||||
|
def load_pixels(filename, width, height):
|
||||||
|
lib = c.CDLL('libgdk_pixbuf-2.0.so.0')
|
||||||
|
lib.gdk_pixbuf_new_from_file_at_scale.argtypes = [c.c_char_p, c.c_int, c.c_int, c.c_int, c.c_void_p]
|
||||||
|
lib.gdk_pixbuf_new_from_file_at_scale.restype = c.c_void_p
|
||||||
|
ptr = lib.gdk_pixbuf_new_from_file_at_scale(str(filename).encode(), width, height, 1, None)
|
||||||
|
if not ptr:
|
||||||
|
raise RuntimeError('Unable to decode splash artwork')
|
||||||
|
values = []
|
||||||
|
for name in ('width', 'height', 'rowstride', 'n_channels'):
|
||||||
|
fn = getattr(lib, 'gdk_pixbuf_get_' + name)
|
||||||
|
fn.argtypes = [c.c_void_p]
|
||||||
|
fn.restype = c.c_int
|
||||||
|
values.append(fn(ptr))
|
||||||
|
w, h, stride, channels = values
|
||||||
|
lib.gdk_pixbuf_get_pixels.argtypes = [c.c_void_p]
|
||||||
|
lib.gdk_pixbuf_get_pixels.restype = c.c_void_p
|
||||||
|
data = c.string_at(lib.gdk_pixbuf_get_pixels(ptr), (h - 1) * stride + w * channels)
|
||||||
|
return w, h, stride, channels, data
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# This service is ordered before display managers and stopped before X starts.
|
||||||
|
if Path('/tmp/.X0-lock').exists():
|
||||||
|
raise RuntimeError('X display already owns the framebuffer')
|
||||||
|
with open('/dev/fb0', 'r+b', buffering=0) as fb:
|
||||||
|
info = bytearray(160)
|
||||||
|
fcntl.ioctl(fb, 0x4600, info, True) # FBIOGET_VSCREENINFO
|
||||||
|
width, height = struct.unpack_from('II', info)
|
||||||
|
bpp = struct.unpack_from('I', info, 24)[0]
|
||||||
|
offsets = tuple(struct.unpack_from('I', info, i)[0] for i in (32, 44, 56))
|
||||||
|
if bpp != 32 or offsets != (16, 8, 0) or not (320 <= width <= 7680 and 200 <= height <= 4320):
|
||||||
|
raise RuntimeError('Unsupported framebuffer pixel layout')
|
||||||
|
stride = int(Path('/sys/class/graphics/fb0/stride').read_text())
|
||||||
|
w, h, source_stride, channels, data = load_pixels(
|
||||||
|
'/usr/local/share/iomatex/desktop/transition.png', width, int(height * .9))
|
||||||
|
frame = bytearray(stride * height)
|
||||||
|
left, top = (width - w) // 2, (height - h) // 2
|
||||||
|
for y in range(h):
|
||||||
|
row = data[y * source_stride:y * source_stride + w * channels]
|
||||||
|
pixels = bytearray(w * 4)
|
||||||
|
pixels[0::4], pixels[1::4], pixels[2::4] = row[2::channels], row[1::channels], row[0::channels]
|
||||||
|
start = (top + y) * stride + left * 4
|
||||||
|
frame[start:start + len(pixels)] = pixels
|
||||||
|
signal.signal(signal.SIGTERM, stop)
|
||||||
|
signal.signal(signal.SIGINT, stop)
|
||||||
|
with mmap.mmap(fb.fileno(), len(frame)) as screen:
|
||||||
|
screen[:] = frame
|
||||||
|
print('iOmatex splash rendered: %dx%d' % (width, height), flush=True)
|
||||||
|
deadline = time.monotonic() + 90
|
||||||
|
tick = 0
|
||||||
|
while running and time.monotonic() < deadline:
|
||||||
|
for dot in range(3):
|
||||||
|
color = bytes((255, 194, 68, 0)) if dot == tick % 3 else bytes((65, 47, 27, 0))
|
||||||
|
for y in range(height - 35, height - 29):
|
||||||
|
start = y * stride + (width // 2 - 20 + dot * 18) * 4
|
||||||
|
screen[start:start + 24] = color * 6
|
||||||
|
tick += 1
|
||||||
|
time.sleep(.3)
|
||||||
|
print('iOmatex splash stopped', flush=True)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
[Unit]
|
||||||
|
Description=iOmatex Debian startup splash
|
||||||
|
DefaultDependencies=no
|
||||||
|
After=local-fs.target
|
||||||
|
Before=basic.target shutdown.target
|
||||||
|
Conflicts=shutdown.target
|
||||||
|
ConditionPathExists=/dev/fb0
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/usr/local/bin/iomatex-boot-splash
|
||||||
|
TimeoutStopSec=2
|
||||||
|
RuntimeMaxSec=95
|
||||||
|
Nice=10
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sysinit.target
|
||||||
|
|
@ -0,0 +1,356 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
"""Configure the existing LXDE desktop before session startup, without restarting it."""
|
||||||
|
import base64
|
||||||
|
import configparser
|
||||||
|
import io
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
|
ASSETS = Path('/usr/local/share/iomatex/desktop')
|
||||||
|
APP = 'evax10-return.desktop'
|
||||||
|
SHORTCUTS = [
|
||||||
|
(APP, 'EVAx10', '/usr/local/bin/iomatex-open-evax10', str(ASSETS / 'evax10_launcher.png')),
|
||||||
|
('iomatex-settings.desktop', 'Settings', 'xfce4-settings-manager', str(ASSETS / 'icons/settings.svg')),
|
||||||
|
('iomatex-home.desktop', 'Home', 'xdg-open http://127.0.0.1/', str(ASSETS / 'icons/home.svg')),
|
||||||
|
('iomatex-light.desktop', 'Light', 'xfce4-power-manager-settings', str(ASSETS / 'icons/light.svg')),
|
||||||
|
('iomatex-terminal.desktop', 'Terminal', '/usr/local/bin/iomatex-terminal', str(ASSETS / 'icons/terminal.svg')),
|
||||||
|
('iomatex-files.desktop', 'Files', 'thunar', str(ASSETS / 'icons/files.svg')),
|
||||||
|
('iomatex-trash.desktop', 'Trash', 'thunar trash:///', str(ASSETS / 'icons/trash.svg')),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def write(path, content, mode=0o644):
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
if path.exists() and path.read_text() == content:
|
||||||
|
path.chmod(mode)
|
||||||
|
return
|
||||||
|
# Backups must be outside panels/: LXPanel loads every file in that folder.
|
||||||
|
backup = path.parent.parent / '.iomatex-backups' / path.parent.name / path.name
|
||||||
|
if path.name == '.bashrc':
|
||||||
|
backup = path.parent / '.local/state/iomatex-desktop/backups/bashrc'
|
||||||
|
if path.exists() and not backup.exists():
|
||||||
|
backup.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
shutil.copy2(path, backup)
|
||||||
|
tmp = path.with_name(path.name + '.iomatex-tmp')
|
||||||
|
tmp.write_text(content)
|
||||||
|
tmp.chmod(mode)
|
||||||
|
tmp.replace(path)
|
||||||
|
|
||||||
|
|
||||||
|
def ini(path, updates):
|
||||||
|
cfg = configparser.ConfigParser(interpolation=None, strict=False)
|
||||||
|
cfg.optionxform = str
|
||||||
|
if path.exists():
|
||||||
|
cfg.read(path)
|
||||||
|
for section, values in updates.items():
|
||||||
|
if not cfg.has_section(section):
|
||||||
|
cfg.add_section(section)
|
||||||
|
cfg[section].update({k: str(v) for k, v in values.items()})
|
||||||
|
out = io.StringIO()
|
||||||
|
cfg.write(out, space_around_delimiters=False)
|
||||||
|
write(path, out.getvalue())
|
||||||
|
|
||||||
|
|
||||||
|
def monitors():
|
||||||
|
try:
|
||||||
|
output = subprocess.check_output(['xrandr', '--query'], text=True,
|
||||||
|
stderr=subprocess.DEVNULL, timeout=5)
|
||||||
|
# Preserve XRandR monitor order, which PCManFM uses for desktop-items-N.
|
||||||
|
return [tuple(map(int, m)) for m in re.findall(
|
||||||
|
r' connected (?:primary )?(\d+)x(\d+)\+(\d+)\+(\d+)', output)] or [(1280, 720, 0, 0)]
|
||||||
|
except (OSError, subprocess.SubprocessError):
|
||||||
|
return [(1280, 720, 0, 0)]
|
||||||
|
|
||||||
|
|
||||||
|
def prop(parent, name, kind='empty', value=None):
|
||||||
|
node = parent.find("property[@name='%s']" % name)
|
||||||
|
if node is None:
|
||||||
|
node = ET.SubElement(parent, 'property', name=name, type=kind)
|
||||||
|
if value is not None:
|
||||||
|
node.set('type', kind)
|
||||||
|
node.set('value', str(value))
|
||||||
|
return node
|
||||||
|
|
||||||
|
|
||||||
|
def configure_xfce(home, desktop, assets, screens, system):
|
||||||
|
config = home / '.config/xfce4'
|
||||||
|
for filename, label, command, icon in SHORTCUTS:
|
||||||
|
if filename == APP:
|
||||||
|
continue
|
||||||
|
write(desktop / filename, '[Desktop Entry]\nType=Application\nName=%s\nExec=%s\nIcon=%s\nTerminal=false\n' %
|
||||||
|
(label, command, icon), 0o755)
|
||||||
|
for i in range(4):
|
||||||
|
write(desktop / ('iomatex-add-%d.desktop' % i),
|
||||||
|
'[Desktop Entry]\nType=Application\nName=+\nExec=exo-desktop-item-edit --create-new "%s"\nIcon=%s\nTerminal=false\n' % (desktop, assets / 'icons/add.svg'),
|
||||||
|
0o755)
|
||||||
|
css = home / '.config/gtk-3.0/gtk.css'
|
||||||
|
existing = css.read_text() if css.exists() else ''
|
||||||
|
existing = re.sub(r'/\* iOmatex desktop begin \*/.*?/\* iOmatex desktop end \*/\n?',
|
||||||
|
'', existing, flags=re.S).rstrip()
|
||||||
|
write(css, existing + '''
|
||||||
|
/* iOmatex desktop begin */
|
||||||
|
XfdesktopIconView.view, XfdesktopIconView.view .label,
|
||||||
|
XfdesktopIconView.view.label {
|
||||||
|
color: #e8e4fc;
|
||||||
|
text-shadow: 0 1px 2px #08031a;
|
||||||
|
}
|
||||||
|
XfdesktopIconView.view:active, XfdesktopIconView.view:selected,
|
||||||
|
XfdesktopIconView.view .label:active, XfdesktopIconView.view.label:selected {
|
||||||
|
color: #e8e4fc;
|
||||||
|
background-color: rgba(128, 108, 200, 0.35);
|
||||||
|
}
|
||||||
|
XfdesktopIconView.view {
|
||||||
|
-XfdesktopIconView-cell-text-width-proportion: 1.5;
|
||||||
|
-XfdesktopIconView-cell-padding: 8;
|
||||||
|
-XfdesktopIconView-cell-spacing: 8;
|
||||||
|
}
|
||||||
|
.xfce4-panel.background {
|
||||||
|
background-color: rgba(35, 28, 70, 0.90);
|
||||||
|
color: #e8e4fc;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
.xfce4-panel button { color: #e8e4fc; }
|
||||||
|
.xfce4-panel button:hover { background-color: rgba(128, 108, 200, 0.35); }
|
||||||
|
.xfce4-panel button:active { background-color: rgba(128, 108, 200, 0.5); }
|
||||||
|
.xfce4-panel button:checked { background-color: rgba(128, 108, 200, 0.5); }
|
||||||
|
.xfce4-panel button:hover, .xfce4-panel button:active, .xfce4-panel button:checked {
|
||||||
|
color: #e8e4fc;
|
||||||
|
}
|
||||||
|
/* iOmatex desktop end */
|
||||||
|
''')
|
||||||
|
channels = config / 'xfconf/xfce-perchannel-xml'
|
||||||
|
background = channels / 'xfce4-desktop.xml'
|
||||||
|
tree = ET.parse(background).getroot() if background.exists() else ET.Element(
|
||||||
|
'channel', name='xfce4-desktop', version='1.0')
|
||||||
|
screen = prop(prop(tree, 'backdrop'), 'screen0')
|
||||||
|
# Keep existing connector names, and seed newly connected monitors at login.
|
||||||
|
names = {'monitor0'}
|
||||||
|
try:
|
||||||
|
out = subprocess.check_output(['xrandr', '--query'], text=True,
|
||||||
|
stderr=subprocess.DEVNULL, timeout=5)
|
||||||
|
names.update('monitor' + name for name in re.findall(r'^(\S+) connected', out, re.M))
|
||||||
|
except (OSError, subprocess.SubprocessError):
|
||||||
|
pass
|
||||||
|
names.update(n.get('name') for n in screen.findall('property'))
|
||||||
|
for name in names:
|
||||||
|
monitor = prop(screen, name)
|
||||||
|
for workspace in range(4):
|
||||||
|
node = prop(monitor, 'workspace%d' % workspace)
|
||||||
|
prop(node, 'last-image', 'string', str(assets / 'wallpaper-purple.png'))
|
||||||
|
prop(node, 'image-style', 'int', 5)
|
||||||
|
prop(node, 'backdrop-cycle-enable', 'bool', 'false')
|
||||||
|
icons = prop(tree, 'desktop-icons')
|
||||||
|
icon_size = max(48, min(128, round(screens[0][0] / 15)))
|
||||||
|
prop(icons, 'icon-size', 'uint', icon_size)
|
||||||
|
prop(icons, 'use-custom-font-size', 'bool', 'true')
|
||||||
|
prop(icons, 'font-size', 'double', 12)
|
||||||
|
files = prop(icons, 'file-icons')
|
||||||
|
for special in ('show-home', 'show-filesystem', 'show-trash', 'show-removable'):
|
||||||
|
prop(files, special, 'bool', 'false')
|
||||||
|
write(background, ET.tostring(tree, encoding='unicode') + '\n')
|
||||||
|
|
||||||
|
panel_file = channels / 'xfce4-panel.xml'
|
||||||
|
source = panel_file if panel_file.exists() else system / 'xfce4/panel/default.xml'
|
||||||
|
tree = ET.parse(source).getroot() if source.exists() else ET.Element(
|
||||||
|
'channel', name='xfce4-panel', version='1.0')
|
||||||
|
panels = prop(tree, 'panels', 'array')
|
||||||
|
plugins = prop(tree, 'plugins')
|
||||||
|
bottom = next((p for p in panels.findall('property')
|
||||||
|
if p.find("property[@name='position']") is not None and
|
||||||
|
p.find("property[@name='position']").get('value', '').startswith('p=10;')), None)
|
||||||
|
if bottom is None:
|
||||||
|
ids = [int(v.get('value')) for v in panels.findall('value')]
|
||||||
|
number = max(ids + [0]) + 1
|
||||||
|
ET.SubElement(panels, 'value', type='int', value=str(number))
|
||||||
|
bottom = prop(panels, 'panel-%d' % number)
|
||||||
|
prop(bottom, 'position', 'string', 'p=10;x=0;y=0')
|
||||||
|
prop(bottom, 'size', 'uint', 48)
|
||||||
|
prop(bottom, 'position-locked', 'bool', 'true')
|
||||||
|
prop(bottom, 'autohide-behavior', 'uint', 0)
|
||||||
|
launcher = next((p for p in plugins.findall('property')
|
||||||
|
if any(v.get('value', '').endswith(APP) for v in p.findall('./property/value'))), None)
|
||||||
|
if launcher is None:
|
||||||
|
ids = [int(p.get('name').split('-')[1]) for p in plugins.findall('property')]
|
||||||
|
number = max(ids + [0]) + 1
|
||||||
|
launcher = prop(plugins, 'plugin-%d' % number, 'string', 'launcher')
|
||||||
|
items = prop(launcher, 'items', 'array')
|
||||||
|
ET.SubElement(items, 'value', type='string', value=APP)
|
||||||
|
number = launcher.get('name').split('-')[1]
|
||||||
|
ids = prop(bottom, 'plugin-ids', 'array')
|
||||||
|
if not any(v.get('value') == number for v in ids.findall('value')):
|
||||||
|
ids.insert(0, ET.Element('value', type='int', value=number))
|
||||||
|
write(config / ('panel/launcher-%s/%s' % (number, APP)), (assets / APP).read_text())
|
||||||
|
# The reference explicitly defines a new dock arrangement. Preserve plugin
|
||||||
|
# definitions for rollback, while selecting the requested visible launchers.
|
||||||
|
dock_ids = [number]
|
||||||
|
for filename in ('iomatex-settings.desktop', 'iomatex-terminal.desktop', 'iomatex-home.desktop', 'iomatex-files.desktop', 'iomatex-trash.desktop'):
|
||||||
|
item = next((p for p in plugins.findall('property')
|
||||||
|
if any(v.get('value', '').endswith(filename) for v in p.findall('./property/value'))), None)
|
||||||
|
if item is None:
|
||||||
|
next_id = max([int(p.get('name').split('-')[1]) for p in plugins.findall('property')] + [0]) + 1
|
||||||
|
item = prop(plugins, 'plugin-%d' % next_id, 'string', 'launcher')
|
||||||
|
ET.SubElement(prop(item, 'items', 'array'), 'value', type='string', value=filename)
|
||||||
|
pid = item.get('name').split('-')[1]
|
||||||
|
dock_ids.append(pid)
|
||||||
|
write(config / ('panel/launcher-%s/%s' % (pid, filename)), (desktop / filename).read_text())
|
||||||
|
ids[:] = [ET.Element('value', type='int', value=i) for i in dock_ids]
|
||||||
|
prop(bottom, 'size', 'uint', 56)
|
||||||
|
prop(bottom, 'length', 'uint', 1)
|
||||||
|
prop(bottom, 'length-adjust', 'bool', 'true')
|
||||||
|
prop(bottom, 'position-locked', 'bool', 'true')
|
||||||
|
for panel in panels.findall('property'):
|
||||||
|
position = panel.find("property[@name='position']")
|
||||||
|
if position is not None and position.get('value', '').startswith('p=6;'):
|
||||||
|
top_ids = panel.find("property[@name='plugin-ids']")
|
||||||
|
if top_ids is not None:
|
||||||
|
retained = []
|
||||||
|
for value in top_ids.findall('value'):
|
||||||
|
plugin = plugins.find("property[@name='plugin-%s']" % value.get('value'))
|
||||||
|
if plugin is not None and plugin.get('value') in ('separator', 'systray', 'clock', 'actions', 'pulseaudio', 'power-manager-plugin'):
|
||||||
|
retained.append(value)
|
||||||
|
top_ids[:] = retained
|
||||||
|
write(panel_file, ET.tostring(tree, encoding='unicode') + '\n')
|
||||||
|
|
||||||
|
# XFCE 4.16 (Debian 11) stores desktop positions as grid row/column.
|
||||||
|
layout_dir = config / 'desktop'
|
||||||
|
layouts = list(layout_dir.glob('icons.screen*.rc'))
|
||||||
|
if not layouts:
|
||||||
|
layouts = [layout_dir / 'icons.screen.latest.rc']
|
||||||
|
width, height, _, _ = screens[0]
|
||||||
|
for layout in layouts:
|
||||||
|
match = re.search(r'-(\d+)x(\d+)\.rc$', layout.name)
|
||||||
|
w, h = map(int, match.groups()) if match else (width - 16, height - 43)
|
||||||
|
cell = icon_size * 1.5 + 24
|
||||||
|
columns = max(6, int(w // cell))
|
||||||
|
start_col = max(0, (columns - 6) // 2)
|
||||||
|
row = max(0, int(h * .23 // cell))
|
||||||
|
updates = {'xfdesktop-version-4.10.3+-rcfile_format': {'4.10.3+': 'true'}}
|
||||||
|
for i, (filename, *_) in enumerate(SHORTCUTS[:6]):
|
||||||
|
updates[str(desktop / filename)] = {'row': row, 'col': start_col + i}
|
||||||
|
for i, filename in enumerate(['iomatex-trash.desktop'] + ['iomatex-add-%d.desktop' % n for n in range(4)]):
|
||||||
|
updates[str(desktop / filename)] = {'row': row + 1, 'col': start_col + i}
|
||||||
|
ini(layout, updates)
|
||||||
|
|
||||||
|
|
||||||
|
def configure_terminal(home):
|
||||||
|
path = home / '.config/lxterminal/lxterminal.conf'
|
||||||
|
marker = home / '.config/iomatex/field-terminal-v1'
|
||||||
|
# Apply defaults once. Preferences edited by the engineer survive login/update.
|
||||||
|
if not marker.exists() or not path.exists():
|
||||||
|
ini(path, {'general': {
|
||||||
|
'fontname': 'DejaVu Sans Mono 18', 'scrollback': 10000,
|
||||||
|
'bgcolor': 'rgb(15,20,31)', 'fgcolor': 'rgb(228,234,244)',
|
||||||
|
'hidemenubar': 'false', 'hidescrollbar': 'false',
|
||||||
|
'audiblebell': 'false', 'visualbell': 'false',
|
||||||
|
'disableconfirm': 'false', 'geometry_columns': 88, 'geometry_rows': 24,
|
||||||
|
}, 'shortcut': {
|
||||||
|
'zoom_in_accel': '<Primary>equal', 'zoom_out_accel': '<Primary>minus',
|
||||||
|
'zoom_reset_accel': '<Primary>0',
|
||||||
|
'copy_accel': '<Primary><Shift>c', 'paste_accel': '<Primary><Shift>v',
|
||||||
|
'new_tab_accel': '<Primary><Shift>t',
|
||||||
|
}})
|
||||||
|
write(marker, 'Field terminal defaults applied; user preferences now own font and colors.\n')
|
||||||
|
bashrc = home / '.bashrc'
|
||||||
|
content = bashrc.read_text() if bashrc.exists() else ''
|
||||||
|
if '# iOmatex field terminal help' not in content:
|
||||||
|
write(bashrc, content + '''
|
||||||
|
# iOmatex field terminal help (interactive local shells only)
|
||||||
|
case $- in
|
||||||
|
*i*)
|
||||||
|
edge-help() { /usr/local/bin/iomatex-terminal-help; }
|
||||||
|
if [ -n "${DISPLAY:-}" ] && [ -z "${SSH_CONNECTION:-}" ] && [ -x /usr/local/bin/iomatex-terminal-help ]; then
|
||||||
|
/usr/local/bin/iomatex-terminal-help
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
''')
|
||||||
|
|
||||||
|
|
||||||
|
def configure(home, assets=ASSETS, screens=None, system=Path('/etc/xdg'), environment=None):
|
||||||
|
configure_terminal(home)
|
||||||
|
config = home / '.config'
|
||||||
|
desktop = home / 'Desktop'
|
||||||
|
dirs = config / 'user-dirs.dirs'
|
||||||
|
if dirs.exists():
|
||||||
|
match = re.search(r'^XDG_DESKTOP_DIR="([^"]+)"', dirs.read_text(), re.M)
|
||||||
|
if match:
|
||||||
|
desktop = Path(match[1].replace('$HOME', str(home)))
|
||||||
|
if not desktop.is_absolute():
|
||||||
|
raise ValueError('XDG_DESKTOP_DIR must be absolute')
|
||||||
|
write(desktop / APP, (assets / APP).read_text(), 0o755)
|
||||||
|
screens = screens or monitors()
|
||||||
|
if environment == 'xfce' or (environment is None and shutil.which('xfdesktop')):
|
||||||
|
configure_xfce(home, desktop, assets, screens, system)
|
||||||
|
return
|
||||||
|
|
||||||
|
profiles = {'LXDE'}
|
||||||
|
for base in (config, system):
|
||||||
|
for component in ('pcmanfm', 'lxpanel'):
|
||||||
|
directory = base / component
|
||||||
|
if directory.exists():
|
||||||
|
profiles.update(p.name for p in directory.iterdir()
|
||||||
|
if p.is_dir() and not p.name.startswith('.'))
|
||||||
|
screens = screens or monitors()
|
||||||
|
for profile in sorted(profiles):
|
||||||
|
pc = config / 'pcmanfm' / profile
|
||||||
|
for i, (width, height, x, y) in enumerate(screens):
|
||||||
|
path = pc / ('desktop-items-%d.conf' % i)
|
||||||
|
source = system / 'pcmanfm' / profile / path.name
|
||||||
|
if not path.exists() and source.exists():
|
||||||
|
write(path, source.read_text())
|
||||||
|
ini(path, {'*': {
|
||||||
|
'wallpaper_mode': 2, 'wallpaper': str(assets / 'wallpaper.svg'),
|
||||||
|
'wallpaper_common': 1, 'desktop_bg': '#eef3fa',
|
||||||
|
'desktop_fg': '#193b60', 'desktop_shadow': '#ffffff',
|
||||||
|
'desktop_font': 'Sans 14',
|
||||||
|
}, APP: {'x': x + max(0, width // 2 - 60),
|
||||||
|
'y': y + max(0, height // 2 - 40)}})
|
||||||
|
|
||||||
|
panels = config / 'lxpanel' / profile / 'panels'
|
||||||
|
defaults = system / 'lxpanel' / profile / 'panels'
|
||||||
|
if not panels.exists() and defaults.exists():
|
||||||
|
panels.mkdir(parents=True)
|
||||||
|
for source in defaults.iterdir():
|
||||||
|
if source.is_file():
|
||||||
|
write(panels / source.name, source.read_text())
|
||||||
|
bottom = next((p for p in sorted(panels.glob('*'))
|
||||||
|
if p.is_file()
|
||||||
|
and re.search(r'\bedge\s*=\s*bottom\b', p.read_text())), None)
|
||||||
|
if bottom is None:
|
||||||
|
bottom = panels / 'iomatex'
|
||||||
|
content = ('Global {\nedge=bottom\nalign=center\nwidthtype=pixel\n'
|
||||||
|
'width=160\nheight=56\niconsize=48\nsetdocktype=1\n'
|
||||||
|
'setpartialstrut=1\nautohide=0\n}\n')
|
||||||
|
else:
|
||||||
|
content = bottom.read_text()
|
||||||
|
if APP not in content:
|
||||||
|
content += '\nPlugin {\n type=launchbar\n Config {\n Button {\n id=' + APP + '\n }\n }\n}\n'
|
||||||
|
write(bottom, content)
|
||||||
|
|
||||||
|
|
||||||
|
def wallpaper(assets):
|
||||||
|
# Compose a vector background with the unchanged, canonical logo embedded.
|
||||||
|
logo = base64.b64encode((assets / 'iomatex.png').read_bytes()).decode('ascii')
|
||||||
|
return '''<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1920" height="1080" viewBox="0 0 1920 1080">
|
||||||
|
<defs><linearGradient id="bg" x2="1" y2="1"><stop stop-color="#ffffff"/><stop offset="1" stop-color="#dbe7f5"/></linearGradient></defs>
|
||||||
|
<rect width="1920" height="1080" fill="url(#bg)"/>
|
||||||
|
<image x="850" y="80" width="220" height="220" xlink:href="data:image/png;base64,''' + logo + '''"/>
|
||||||
|
<text x="960" y="365" text-anchor="middle" font-family="sans-serif" font-size="32" fill="#193b60">iOmatex Edge</text>
|
||||||
|
<text x="960" y="1000" text-anchor="middle" font-family="sans-serif" font-size="22" fill="#496484">EVAx10 · AI-native platform</text>
|
||||||
|
</svg>
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import sys
|
||||||
|
if sys.argv[1:] == ['--wallpaper']:
|
||||||
|
write(ASSETS / 'wallpaper.svg', wallpaper(ASSETS))
|
||||||
|
elif sys.argv[1:] == ['--terminal']:
|
||||||
|
configure_terminal(Path.home())
|
||||||
|
elif not sys.argv[1:]:
|
||||||
|
configure(Path.home())
|
||||||
|
else:
|
||||||
|
raise SystemExit('Usage: iomatex-desktop [--wallpaper]')
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
fail() {
|
||||||
|
logger -t iomatex-open-evax10 "$1"
|
||||||
|
if command -v xmessage >/dev/null 2>&1; then
|
||||||
|
xmessage -center -buttons OK:0 "$1"
|
||||||
|
fi
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
state=$(systemctl show itscreen-x11.service -p LoadState --value)
|
||||||
|
[ "$state" = loaded ] || fail 'EVAx10 is not installed. Install stage_itscreen in Edge Console.'
|
||||||
|
# Reuse the client's authenticated maintenance desktop transition when installed.
|
||||||
|
if [ -x /usr/local/sbin/iomatex-desktop ]; then
|
||||||
|
sudo -n /usr/local/sbin/iomatex-desktop return || \
|
||||||
|
fail 'Cannot return to EVAx10. Check the desktop access policy.'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
# The service owns X11 and conflicts with LightDM. Do not run a second player.
|
||||||
|
sudo -n /usr/bin/systemctl --no-block start itscreen-x11.service || \
|
||||||
|
fail 'Cannot start EVAx10. Check itscreen-x11.service in Edge Console.'
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# One owner for the desktop, dock and Debian terminal alternative.
|
||||||
|
exec /usr/bin/lxterminal "$@"
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/sh
|
||||||
|
cat <<'EOF'
|
||||||
|
|
||||||
|
iOmatex · Терминал инженера
|
||||||
|
───────────────────────────────────────────────────────────────
|
||||||
|
Шрифт: Ctrl+= увеличить · Ctrl+- уменьшить · Ctrl+0 сбросить.
|
||||||
|
Постоянный размер: Правка → Параметры → Стиль → Шрифт
|
||||||
|
(Edit → Preferences → Style → Font). По умолчанию: 18 pt.
|
||||||
|
|
||||||
|
Ctrl+Shift+C / V — копировать / вставить; Ctrl+Shift+T — вкладка.
|
||||||
|
Ctrl+C — остановить команду; Ctrl+L — очистить экран; q — выйти
|
||||||
|
из просмотра журнала. Tab — дополнение; Ctrl+R — поиск в истории.
|
||||||
|
|
||||||
|
Клиент: journalctl -u itscreen-x11 -n 80 --no-pager
|
||||||
|
Лог вживую: journalctl -u itscreen-x11 -f
|
||||||
|
Установщик: tail -n 80 /userdata/Iomatex_OS/local_installer.log
|
||||||
|
Сеть / диск: ip -br addr ; df -h / /userdata
|
||||||
|
Памятка снова: edge-help
|
||||||
|
|
||||||
|
Пароль sudo при вводе не отображается — это нормально.
|
||||||
|
Работайте от iomatex; sudo используйте для отдельных команд.
|
||||||
|
───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
@ -0,0 +1,126 @@
|
||||||
|
import importlib.machinery
|
||||||
|
import importlib.util
|
||||||
|
from pathlib import Path
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
ROOT = Path(__file__).parent
|
||||||
|
loader = importlib.machinery.SourceFileLoader('branding', str(ROOT / 'iomatex-desktop-branding'))
|
||||||
|
spec = importlib.util.spec_from_loader(loader.name, loader)
|
||||||
|
branding = importlib.util.module_from_spec(spec)
|
||||||
|
loader.exec_module(branding)
|
||||||
|
|
||||||
|
|
||||||
|
class DesktopTest(unittest.TestCase):
|
||||||
|
def test_terminal_defaults_keep_engineer_font_and_single_help_hook(self):
|
||||||
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
|
home = Path(tmp)
|
||||||
|
(home / '.bashrc').write_text('alias ll="ls -l"\n')
|
||||||
|
branding.configure_terminal(home)
|
||||||
|
cfg = home / '.config/lxterminal/lxterminal.conf'
|
||||||
|
self.assertIn('fontname=DejaVu Sans Mono 18', cfg.read_text())
|
||||||
|
self.assertIn('zoom_in_accel=<Primary>equal', cfg.read_text())
|
||||||
|
cfg.write_text(cfg.read_text().replace('Mono 18', 'Mono 22'))
|
||||||
|
branding.configure_terminal(home)
|
||||||
|
self.assertIn('fontname=DejaVu Sans Mono 22', cfg.read_text())
|
||||||
|
self.assertEqual((home / '.bashrc').read_text().count('# iOmatex field terminal help'), 1)
|
||||||
|
self.assertIn('alias ll=', (home / '.bashrc').read_text())
|
||||||
|
self.assertEqual((home / '.local/state/iomatex-desktop/backups/bashrc').read_text(), 'alias ll="ls -l"\n')
|
||||||
|
|
||||||
|
def test_xfce_preserves_panel_and_reuses_launcher(self):
|
||||||
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
|
home = Path(tmp)
|
||||||
|
channel = home / '.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml'
|
||||||
|
channel.parent.mkdir(parents=True)
|
||||||
|
channel.write_text('''<channel name="xfce4-panel" version="1.0">
|
||||||
|
<property name="panels" type="array"><value type="int" value="2"/>
|
||||||
|
<property name="panel-2" type="empty"><property name="position" type="string" value="p=10;x=0;y=0"/>
|
||||||
|
<property name="plugin-ids" type="array"><value type="int" value="3"/></property></property></property>
|
||||||
|
<property name="plugins" type="empty"><property name="plugin-3" type="string" value="clock"/></property></channel>''')
|
||||||
|
for _ in range(2):
|
||||||
|
branding.configure(home, ROOT, [(1920, 1080, 0, 0)], home/'system', 'xfce')
|
||||||
|
root = branding.ET.parse(channel).getroot()
|
||||||
|
plugins = root.find("property[@name='plugins']")
|
||||||
|
self.assertEqual(len(plugins), 7)
|
||||||
|
self.assertEqual(plugins[0].get('value'), 'clock')
|
||||||
|
self.assertEqual(len(root.findall(".//property[@name='plugin-ids']/value")), 6)
|
||||||
|
self.assertIn(str(ROOT/'wallpaper-purple.png'), (channel.parent/'xfce4-desktop.xml').read_text())
|
||||||
|
self.assertTrue((home/'Desktop'/branding.APP).exists())
|
||||||
|
|
||||||
|
def test_existing_desktop_panel_and_localized_directory_survive_repeat(self):
|
||||||
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
|
home = Path(tmp) / 'home'
|
||||||
|
config = home / '.config'
|
||||||
|
config.mkdir(parents=True)
|
||||||
|
(config / 'user-dirs.dirs').write_text('XDG_DESKTOP_DIR="$HOME/Рабочий стол"\n')
|
||||||
|
pc = config / 'pcmanfm/LXDE/desktop-items-0.conf'
|
||||||
|
pc.parent.mkdir(parents=True)
|
||||||
|
original = '[*]\nshow_trash=1\n[notes.txt]\nx=10\ny=20\n'
|
||||||
|
pc.write_text(original)
|
||||||
|
panel = config / 'lxpanel/LXDE/panels/panel'
|
||||||
|
panel.parent.mkdir(parents=True)
|
||||||
|
panel.write_text('Global {\nedge=bottom\n}\nPlugin {\ntype=tray\n}\n')
|
||||||
|
for _ in range(2):
|
||||||
|
branding.configure(home, ROOT, [(1920, 1080, 0, 0)], Path(tmp) / 'system')
|
||||||
|
self.assertTrue((home / 'Рабочий стол' / branding.APP).exists())
|
||||||
|
self.assertIn('show_trash=1', pc.read_text())
|
||||||
|
self.assertIn('[notes.txt]', pc.read_text())
|
||||||
|
self.assertIn('x=900\ny=500', pc.read_text())
|
||||||
|
self.assertIn('type=tray', panel.read_text())
|
||||||
|
self.assertEqual(panel.read_text().count(branding.APP), 1)
|
||||||
|
self.assertEqual(list(panel.parent.iterdir()), [panel])
|
||||||
|
self.assertFalse((config / 'lxpanel/.iomatex-backups/panels').exists())
|
||||||
|
self.assertEqual((pc.parent.parent / '.iomatex-backups/LXDE/desktop-items-0.conf').read_text(), original)
|
||||||
|
|
||||||
|
def test_system_panel_copied_and_small_display_centered(self):
|
||||||
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
|
home, system = Path(tmp) / 'home', Path(tmp) / 'system'
|
||||||
|
panel = system / 'lxpanel/LXDE/panels/panel'
|
||||||
|
panel.parent.mkdir(parents=True)
|
||||||
|
panel.write_text('Global {\nedge=bottom\n}\nPlugin {\ntype=menu\n}\n')
|
||||||
|
branding.configure(home, ROOT, [(800, 600, 0, 0)], system)
|
||||||
|
target = home / '.config/lxpanel/LXDE/panels/panel'
|
||||||
|
self.assertIn('type=menu', target.read_text())
|
||||||
|
self.assertNotIn(branding.APP, panel.read_text())
|
||||||
|
pc = home / '.config/pcmanfm/LXDE/desktop-items-0.conf'
|
||||||
|
self.assertIn('x=340\ny=260', pc.read_text())
|
||||||
|
branding.configure(home, ROOT, [(1280, 720, 0, 0)], system)
|
||||||
|
self.assertIn('x=580\ny=320', pc.read_text())
|
||||||
|
|
||||||
|
def test_missing_bottom_panel_created_once(self):
|
||||||
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
|
home = Path(tmp)
|
||||||
|
for _ in range(2):
|
||||||
|
branding.configure(home, ROOT, [(1280, 720, 0, 0)], home / 'system')
|
||||||
|
panels = home / '.config/lxpanel/LXDE/panels'
|
||||||
|
self.assertEqual([p.name for p in panels.iterdir()], ['iomatex'])
|
||||||
|
self.assertEqual((panels / 'iomatex').read_text().count(branding.APP), 1)
|
||||||
|
|
||||||
|
def test_launcher_reports_missing_service_and_uses_existing_service(self):
|
||||||
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
|
root = Path(tmp)
|
||||||
|
commands = {
|
||||||
|
'systemctl': 'echo "$TEST_LOAD_STATE"',
|
||||||
|
'sudo': 'printf "%s\\n" "$*" > "$TEST_CALL"',
|
||||||
|
'logger': 'exit 0',
|
||||||
|
'xmessage': 'exit 0',
|
||||||
|
}
|
||||||
|
for name, command in commands.items():
|
||||||
|
path = root / name
|
||||||
|
path.write_text('#!/bin/sh\n' + command + '\n')
|
||||||
|
path.chmod(0o755)
|
||||||
|
env = dict(os.environ, PATH=str(root), TEST_CALL=str(root / 'call'),
|
||||||
|
TEST_LOAD_STATE='not-found')
|
||||||
|
script = ['/bin/sh', str(ROOT / 'iomatex-open-evax10')]
|
||||||
|
self.assertNotEqual(subprocess.run(script, env=env).returncode, 0)
|
||||||
|
self.assertFalse((root / 'call').exists())
|
||||||
|
env['TEST_LOAD_STATE'] = 'loaded'
|
||||||
|
self.assertEqual(subprocess.run(script, env=env).returncode, 0)
|
||||||
|
self.assertEqual((root / 'call').read_text().strip(),
|
||||||
|
'-n /usr/bin/systemctl --no-block start itscreen-x11.service')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
|
@ -1104,6 +1104,71 @@ EOF
|
||||||
|
|
||||||
ensure_gui_home_state "$IOM_USER"
|
ensure_gui_home_state "$IOM_USER"
|
||||||
ensure_lightdm_iomatex_login
|
ensure_lightdm_iomatex_login
|
||||||
|
|
||||||
|
install_desktop_branding() {
|
||||||
|
local assets=/usr/local/share/iomatex/desktop
|
||||||
|
local home_dir user_group
|
||||||
|
home_dir="$(getent passwd "$IOM_USER" | cut -d: -f6)"
|
||||||
|
user_group="$(id -gn "$IOM_USER")"
|
||||||
|
apt_install_missing lxterminal fonts-dejavu-core
|
||||||
|
install -d -m 0755 "$assets" /usr/local/bin /usr/share/applications
|
||||||
|
install -m 0644 "$SCRIPT_DIR/../stage_ui/iomatex_logo_source.png" "$assets/iomatex.png"
|
||||||
|
install -m 0644 "$SCRIPT_DIR/desktop/evax10_launcher.png" "$assets/evax10_launcher.png"
|
||||||
|
install -m 0644 "$SCRIPT_DIR/desktop/app-icon-source.json" "$assets/app-icon-source.json"
|
||||||
|
install -m 0644 "$SCRIPT_DIR/desktop/wallpaper-purple.png" "$assets/wallpaper-purple.png"
|
||||||
|
install -m 0644 "$SCRIPT_DIR/desktop/transition.png" "$assets/transition.png"
|
||||||
|
install -d -m 0755 "$assets/icons"
|
||||||
|
install -m 0644 "$SCRIPT_DIR/desktop/icons/"*.svg "$assets/icons/"
|
||||||
|
install -m 0755 "$SCRIPT_DIR/desktop/iomatex-desktop-branding" /usr/local/bin/iomatex-desktop-branding
|
||||||
|
install -m 0755 "$SCRIPT_DIR/desktop/iomatex-open-evax10" /usr/local/bin/iomatex-open-evax10
|
||||||
|
install -m 0755 "$SCRIPT_DIR/desktop/iomatex-terminal" /usr/local/bin/iomatex-terminal
|
||||||
|
install -m 0755 "$SCRIPT_DIR/desktop/iomatex-terminal-help" /usr/local/bin/iomatex-terminal-help
|
||||||
|
update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/local/bin/iomatex-terminal 60
|
||||||
|
update-alternatives --set x-terminal-emulator /usr/local/bin/iomatex-terminal
|
||||||
|
runuser -u "$IOM_USER" -- env HOME="$home_dir" /usr/local/bin/iomatex-desktop-branding --terminal
|
||||||
|
install -m 0644 "$SCRIPT_DIR/desktop/evax10-return.desktop" "$assets/evax10-return.desktop"
|
||||||
|
install -m 0644 "$assets/evax10-return.desktop" /usr/share/applications/evax10-return.desktop
|
||||||
|
/usr/local/bin/iomatex-desktop-branding --wallpaper
|
||||||
|
# Only this exact service start is passwordless; no arbitrary root commands.
|
||||||
|
write_if_changed /etc/sudoers.d/91-iomatex-desktop 0440 <<EOF
|
||||||
|
${IOM_USER} ALL=(root) NOPASSWD: /usr/bin/systemctl --no-block start itscreen-x11.service
|
||||||
|
EOF
|
||||||
|
visudo -cf /etc/sudoers.d/91-iomatex-desktop
|
||||||
|
if { command -v pcmanfm >/dev/null 2>&1 && command -v lxpanel >/dev/null 2>&1; } || command -v xfdesktop >/dev/null 2>&1; then
|
||||||
|
# Debian sources .xsessionrc before launching the desktop and its panels.
|
||||||
|
# Prepare positions after X11 mode detection but before PCManFM reads them.
|
||||||
|
local hook='[ ! -x /usr/local/bin/iomatex-desktop-branding ] || /usr/local/bin/iomatex-desktop-branding || logger -t iomatex-desktop "Desktop configuration failed"'
|
||||||
|
if ! grep -qF '/usr/local/bin/iomatex-desktop-branding' "$home_dir/.xsessionrc" 2>/dev/null; then
|
||||||
|
backup_if_exists "$home_dir/.xsessionrc"
|
||||||
|
printf '\n# iOmatex desktop branding\n%s\n' "$hook" >> "$home_dir/.xsessionrc"
|
||||||
|
chown "$IOM_USER:$user_group" "$home_dir/.xsessionrc"
|
||||||
|
fi
|
||||||
|
runuser -u "$IOM_USER" -- env HOME="$home_dir" /usr/local/bin/iomatex-desktop-branding
|
||||||
|
log "iOmatex desktop branding installed; applied on next desktop login"
|
||||||
|
else
|
||||||
|
log "Desktop branding: LXDE/XFCE not detected; application menu entry installed only"
|
||||||
|
fi
|
||||||
|
if [ -x /usr/sbin/lightdm-gtk-greeter ]; then
|
||||||
|
write_if_changed /etc/lightdm/lightdm-gtk-greeter.conf.d/80-iomatex.conf 0644 <<EOF
|
||||||
|
[greeter]
|
||||||
|
background=${assets}/transition.png
|
||||||
|
default-user-image=${assets}/evax10_launcher.png
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
install -m 0755 "$SCRIPT_DIR/desktop/iomatex-boot-splash" /usr/local/bin/iomatex-boot-splash
|
||||||
|
install -m 0644 "$SCRIPT_DIR/desktop/iomatex-boot-splash.service" /etc/systemd/system/iomatex-boot-splash.service
|
||||||
|
local display_unit
|
||||||
|
for display_unit in lightdm itscreen-x11; do
|
||||||
|
write_if_changed "/etc/systemd/system/${display_unit}.service.d/15-iomatex-splash.conf" 0644 <<'EOF'
|
||||||
|
[Service]
|
||||||
|
ExecStartPre=-/bin/systemctl stop iomatex-boot-splash.service
|
||||||
|
EOF
|
||||||
|
done
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable iomatex-boot-splash.service
|
||||||
|
log "iOmatex userspace boot splash enabled; signed U-Boot FIT left intact"
|
||||||
|
}
|
||||||
|
install_desktop_branding
|
||||||
if id youngfeel >/dev/null 2>&1; then
|
if id youngfeel >/dev/null 2>&1; then
|
||||||
log "Harden vendor user: youngfeel (lock password, disable shell, remove sudo)"
|
log "Harden vendor user: youngfeel (lock password, disable shell, remove sudo)"
|
||||||
soft_run "Lock password youngfeel" 10 /usr/bin/passwd -l youngfeel
|
soft_run "Lock password youngfeel" 10 /usr/bin/passwd -l youngfeel
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"version": "1.0.4"
|
"version": "1.0.5"
|
||||||
}
|
}
|
||||||
|
|
|
||||||