mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 14:00:10 +02:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6df6f97937 | ||
|
|
5e3323c188 | ||
|
|
25504e0ed4 | ||
|
|
ec870d2d7a | ||
|
|
80797c98b9 | ||
|
|
2fadbbe148 | ||
|
|
5ee07f99a8 | ||
|
|
d995b815f8 |
No files matched your search
+15
-2
@@ -133,7 +133,7 @@ A few overlays need special handling:
|
|||||||
|
|
||||||
Head follow is experimental and off by default. It works, but it's only lightly tested, and the feel is mostly a matter of its settings; polishing it is left open. With it on (`POINTER_FOLLOW=1`, or a mouse button mapped to Head follow on/off), the cursor rides on a reference direction, where you were facing when your head last settled, and keeps its offset from it. The mouse can put the cursor anywhere up to `POINTER_FOLLOW_REACH` (70 degrees) from the reference, a corner of your view included. While your head stays within `POINTER_LEASH_DEG` of the reference, nothing moves on its own. Once your head has been past the leash for `POINTER_LEASH_DELAY` (0.2 s, so a glance out and back doesn't count), the reference eases to where you're facing (time constant `POINTER_LEASH_RETURN`, 0.2 s), never falling further behind than the leash, and the cursor ends up back where it was in your view. Then it waits for the leash again. Two earlier versions didn't work out. Moving the reference only while your head pulled at the end of the leash left it up to the leash off after you turned back, and getting it centred again meant overshooting with your head. Easing it toward your facing all the time moved the cursor on every small head movement. A leash of 0 makes the reference your facing direction, so the cursor is locked to your view, and mouse movement shifts it within the view. Head roll is ignored, so tilting your head doesn't swing the cursor around. While the left button is held the cursor stays put in the room, so your head can't nudge a click or a drag. When you let go, it carries on from where it is instead of jumping.
|
Head follow is experimental and off by default. It works, but it's only lightly tested, and the feel is mostly a matter of its settings; polishing it is left open. With it on (`POINTER_FOLLOW=1`, or a mouse button mapped to Head follow on/off), the cursor rides on a reference direction, where you were facing when your head last settled, and keeps its offset from it. The mouse can put the cursor anywhere up to `POINTER_FOLLOW_REACH` (70 degrees) from the reference, a corner of your view included. While your head stays within `POINTER_LEASH_DEG` of the reference, nothing moves on its own. Once your head has been past the leash for `POINTER_LEASH_DELAY` (0.2 s, so a glance out and back doesn't count), the reference eases to where you're facing (time constant `POINTER_LEASH_RETURN`, 0.2 s), never falling further behind than the leash, and the cursor ends up back where it was in your view. Then it waits for the leash again. Two earlier versions didn't work out. Moving the reference only while your head pulled at the end of the leash left it up to the leash off after you turned back, and getting it centred again meant overshooting with your head. Easing it toward your facing all the time moved the cursor on every small head movement. A leash of 0 makes the reference your facing direction, so the cursor is locked to your view, and mouse movement shifts it within the view. Head roll is ignored, so tilting your head doesn't swing the cursor around. While the left button is held the cursor stays put in the room, so your head can't nudge a click or a drag. When you let go, it carries on from where it is instead of jumping.
|
||||||
|
|
||||||
Gaze mode is experimental and off by default (`POINTER_GAZE=1`, the Gaze page of Frametop Input Settings, `gaze/ft-gazectl on`, or a mouse button or key combination mapped to Gaze pointer on/off). It's MAGIC pointing (Zhai, Morimoto and Ihde, 1999): the pointer goes where you look, and the mouse does the last bit. The gaze service (`gaze/ft-gazed`) sends the helper the corrected gaze at 90 Hz (from one eye while the tracker has lost the other), and while the gaze has the pointer, the cursor ray is that gaze from the eye. The pointer is aimed at the gaze each frame, not steered toward it, so nothing can pile up. An earlier try in the gaze probe steered the pointer with relative moves, and lost it when the pointer went idle or a controller had the laser. By default (`POINTER_GAZE_MOUSE_MOVE=held`, the Gaze page's Mouse movement switch) moving the mouse does nothing while the gaze has the pointer: it moves the pointer only while a button is held, as a correction. A bumped or drifting mouse can't pull the pointer off what you're looking at, and every mouse move is a correction, so the lessons aren't polluted by mouse moves to somewhere else (they used to be kept out by an 8 degree limit, which also dropped real corrections when the tracker was further off). With the gaze stale for a second, in a game, or with the headset off, the mouse moves the pointer as usual; with `free`, moving the mouse takes the pointer from the gaze. A left press while the gaze has the pointer isn't sent at once: the pointer stops where the gaze put it, you drag it onto what you meant with the button still down (panels only see it hover), and the release clicks there. Clicking at once clicked wherever the gaze was, often the wrong thing, before you could correct it. The drag is the correction. Snapping the pointer onto buttons and links is deferred: it needs accessibility (AT-SPI) on in the Frametop session, where it's off (no registry runs), plus app restarts, and it makes Chromium and Electron apps use more CPU. A press held still for `POINTER_GAZE_HOLD` (0.5 s) becomes a real press, so drags still work: hold, then move. The right button works the same way, with the right click on the release, and pressing it while the left press is held back starts a drag where the pointer is, like Meta+J then Meta+K. That drag lasts while either button (or key) is held, so a second right press, or a second Meta+K, is free to pan and tilt the panel being dragged; with the keyboard, the head turns it. Outside games the pointer then stays: the mouse going idle doesn't release it. A moving controller still releases it, as without gaze. Gaze mode is a mouse and keyboard feature: Steam reads the Frame controllers itself, outside SteamVR's bindings, so controller clicks at the gaze kept knocking SteamVR out of laser mode (see `docs/gaze-controllers.md`). Keyboard clicks (Meta+J, Meta+K) hold the dot still in your view while the keys are down, so the head, not the mouse, does the last bit; a quick tap clicks where the dot was at the press, since the head moves as you hit the keys. The relay hides Meta from the desktop as soon as such a combination fires, because KWin takes Meta with a mouse button as a window move or resize, which swallowed the clicks. The dot shows all the time by default. With `POINTER_GAZE_DOT=moving` it shows only while the mouse moves it (`POINTER_GAZE_SHOW`), while a press is held, and as a pulse for each click; otherwise it's transparent, so the laser still lands on it. Looking more than `POINTER_GAZE_RETAKE` (5 degrees) away from it, with the mouse still, gives it back, so small eye movements around the pointer don't pull it off what you're doing. A mouse nudge before a click whose correction is within `POINTER_GAZE_NUDGE_MAX` (55 degrees, half of what the headset shows across) is sent to the gaze service as a lesson: you were looking at where you clicked when the mouse took over, so the nudge is the eye tracker's error there. Using it is what calibrates it. A one-dot check in a panel fixed to the headset tops that up when the headset goes on, when our tracker thinks it moved, and when a correction is past that limit (the tracker is far off, so a click there isn't trusted as a lesson), and the full calibration and the headset fit check run in the same panel, so everything a user does to calibrate happens in one place in the headset; the gaze probe, a fullscreen GTK app, is the development tool. The limit was 8 degrees, which dropped every correction while our tracker was 12 off. Its dots sit at known directions from the headset, so the panel needs no screen geometry. The quick check's dot takes the gaze once it has held still, so what the tracker says doesn't have to be close for the capture to work. The full calibration's and the five-dot check's dots wait for a click while you look at the dot (a left click or Meta+J), because a steady gaze isn't always on the dot, and take the gaze held still up to the click; a right click or MetLine truncated
|
Gaze mode is experimental and off by default (`POINTER_GAZE=1`, the Gaze page of Frametop Input Settings, `gaze/ft-gazectl on`, or a mouse button or key combination mapped to Gaze pointer on/off). It's MAGIC pointing (Zhai, Morimoto and Ihde, 1999): the pointer goes where you look, and the mouse does the last bit. The gaze service (`gaze/ft-gazed`) sends the helper the corrected gaze at 90 Hz (from one eye while the tracker has lost the other), and while the gaze has the pointer, the cursor ray is that gaze from the eye. The pointer is aimed at the gaze each frame, not steered toward it, so nothing can pile up. An earlier try in the gaze probe steered the pointer with relative moves, and lost it when the pointer went idle or a controller had the laser. By default (`POINTER_GAZE_MOUSE_MOVE=held`, the Gaze page's Mouse movement switch) moving the mouse does nothing while the gaze has the pointer: it moves the pointer only while a button is held, as a correction. A bumped or drifting mouse can't pull the pointer off what you're looking at, and every mouse move is a correction, so the lessons aren't polluted by mouse moves to somewhere else (they used to be kept out by an 8 degree limit, which also dropped real corrections when the tracker was further off). With the gaze stale for a second, in a game, or with the headset off, the mouse moves the pointer as usual; with `free`, moving the mouse takes the pointer from the gaze. A left press while the gaze has the pointer isn't sent at once: the pointer stops where the gaze put it, you drag it onto what you meant with the button still down (panels only see it hover), and the release clicks there. Clicking at once clicked wherever the gaze was, often the wrong thing, before you could correct it. The drag is the correction. Snapping the pointer onto buttons and links is deferred: the session now starts an AT-SPI registry, but apps still need to expose useful accessibility trees (and may need restarting), and it makes Chromium and Electron apps use more CPU. A press held still for `POINTER_GAZE_HOLD` (0.5 s) becomes a real press, so drags still work: hold, then move. The right button works the same way, with the right click on the release, and pressing it while the left press is held back starts a drag where the pointer is, like Meta+J then Meta+K. That drag lasts while either button (or key) is held, so a second right press, or a second Meta+K, is free to pan and tilt the panel being dragged; with the keyboard, the head turns it. Outside games the pointer then stays: the mouse going idle doesn't release it. A moving controller still releases it, as without gaze. Gaze mode is a mouse and keyboard feature: Steam reads the Frame controllers itself, outside SteamVR's bindings, so controller clicks at the gaze kept knocking SteamVR out of laser mode (see `docs/gaze-controllers.md`). Keyboard clicks (Meta+J, Meta+K) hold the dot still in your view while the keys are down, so the head, not the mouse, does the last bit; a quick tap clicks where the dot was at the press, since the head moves as you hit the keys. The relay hides Meta from the desktop as soon as such a combination fires, because KWin takes Meta with a mouse button as a window move or resize, which swallowed the clicks. The dot shows all the time by default. With `POINTER_GAZE_DOT=moving` it shows only while the mouse moves it (`POINTER_GAZE_SHOW`), while a press is held, and as a pulse for each click; otherwise it's transparent, so the laser still lands on it. Looking more than `POINTER_GAZE_RETAKE` (5 degrees) away from it, with the mouse still, gives it back, so small eye movements around the pointer don't pull it off what you're doing. A mouse nudge before a click whose correction is within `POINTER_GAZE_NUDGE_MAX` (55 degrees, half of what the headset shows across) is sent to the gaze service as a lesson: you were looking at where you clicked when the mouse took over, so the nudge is the eye tracker's error there. Using it is what calibrates it. A one-dot check in a panel fixed to the headset tops that up when the headset goes on, when our tracker thinks it moved, and when a correction is past that limit (the tracker is far off, so a click there isn't trusted as a lesson), and the full calibration and the headset fit check run in the same panel, so everything a user does to calibrate happens in one place in the headset; the gaze probe, a fullscreen GTK app, is the development tool. The limit was 8 degrees, which dropped every correction while our tracker was 12 off. Its dots sit at known directions from the headset, so the panel needs no screen geometry. The quick check's dot takes the gaze once it has held still, so what the tracker says doesn't have to be close for the capture to work. The full calibration's and the five-dot check's dots wait for a click while you look at the dot (a left click or Meta+J), because a steady gaze isn't always on the dot, and take the gaze held still up to the click; a rightLine truncated
|
||||||
|
|
||||||
Replacing a loaded driver's files, as re-running the installer used to do, leaves SteamVR honoring the virtual controller's hand role but not its laser claim: the dashboard pointer stays unassigned until SteamVR restarts. The driver installer now leaves an unchanged driver in place.
|
Replacing a loaded driver's files, as re-running the installer used to do, leaves SteamVR honoring the virtual controller's hand role but not its laser claim: the dashboard pointer stays unassigned until SteamVR restarts. The driver installer now leaves an unchanged driver in place.
|
||||||
|
|
||||||
@@ -173,6 +173,18 @@ The session is modeled on SteamOS's `steamos-nested-desktop` and runs beside it.
|
|||||||
|
|
||||||
The VR launcher starts the session from the Steam client, and the client's environment came along: `LD_LIBRARY_PATH` pointing at Steam's own runtime, whose `libavcodec` has no H.264 decoder, so VLC in the desktop couldn't play most videos, plus the client's overlay and launch settings. The session script drops the client's variables before it starts anything. SteamOS's global Mesa settings (`/usr/share/deckard/mesavars.sh`) stay, and the gamescope session's Vulkan layer (`ENABLE_GAMESCOPE_WSI`) is only kept for the gamescope backend.
|
The VR launcher starts the session from the Steam client, and the client's environment came along: `LD_LIBRARY_PATH` pointing at Steam's own runtime, whose `libavcodec` has no H.264 decoder, so VLC in the desktop couldn't play most videos, plus the client's overlay and launch settings. The session script drops the client's variables before it starts anything. SteamOS's global Mesa settings (`/usr/share/deckard/mesavars.sh`) stay, and the gamescope session's Vulkan layer (`ENABLE_GAMESCOPE_WSI`) is only kept for the gamescope backend.
|
||||||
|
|
||||||
|
### Nested accessibility
|
||||||
|
|
||||||
|
The session drops an inherited `AT_SPI_BUS_ADDRESS`, so apps cannot accidentally use the host desktop's registry. It autostarts `session/ft-atspi` in Plasma phase 2, after KWin has set the nested display environment. The helper gets the live accessibility address from `org.a11y.Bus` on the private session bus, preserves any existing registry owner, updates the accessibility bus's activation environment, and tries `StartServiceByName` first.
|
||||||
|
|
||||||
|
On SteamOS 0.3.0 with at-spi2-core 2.52.0, the native launcher can choose dbus-broker because its process belongs to a systemd user unit. Registry activation then fails: this desktop's private session bus does not have a systemd activation manager. In that case the helper starts only `at-spi2-registryd` on the already-existing accessibility bus. The registry refuses duplicate ownership. Unlike native activation's `--use-gnome-session`, the fallback does not try to register with GNOME's session manager; that flag did not explain the observed native activation failure.
|
||||||
|
|
||||||
|
The fallback registry does not exit merely when its bus disconnects in the isolated SteamOS test. Its small watcher checks both private buses every 5 seconds, and terminates and reaps only the child it started when either bus disappears or the watcher is stopped. Each check runs `gdbus` twice; once a second, that cost about 1% of a core. `keep-apps.sh` keeps the watcher in the desktop unit when `desktops.sh start` runs the desktop as `frametop-desktop`. Started from the VR launcher, the desktop runs in steam.service, which doesn't stop with it, so there the watcher is the only thing that stops the registry. There is no second accessibility bus, global systemd environment update, process-name kill, or host registry replacement. Missing accessibility files or bus errors are nonfatal; the desktop still starts. Toolkit-specific accessibility opt-ins and pointer snapping are separate work.
|
||||||
|
|
||||||
|
Run the isolated checks on the host with `/usr/bin/python3 session/test/test_accessibility.py`. They use private D-Bus buses, Xvfb and a GTK3 app, never the production display or input. Native activation uses a small `org.a11y.Bus` test provider pointing to a real private dbus-daemon with the installed registry service; the SteamOS fallback uses the installed bus launcher and broker. The tests check real app-tree discovery, existing owners, concurrent starts, session stop/restart, and teardown. They require test-only PyGObject (Gio and GTK3), Xvfb, and at-spi2-core; the runtime helper uses Python's standard library and the existing host `gdbus`. Actual Plasma autostart and VR desktop restart still require an approved hardware test.
|
||||||
|
|
||||||
|
### Other session behavior
|
||||||
|
|
||||||
Steam, not systemd, suspends the Frame: after `system_idle_suspend_ac_sec` (an hour by default) without input on AC power, it logs `Switching to power state: k_ESystemPowerState_Sleep` and suspends, even while charging. It's a Steam setting (Settings → Power → When Plugged In and Idle → Sleep after), which the Stay awake while plugged in switch in Frametop Display Settings sets to Never. SteamVR's standby, which turns the displays off when the headset comes off, is separate; see below.
|
Steam, not systemd, suspends the Frame: after `system_idle_suspend_ac_sec` (an hour by default) without input on AC power, it logs `Switching to power state: k_ESystemPowerState_Sleep` and suspends, even while charging. It's a Steam setting (Settings → Power → When Plugged In and Idle → Sleep after), which the Stay awake while plugged in switch in Frametop Display Settings sets to Never. SteamVR's standby, which turns the displays off when the headset comes off, is separate; see below.
|
||||||
|
|
||||||
Flatpak apps need `XDG_DATA_DIRS` to include Flatpak's exports, or Plasma opens Discover instead of launching them, so the session sources `/etc/profile.d/flatpak.sh`.
|
Flatpak apps need `XDG_DATA_DIRS` to include Flatpak's exports, or Plasma opens Discover instead of launching them, so the session sources `/etc/profile.d/flatpak.sh`.
|
||||||
@@ -185,6 +197,8 @@ KWin renders with OpenGL through zink on Turnip, Vulkan on the same GPU vrcompos
|
|||||||
|
|
||||||
The nested session also runs the system's XDG autostart entries, being a KDE session. Discover's update notifier started `plasma-discover --mode update` in it (520 to 620 MB resident and about 9% of a core, plus `flatpak-system-helper` and AppStream downloads), and IBus started a daemon, the kimpanel panel and its GTK extension that nothing can use: KWin hands text input to the one input method it starts (`ft-textinput`), and the session drops `QT_IM_MODULE`, `GTK_IM_MODULE` and `XMODIFIERS`. The session hides both for this desktop only, with `Hidden=true` copies in its own autostart folder. The geoclue demo agent stays: it's what answers apps' location requests to Geoclue outside GNOME, and it costs nothing while idle. Orca's entry only starts in GNOME-family desktops.
|
The nested session also runs the system's XDG autostart entries, being a KDE session. Discover's update notifier started `plasma-discover --mode update` in it (520 to 620 MB resident and about 9% of a core, plus `flatpak-system-helper` and AppStream downloads), and IBus started a daemon, the kimpanel panel and its GTK extension that nothing can use: KWin hands text input to the one input method it starts (`ft-textinput`), and the session drops `QT_IM_MODULE`, `GTK_IM_MODULE` and `XMODIFIERS`. The session hides both for this desktop only, with `Hidden=true` copies in its own autostart folder. The geoclue demo agent stays: it's what answers apps' location requests to Geoclue outside GNOME, and it costs nothing while idle. Orca's entry only starts in GNOME-family desktops.
|
||||||
|
|
||||||
|
Plasma 6.2.5 keeps each panel on a screen number (`lastScreen` in `plasma-org.kde.plasma.desktop-appletsrc`), and the numbers rank the enabled outputs by priority, so 0 is the primary screen. A panel whose number is past the screen count gets no view, and Plasma never moves it: the remap it runs at every start only moves a panel whose number has no desktop, and this desktop keeps a desktop for every output it has seen, spares included. So the taskbar was lost when the number of screens went down, and once it was found saved on a spare output, number 8 of a desktop with three screens ([#18](https://github.com/DeeJanuz/frametop/issues/18)). Before Plasma starts, the session runs `session/fix-panels.py`, which moves any panel numbered past the screen count, with its system tray's containment, to screen 0, keeping its widgets and settings. A panel stays put when screen 0 already has one on that edge, and comes back by itself if the screens do. The file is backed up to `<file>.ft-bak` first. Plasma's scripting can't do this while it runs (`panel.screen` is read-only in 6.2.5), so a lost taskbar comes back at the desktop's next start. `scripts/doctor.sh` and `scripts/report.sh` list the panels and their screens.
|
||||||
|
|
||||||
Remote desktop is a chain (krdp, then FreeRDP inside Xvnc) because nothing on SteamOS serves KWin over VNC directly. Kept connected all the time, it cost about a core with nobody watching: krdpserver 55 to 78% (it encodes H.264 in software with openh264: VA-API finds no driver for the Frame's GPU in the container), FreeRDP 16 to 27%, Xvnc 6 to 11%, and the bridge's layout check every 5 seconds another 4%. krdp creates its screencast session per RDP connection and drops it when the connection closes (`SessionController::onNewConnection` in krdp 6.7), so an idle krdpserver costs nothing and can stay up; only the RDP connection has to go. The bridge connects FreeRDP when a VNC client appears and disconnects 45 seconds after the last one leaves. Xvnc has no hook for its clients, so the bridge counts established connections to its port with `ss`, woken early by Xvnc's log output; looking with `ss` once a second cost about 0.9% of a core in bash, against about 0.1% this way. `Xvnc -inetd` from a systemd socket would start a server per connection and lose sharing between viewers. The layout check (`ft-layout remote-view`, which scans `/proc` for plasmashell and runs `kscreen-doctor -j`) now runs only while FreeRDP runs, and then only after `kwinoutputconfig.json` or `frametop-layout.json` changes, with one check a minute in case a change touched neither.
|
Remote desktop is a chain (krdp, then FreeRDP inside Xvnc) because nothing on SteamOS serves KWin over VNC directly. Kept connected all the time, it cost about a core with nobody watching: krdpserver 55 to 78% (it encodes H.264 in software with openh264: VA-API finds no driver for the Frame's GPU in the container), FreeRDP 16 to 27%, Xvnc 6 to 11%, and the bridge's layout check every 5 seconds another 4%. krdp creates its screencast session per RDP connection and drops it when the connection closes (`SessionController::onNewConnection` in krdp 6.7), so an idle krdpserver costs nothing and can stay up; only the RDP connection has to go. The bridge connects FreeRDP when a VNC client appears and disconnects 45 seconds after the last one leaves. Xvnc has no hook for its clients, so the bridge counts established connections to its port with `ss`, woken early by Xvnc's log output; looking with `ss` once a second cost about 0.9% of a core in bash, against about 0.1% this way. `Xvnc -inetd` from a systemd socket would start a server per connection and lose sharing between viewers. The layout check (`ft-layout remote-view`, which scans `/proc` for plasmashell and runs `kscreen-doctor -j`) now runs only while FreeRDP runs, and then only after `kwinoutputconfig.json` or `frametop-layout.json` changes, with one check a minute in case a change touched neither.
|
||||||
|
|
||||||
Program names stay within 15 characters, because Linux truncates process names there and the scripts find programs with `pgrep -x` and `pkill -x`. That's why the prefix is `ft-`.
|
Program names stay within 15 characters, because Linux truncates process names there and the scripts find programs with `pgrep -x` and `pkill -x`. That's why the prefix is `ft-`.
|
||||||
@@ -224,6 +238,5 @@ On the Frame, SteamVR is part of the OS image (`/opt/steamvr`, the `deckard-stea
|
|||||||
|
|
||||||
- A controller button that shows the screens during a game. Games own the controllers, so this needs SteamVR input actions for ft-screens.
|
- A controller button that shows the screens during a game. Games own the controllers, so this needs SteamVR input actions for ft-screens.
|
||||||
- Drawing KWin's cursor on the screens.
|
- Drawing KWin's cursor on the screens.
|
||||||
- Plasma can lose its panels when the number of screens goes down, because they're saved against a screen that no longer exists. Removing `plasma-org.kde.plasma.desktop-appletsrc` and `plasmashellrc` from `~/.config/frametop` brings the default panels back.
|
|
||||||
- Frame pacing and GPU cost with several busy screens haven't been measured.
|
- Frame pacing and GPU cost with several busy screens haven't been measured.
|
||||||
- Real standby on a stand, with rendering and tracking paused, not just the backlight off. SteamVR has no call for it, and its activity level follows the proximity sensor.
|
- Real standby on a stand, with rendering and tracking paused, not just the backlight off. SteamVR has no call for it, and its activity level follows the proximity sensor.
|
||||||
@@ -18,6 +18,8 @@ desktops.sh start | stop | restart | status | log [lines]
|
|||||||
|
|
||||||
When the VR launcher starts the desktop, it inherits the Steam client's environment. The session script drops the client's runtime from it (`LD_LIBRARY_PATH`, the `STEAM_*` settings, and the Steam overlay's Vulkan layer), so apps in the desktop use the system's libraries, including its video codecs, just as they would after a normal login.
|
When the VR launcher starts the desktop, it inherits the Steam client's environment. The session script drops the client's runtime from it (`LD_LIBRARY_PATH`, the `STEAM_*` settings, and the Steam overlay's Vulkan layer), so apps in the desktop use the system's libraries, including its video codecs, just as they would after a normal login.
|
||||||
|
|
||||||
|
The nested session also starts an AT-SPI accessibility registry through `session/ft-atspi` in Plasma's autostart. It discovers the bus from this session, ignores an inherited host accessibility address, and leaves an existing registry alone. Accessibility errors do not stop the desktop. This supplies the registry infrastructure for apps that expose AT-SPI trees; it does not enable gaze snapping or force Chromium/Electron accessibility. After an approved desktop restart, an AT-SPI-aware app should be visible on the nested bus. See [design.md](design.md#nested-accessibility) for native activation, fallback lifecycle, and the isolated test command.
|
||||||
|
|
||||||
KWin's blur and background contrast effects and its animations are off in this desktop, because KWin draws on the headset's GPU, which SteamVR needs. The session script turns them off once, the first time it starts (it leaves a setting you already have alone, and marks it done in `~/.config/frametop/frametoprc`), so turning them back on sticks. In the Frametop desktop, System Settings → Window Management → Desktop Effects has Blur and Background Contrast, and General Behavior has Animation speed. Or from a terminal, then restart the desktop:
|
KWin's blur and background contrast effects and its animations are off in this desktop, because KWin draws on the headset's GPU, which SteamVR needs. The session script turns them off once, the first time it starts (it leaves a setting you already have alone, and marks it done in `~/.config/frametop/frametoprc`), so turning them back on sticks. In the Frametop desktop, System Settings → Window Management → Desktop Effects has Blur and Background Contrast, and General Behavior has Animation speed. Or from a terminal, then restart the desktop:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1409,6 +1409,7 @@ struct Press {
|
|||||||
double x = 0, y = 0; // ...and where on it, in buffer pixels
|
double x = 0, y = 0; // ...and where on it, in buffer pixels
|
||||||
double distance = 1; // from the laser's start to the last panel it met
|
double distance = 1; // from the laser's start to the last panel it met
|
||||||
long upAt = -1; // the pointer helper saw left come up: release it at this tick
|
long upAt = -1; // the pointer helper saw left come up: release it at this tick
|
||||||
|
int64_t idleSince = -1; // the pressing controller has held nothing since (ms, ReleaseStuck)
|
||||||
};
|
};
|
||||||
Press g_press;
|
Press g_press;
|
||||||
vr::VROverlayHandle_t g_catcher = vr::k_ulOverlayHandleInvalid;
|
vr::VROverlayHandle_t g_catcher = vr::k_ulOverlayHandleInvalid;
|
||||||
@@ -1445,6 +1446,47 @@ void ReleaseAway(uint32_t button, void (*handle)(const struct ft_event *, void *
|
|||||||
handle(&e, data);
|
handle(&e, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Whether a hand controller holds anything (a button down): 1 yes, 0 no, -1 unknown. SteamVR
|
||||||
|
// answers overlay apps only while a VR game runs (checked 2026-10-04); outside games it can't
|
||||||
|
// say. The Frame controller's axes have no types, so the buttons are all there is.
|
||||||
|
int ControllerHolds(vr::TrackedDeviceIndex_t dev) {
|
||||||
|
vr::VRControllerState_t st{};
|
||||||
|
if (!vr::VRSystem()->GetControllerState(dev, &st, sizeof st)) return -1;
|
||||||
|
return st.ulButtonPressed ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Releases SteamVR never sends. Pausing, or hiding the screen a button went down on, takes the
|
||||||
|
// laser off it mid-click (the pause gesture's second thumbstick click does that), and SteamVR's
|
||||||
|
// laser mouse then forgets the button: no release comes, the catcher stayed up, and the game
|
||||||
|
// never got its controllers back (2026-10-04). So a held button is released here when it has
|
||||||
|
// no visible screen to come up on, or when its hand controller has held nothing for kStuckMs
|
||||||
|
// (only known during VR games, where the lost release took the game's controllers).
|
||||||
|
// The pointer helper's virtual controller has its own word for that ("up").
|
||||||
|
constexpr int64_t kStuckMs = 1000;
|
||||||
|
void ReleaseStuck(void (*handle)(const struct ft_event *, void *), void *data) {
|
||||||
|
if (!g_press.buttons) {
|
||||||
|
g_press.idleSince = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const char *why = nullptr;
|
||||||
|
const auto it = g_screens.find(g_press.screen);
|
||||||
|
if (g_paused) why = "paused";
|
||||||
|
else if (g_press.screen >= 0 && (it == g_screens.end() || !it->second.visible)) why = "its screen hid";
|
||||||
|
else if (IsHandController(g_press.device)) {
|
||||||
|
const int64_t now = NowMs();
|
||||||
|
if (ControllerHolds(g_press.device) != 0) g_press.idleSince = -1;
|
||||||
|
else if (g_press.idleSince < 0) g_press.idleSince = now;
|
||||||
|
else if (now - g_press.idleSince >= kStuckMs) why = "the controller holds nothing";
|
||||||
|
}
|
||||||
|
if (!why) return;
|
||||||
|
std::printf("a held button can't come up on a screen (%s): released\n", why);
|
||||||
|
const vr::TrackedDeviceIndex_t dev = g_press.device;
|
||||||
|
for (uint32_t b = 0; b < 32; ++b)
|
||||||
|
if (g_press.buttons & (1u << b)) ReleaseAway(BTN_LEFT + b, handle, data);
|
||||||
|
g_press.buttons = 0, g_press.upAt = -1, g_press.idleSince = -1;
|
||||||
|
EndDragsBy(dev);
|
||||||
|
}
|
||||||
|
|
||||||
void ShowCatcher(bool on) {
|
void ShowCatcher(bool on) {
|
||||||
if (on == g_catcherShown || g_catcher == vr::k_ulOverlayHandleInvalid) return;
|
if (on == g_catcherShown || g_catcher == vr::k_ulOverlayHandleInvalid) return;
|
||||||
g_catcherShown = on;
|
g_catcherShown = on;
|
||||||
@@ -2232,6 +2274,7 @@ void ft_vr_poll(void (*handle)(const struct ft_event *, void *), void *data) {
|
|||||||
if (ev.eventType == vr::VREvent_MouseButtonUp)
|
if (ev.eventType == vr::VREvent_MouseButtonUp)
|
||||||
ReleaseAwayBy(ev.trackedDeviceIndex, ev.data.mouse.button, handle, data);
|
ReleaseAwayBy(ev.trackedDeviceIndex, ev.data.mouse.button, handle, data);
|
||||||
if (g_press.upAt >= 0 && g_tick >= g_press.upAt) ReleaseAway(BTN_LEFT, handle, data);
|
if (g_press.upAt >= 0 && g_tick >= g_press.upAt) ReleaseAway(BTN_LEFT, handle, data);
|
||||||
|
ReleaseStuck(handle, data);
|
||||||
RefreshChrome();
|
RefreshChrome();
|
||||||
while (vr::VRSystem()->PollNextEvent(&ev, sizeof ev)) {
|
while (vr::VRSystem()->PollNextEvent(&ev, sizeof ev)) {
|
||||||
if (ev.eventType == vr::VREvent_Quit) {
|
if (ev.eventType == vr::VREvent_Quit) {
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ check "distrobox" on_frame 'test -x ~/.local/bin/distrobox && ~/.local/bin/distr
|
|||||||
check "container $FRAME_BOX" on_frame "podman ps -a --filter name=^$FRAME_BOX\$ --format '{{.Image}} {{.Status}}' | grep ."
|
check "container $FRAME_BOX" on_frame "podman ps -a --filter name=^$FRAME_BOX\$ --format '{{.Image}} {{.Status}}' | grep ."
|
||||||
check "repo on the Frame" on_frame 'pwd'
|
check "repo on the Frame" on_frame 'pwd'
|
||||||
check "free space in ~" on_frame "df -h ~ | awk 'NR==2{print \$4\" free\"}'"
|
check "free space in ~" on_frame "df -h ~ | awk 'NR==2{print \$4\" free\"}'"
|
||||||
|
# A taskbar saved on a screen the desktop doesn't have is hidden; the desktop's next start
|
||||||
|
# moves it to the first screen (session/fix-panels.py).
|
||||||
|
check "taskbar on a screen" on_frame 'set -o pipefail; [ -f session/fix-panels.py ] || { echo "not checked (older checkout)"; exit 0; }
|
||||||
|
python3 session/fix-panels.py --check | paste -sd ";" | sed "s/;/; /g"'
|
||||||
|
|
||||||
echo "what Frametop needs from SteamOS:"
|
echo "what Frametop needs from SteamOS:"
|
||||||
if [ "$FRAME_LOCAL" = 1 ]; then
|
if [ "$FRAME_LOCAL" = 1 ]; then
|
||||||
|
|||||||
@@ -42,6 +42,25 @@ for i, s in enumerate(d.get("screens", []), 1):
|
|||||||
print("visibility:", d.get("visibility"))
|
print("visibility:", d.get("visibility"))
|
||||||
PY
|
PY
|
||||||
|
|
||||||
|
section "Plasma panels and outputs"
|
||||||
|
python3 "$repo/session/fix-panels.py" --check 2>&1 || true
|
||||||
|
python3 - "$repo" <<'PY' 2>&1 || true
|
||||||
|
import json, subprocess, sys
|
||||||
|
sys.path.insert(0, sys.argv[1] + "/layout")
|
||||||
|
import ft_layout
|
||||||
|
env = ft_layout.nested_env()
|
||||||
|
if not env:
|
||||||
|
sys.exit(print("desktop not running: no live outputs or panels"))
|
||||||
|
outs = json.loads(subprocess.run(["kscreen-doctor", "-j"], capture_output=True, text=True, env=env, timeout=10).stdout or "{}")
|
||||||
|
for o in outs.get("outputs", []):
|
||||||
|
size = o.get("size") or {}
|
||||||
|
print(f"output {o.get('name')}: enabled={o.get('enabled')} priority={o.get('priority')} {size.get('width')}x{size.get('height')}")
|
||||||
|
js = "print(JSON.stringify(panels().map(p => ({id: p.id, screen: p.screen, location: p.location}))))"
|
||||||
|
r = subprocess.run(["qdbus6", "org.kde.plasmashell", "/PlasmaShell", "org.kde.PlasmaShell.evaluateScript", js],
|
||||||
|
capture_output=True, text=True, env=env, timeout=10)
|
||||||
|
print("live panels:", (r.stdout or r.stderr).strip())
|
||||||
|
PY
|
||||||
|
|
||||||
section "Input relay (last 60 lines)"
|
section "Input relay (last 60 lines)"
|
||||||
journalctl --user -u frametop-input-relay -n 60 --no-pager -o short 2>/dev/null
|
journalctl --user -u frametop-input-relay -n 60 --no-pager -o short 2>/dev/null
|
||||||
section "Pointer helper (last 60 lines)"
|
section "Pointer helper (last 60 lines)"
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ PACKAGES = {
|
|||||||
"after a desktop restart; floating a window; no blur behind the taskbar's menus",
|
"after a desktop restart; floating a window; no blur behind the taskbar's menus",
|
||||||
"plasma-workspace": "the taskbar and panels after a desktop restart; no DiscoverNotifier or "
|
"plasma-workspace": "the taskbar and panels after a desktop restart; no DiscoverNotifier or "
|
||||||
"ibus-daemon inside the desktop",
|
"ibus-daemon inside the desktop",
|
||||||
|
"at-spi2-core": "an AT-SPI-aware app appears on the nested desktop's accessibility bus; "
|
||||||
|
"the registry stops and comes back after a desktop restart",
|
||||||
"gamescope": "the headset's volume buttons with nothing focused; typing goes where you last clicked",
|
"gamescope": "the headset's volume buttons with nothing focused; typing goes where you last clicked",
|
||||||
"bluez": "a Bluetooth mouse reconnecting after it sleeps",
|
"bluez": "a Bluetooth mouse reconnecting after it sleeps",
|
||||||
}
|
}
|
||||||
@@ -162,6 +164,14 @@ def check_host():
|
|||||||
("/usr/bin/kwin_wayland_wrapper", "FAIL", "the desktop can't start KWin"),
|
("/usr/bin/kwin_wayland_wrapper", "FAIL", "the desktop can't start KWin"),
|
||||||
("/usr/bin/startplasma-wayland", "FAIL", "the desktop can't start Plasma"),
|
("/usr/bin/startplasma-wayland", "FAIL", "the desktop can't start Plasma"),
|
||||||
("/usr/bin/dbus-run-session", "FAIL", "the desktop can't start its session bus"),
|
("/usr/bin/dbus-run-session", "FAIL", "the desktop can't start its session bus"),
|
||||||
|
("/usr/bin/python3", "warn", "nested accessibility can't run its startup helper"),
|
||||||
|
("/usr/bin/gdbus", "warn", "nested accessibility can't discover or check its bus"),
|
||||||
|
("/usr/lib/at-spi-bus-launcher", "warn", "nested accessibility can't start its bus"),
|
||||||
|
("/usr/lib/at-spi2-registryd", "warn", "nested accessibility has no fallback registry"),
|
||||||
|
("/usr/share/dbus-1/services/org.a11y.Bus.service", "warn",
|
||||||
|
"nested accessibility can't activate its bus"),
|
||||||
|
("/usr/share/dbus-1/accessibility-services/org.a11y.atspi.Registry.service", "warn",
|
||||||
|
"nested accessibility can't activate its registry natively"),
|
||||||
(f"{STEAMVR_BIN}/vrcmd", "FAIL", "the 3D mouse can't find panels"),
|
(f"{STEAMVR_BIN}/vrcmd", "FAIL", "the 3D mouse can't find panels"),
|
||||||
(f"{STEAMVR_BIN}/vrpathreg", "warn", "the pointer driver can't be installed or removed"),
|
(f"{STEAMVR_BIN}/vrpathreg", "warn", "the pointer driver can't be installed or removed"),
|
||||||
("/usr/share/deckard/mesavars.sh", "warn", "the desktop starts without SteamOS's Mesa settings"),
|
("/usr/share/deckard/mesavars.sh", "warn", "the desktop starts without SteamOS's Mesa settings"),
|
||||||
|
|||||||
Executable
+143
@@ -0,0 +1,143 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Bring back a taskbar that Plasma saved against a screen this desktop doesn't have.
|
||||||
|
|
||||||
|
Plasma 6.2.5 ties each panel to a screen number (lastScreen in its containment), and the
|
||||||
|
numbers rank the enabled outputs by priority: 0 is the primary screen. A panel whose
|
||||||
|
number is past the screen count gets no view and stays hidden; Plasma never moves it,
|
||||||
|
even on a later start (sanitizeScreenLayout() only remaps a panel whose number has no
|
||||||
|
desktop, and the Frametop desktop keeps a desktop for every spare output it has seen).
|
||||||
|
So a taskbar saved on a spare output (issue #18), or on a screen that a smaller layout
|
||||||
|
dropped, was lost until the config was deleted.
|
||||||
|
|
||||||
|
The session runs this before Plasma starts, so nothing races Plasma for the file. Each
|
||||||
|
panel numbered at or past the screen count moves to screen 0, with its system tray's
|
||||||
|
containment, and keeps its widgets and settings. A panel is left where it is when screen
|
||||||
|
0 already has a panel on that edge: it comes back by itself if the screens do. The file
|
||||||
|
is backed up once per repair (<file>.ft-bak), and the changes go through kwriteconfig6.
|
||||||
|
|
||||||
|
fix-panels.py [--screens N] [--file APPLETSRC] [--check]
|
||||||
|
--screens the desktop's screen count (default: the configured layout's)
|
||||||
|
--file default: $XDG_CONFIG_HOME/plasma-org.kde.plasma.desktop-appletsrc, with
|
||||||
|
XDG_CONFIG_HOME defaulting to the Frametop desktop's ~/.config/frametop
|
||||||
|
--check change nothing; list the panels, and exit 1 if one is lost
|
||||||
|
"""
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
EDGES = {3: "top", 4: "bottom", 5: "left", 6: "right"} # Plasma::Types::Location
|
||||||
|
SYSTRAY = "org.kde.plasma.private.systemtray"
|
||||||
|
GROUP = re.compile(r"\[([^\]]*)\]")
|
||||||
|
|
||||||
|
|
||||||
|
def parse(text):
|
||||||
|
"""KConfig text -> {(group, subgroup, ...): {key: value}}."""
|
||||||
|
groups, cur = {}, None
|
||||||
|
for line in text.splitlines():
|
||||||
|
line = line.strip()
|
||||||
|
if line.startswith("["):
|
||||||
|
cur = tuple(GROUP.findall(line))
|
||||||
|
groups.setdefault(cur, {})
|
||||||
|
elif cur is not None and "=" in line and not line.startswith("#"):
|
||||||
|
k, v = line.split("=", 1)
|
||||||
|
groups[cur][re.sub(r"\[\$.*\]$", "", k.strip())] = v.strip()
|
||||||
|
return groups
|
||||||
|
|
||||||
|
|
||||||
|
def number(v, default=-1):
|
||||||
|
try:
|
||||||
|
return int(v)
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
return default
|
||||||
|
|
||||||
|
|
||||||
|
def panels(groups):
|
||||||
|
"""The panels, by containment id: location, lastScreen, and the ids of their system
|
||||||
|
trays' own containments (which sit on the same edge and screen as the panel)."""
|
||||||
|
trays, found = {}, {}
|
||||||
|
for g, keys in groups.items():
|
||||||
|
if len(g) == 5 and g[0] == "Containments" and g[2] == "Applets" and g[4] == "Configuration":
|
||||||
|
tray = keys.get("SystrayContainmentId")
|
||||||
|
if tray:
|
||||||
|
trays.setdefault(g[1], []).append(tray)
|
||||||
|
owned = {t for ts in trays.values() for t in ts}
|
||||||
|
for g, keys in groups.items():
|
||||||
|
if len(g) != 2 or g[0] != "Containments" or number(g[1]) <= 0 or g[1] in owned:
|
||||||
|
continue
|
||||||
|
loc = number(keys.get("location"), 0)
|
||||||
|
if loc in EDGES and keys.get("plugin") != SYSTRAY:
|
||||||
|
found[g[1]] = {"location": loc, "screen": number(keys.get("lastScreen")),
|
||||||
|
"plugin": keys.get("plugin", "?"), "trays": trays.get(g[1], [])}
|
||||||
|
return dict(sorted(found.items(), key=lambda kv: number(kv[0])))
|
||||||
|
|
||||||
|
|
||||||
|
def plan(groups, screens):
|
||||||
|
"""(moves, kept): moves are (panel id, from screen, containment ids to put on screen 0);
|
||||||
|
kept are (panel id, from screen, why) for lost panels left alone."""
|
||||||
|
found = panels(groups)
|
||||||
|
taken = {(p["screen"], p["location"]) for p in found.values() if 0 <= p["screen"] < screens}
|
||||||
|
moves, kept = [], []
|
||||||
|
for pid, p in found.items():
|
||||||
|
if p["screen"] < screens:
|
||||||
|
continue # on a screen this desktop has (Plasma puts -1 on the first one itself)
|
||||||
|
if (0, p["location"]) in taken:
|
||||||
|
kept.append((pid, p["screen"], f"the first screen already has a {EDGES[p['location']]} panel"))
|
||||||
|
continue
|
||||||
|
taken.add((0, p["location"]))
|
||||||
|
moves.append((pid, p["screen"], [pid, *p["trays"]]))
|
||||||
|
return moves, kept
|
||||||
|
|
||||||
|
|
||||||
|
def default_screens():
|
||||||
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "layout"))
|
||||||
|
import ft_layout
|
||||||
|
return ft_layout.screen_count()
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv):
|
||||||
|
ap = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
|
||||||
|
ap.add_argument("--screens", type=int)
|
||||||
|
ap.add_argument("--file")
|
||||||
|
ap.add_argument("--check", action="store_true")
|
||||||
|
a = ap.parse_args(argv)
|
||||||
|
config = os.environ.get("XDG_CONFIG_HOME") or os.path.expanduser("~/.config/frametop")
|
||||||
|
path = a.file or os.path.join(config, "plasma-org.kde.plasma.desktop-appletsrc")
|
||||||
|
screens = a.screens if a.screens else default_screens()
|
||||||
|
try:
|
||||||
|
with open(path) as f:
|
||||||
|
groups = parse(f.read())
|
||||||
|
except FileNotFoundError:
|
||||||
|
if a.check:
|
||||||
|
print("no Plasma config yet (Plasma makes the default taskbar)")
|
||||||
|
return 0
|
||||||
|
moves, kept = plan(groups, screens)
|
||||||
|
|
||||||
|
if a.check:
|
||||||
|
found = panels(groups)
|
||||||
|
for pid, p in found.items():
|
||||||
|
lost = " (lost: no such screen)" if p["screen"] >= screens else ""
|
||||||
|
print(f"panel {pid}: screen {p['screen']}, {EDGES[p['location']]}{lost}")
|
||||||
|
if not found:
|
||||||
|
print("no panels")
|
||||||
|
print(f"{screens} screen(s)")
|
||||||
|
return 1 if moves or kept else 0
|
||||||
|
|
||||||
|
if moves:
|
||||||
|
shutil.copy2(path, path + ".ft-bak")
|
||||||
|
for pid, was, ids in moves:
|
||||||
|
for cid in ids:
|
||||||
|
subprocess.run(["kwriteconfig6", "--file", os.path.abspath(path), "--group", "Containments",
|
||||||
|
"--group", cid, "--key", "lastScreen", "0"], check=True)
|
||||||
|
print(f"frametop: panel {pid} was saved on screen {was}, which this desktop doesn't have "
|
||||||
|
f"({screens} screen(s)); moved it to the first screen (backup: {path}.ft-bak)", file=sys.stderr)
|
||||||
|
for pid, was, why in kept:
|
||||||
|
print(f"frametop: panel {pid} is saved on screen {was}, which this desktop doesn't have; "
|
||||||
|
f"left there: {why}", file=sys.stderr)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main(sys.argv[1:]))
|
||||||
@@ -29,7 +29,7 @@ for var in $(compgen -e); do
|
|||||||
case $var in
|
case $var in
|
||||||
LD_LIBRARY_PATH | LD_PRELOAD | STEAM_* | Steam* | SRT_* | PRESSURE_VESSEL_* | MANGOHUD_* | \
|
LD_LIBRARY_PATH | LD_PRELOAD | STEAM_* | Steam* | SRT_* | PRESSURE_VESSEL_* | MANGOHUD_* | \
|
||||||
ENABLE_VK_LAYER_VALVE_steam_overlay_* | STEAMVIDEOTOKEN | QT_IM_MODULE | GTK_IM_MODULE | \
|
ENABLE_VK_LAYER_VALVE_steam_overlay_* | STEAMVIDEOTOKEN | QT_IM_MODULE | GTK_IM_MODULE | \
|
||||||
XMODIFIERS) unset "$var" ;;
|
XMODIFIERS | AT_SPI_BUS_ADDRESS) unset "$var" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -190,6 +190,21 @@ if [ "$remote" = 1 ]; then
|
|||||||
"$here/remote-ctl.sh" start
|
"$here/remote-ctl.sh" start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# AT-SPI: start the registry inside Plasma's autostart, after KWin has published the
|
||||||
|
# nested displays. Starting it before startplasma could bind to the host's X display.
|
||||||
|
# This config belongs only to Frametop; the host desktop's autostart is unchanged.
|
||||||
|
autostart=$XDG_CONFIG_HOME/autostart/frametop-atspi.desktop
|
||||||
|
mkdir -p "$(dirname "$autostart")"
|
||||||
|
cat > "$autostart" <<EOF
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=Frametop accessibility
|
||||||
|
Exec="$here/ft-atspi"
|
||||||
|
X-KDE-autostart-phase=2
|
||||||
|
OnlyShowIn=KDE;
|
||||||
|
NoDisplay=true
|
||||||
|
EOF
|
||||||
|
|
||||||
# ft-floatd (floating windows) runs inside the Plasma session, on its D-Bus: started from
|
# ft-floatd (floating windows) runs inside the Plasma session, on its D-Bus: started from
|
||||||
# the session's autostart, which only this desktop reads (XDG_CONFIG_HOME above).
|
# the session's autostart, which only this desktop reads (XDG_CONFIG_HOME above).
|
||||||
autostart=$XDG_CONFIG_HOME/autostart/frametop-floatd.desktop
|
autostart=$XDG_CONFIG_HOME/autostart/frametop-floatd.desktop
|
||||||
@@ -272,4 +287,9 @@ fi
|
|||||||
# with both, apps would open twice.
|
# with both, apps would open twice.
|
||||||
kwriteconfig6 --file "$XDG_CONFIG_HOME/ksmserverrc" --group General --key loginMode emptySession
|
kwriteconfig6 --file "$XDG_CONFIG_HOME/ksmserverrc" --group General --key loginMode emptySession
|
||||||
|
|
||||||
|
# Plasma keeps a panel on a screen number, and never moves one whose screen this desktop
|
||||||
|
# doesn't have, like a spare output or a screen a smaller layout dropped. Put such a panel
|
||||||
|
# back on the first (primary) screen before Plasma reads the file (session/fix-panels.py).
|
||||||
|
python3 "$here/fix-panels.py" --screens "$screens" || true
|
||||||
|
|
||||||
dbus-run-session startplasma-wayland
|
dbus-run-session startplasma-wayland
|
||||||
Executable
+87
@@ -0,0 +1,87 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
"""Start AT-SPI on this nested desktop's live bus, after KWin has set its displays."""
|
||||||
|
import ast
|
||||||
|
import os
|
||||||
|
import signal
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
DBUS = "org.freedesktop.DBus"
|
||||||
|
DBUS_PATH = "/org/freedesktop/DBus"
|
||||||
|
REGISTRY = "org.a11y.atspi.Registry"
|
||||||
|
|
||||||
|
|
||||||
|
def call(address, destination, path, method, *args):
|
||||||
|
return subprocess.run(
|
||||||
|
["gdbus", "call", "--address", address, "--dest", destination,
|
||||||
|
"--object-path", path, "--method", method, "--timeout", "5", *args],
|
||||||
|
check=True, capture_output=True, text=True, timeout=6).stdout.strip()
|
||||||
|
|
||||||
|
|
||||||
|
def stop(child):
|
||||||
|
if child.poll() is None:
|
||||||
|
child.terminate()
|
||||||
|
try:
|
||||||
|
child.wait(timeout=3)
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
child.kill()
|
||||||
|
child.wait()
|
||||||
|
|
||||||
|
|
||||||
|
def run_registry(address, session):
|
||||||
|
# SteamOS's registryd stays alive after a bus disconnect. Keep only our own
|
||||||
|
# child tied to both private buses; no host PID lookup or broad process kill.
|
||||||
|
registry = subprocess.Popen(["/usr/lib/at-spi2-registryd"])
|
||||||
|
try:
|
||||||
|
while registry.poll() is None:
|
||||||
|
try:
|
||||||
|
call(session, DBUS, DBUS_PATH, DBUS + ".GetId")
|
||||||
|
call(address, DBUS, DBUS_PATH, DBUS + ".GetId")
|
||||||
|
except subprocess.SubprocessError:
|
||||||
|
break # Normal session shutdown or loss of its accessibility bus.
|
||||||
|
# Each check starts two gdbus processes, and SteamVR needs the CPU.
|
||||||
|
time.sleep(5)
|
||||||
|
finally:
|
||||||
|
stop(registry)
|
||||||
|
|
||||||
|
|
||||||
|
def start():
|
||||||
|
session = os.environ.get("DBUS_SESSION_BUS_ADDRESS")
|
||||||
|
runtime = os.environ.get("XDG_RUNTIME_DIR", "")
|
||||||
|
if not session or os.path.basename(runtime) != "frametop":
|
||||||
|
return # Do not autolaunch a bus or touch the host desktop.
|
||||||
|
os.environ.pop("AT_SPI_BUS_ADDRESS", None)
|
||||||
|
reply = call(session, "org.a11y.Bus", "/org/a11y/bus", "org.a11y.Bus.GetAddress")
|
||||||
|
address, = ast.literal_eval(reply)
|
||||||
|
if not isinstance(address, str) or not address.startswith("unix:"):
|
||||||
|
raise ValueError("org.a11y.Bus returned no local accessibility bus")
|
||||||
|
if call(address, DBUS, DBUS_PATH, DBUS + ".NameHasOwner", REGISTRY) == "(true,)":
|
||||||
|
return
|
||||||
|
# Activation otherwise inherits the accessibility daemon's old environment (and
|
||||||
|
# DBUS_SESSION_BUS_ADDRESS is the accessibility bus itself). Pin the live bus.
|
||||||
|
env = {key: os.environ.get(key, "") for key in (
|
||||||
|
"DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "XDG_RUNTIME_DIR",
|
||||||
|
"XDG_CONFIG_HOME", "DBUS_SESSION_BUS_ADDRESS")}
|
||||||
|
env["AT_SPI_BUS_ADDRESS"] = address
|
||||||
|
call(address, DBUS, DBUS_PATH, DBUS + ".UpdateActivationEnvironment", repr(env))
|
||||||
|
try:
|
||||||
|
call(address, DBUS, DBUS_PATH, DBUS + ".StartServiceByName", REGISTRY, "0")
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
# SteamOS's launcher can select dbus-broker because we are in a user unit,
|
||||||
|
# but the private session bus has no systemd activation manager. Reuse its
|
||||||
|
# bus rather than starting another launcher/bus. Never replace an owner.
|
||||||
|
if call(address, DBUS, DBUS_PATH, DBUS + ".NameHasOwner", REGISTRY) == "(true,)":
|
||||||
|
return
|
||||||
|
os.environ["AT_SPI_BUS_ADDRESS"] = address
|
||||||
|
# registryd itself refuses to queue behind an existing registry, including
|
||||||
|
# races with native activation. The watcher cleans up only our own child.
|
||||||
|
run_registry(address, session)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
signal.signal(signal.SIGTERM, lambda signum, frame: sys.exit(0))
|
||||||
|
try:
|
||||||
|
start()
|
||||||
|
except (OSError, ValueError, SyntaxError, subprocess.SubprocessError) as error:
|
||||||
|
print(f"frametop: accessibility unavailable: {error}", file=sys.stderr)
|
||||||
@@ -10,7 +10,7 @@ cg=$(systemctl --user show -p ControlGroup --value "$unit" 2>/dev/null)
|
|||||||
|
|
||||||
# The desktop's own processes stay in the unit and stop with it: the session, KWin,
|
# The desktop's own processes stay in the unit and stop with it: the session, KWin,
|
||||||
# Plasma, and the session services it started (portals, input methods, kded, wallet...).
|
# Plasma, and the session services it started (portals, input methods, kded, wallet...).
|
||||||
own='^(frametop-sessi|dbus-|startplasma|plasma|kwin|Xwayland|ksmserver|krdpserver|Xvnc|xfreerdp|ft-layout|'
|
own='^(frametop-sessi|dbus-|startplasma|plasma|kwin|Xwayland|ksmserver|krdpserver|Xvnc|xfreerdp|ft-layout|ft-atspi|'
|
||||||
own+='kded|kactivitymanage|kaccess|kglobalaccel|kscreen|kwalletd|ksecretd|polkit-kde|org_kde_|baloo|'
|
own+='kded|kactivitymanage|kaccess|kglobalaccel|kscreen|kwalletd|ksecretd|polkit-kde|org_kde_|baloo|'
|
||||||
own+='xembedsniproxy|gmenudbusmenu|DiscoverNotifie|kimpanel|ibus|xdg-|at-spi|dconf-service|fusermount|agent)'
|
own+='xembedsniproxy|gmenudbusmenu|DiscoverNotifie|kimpanel|ibus|xdg-|at-spi|dconf-service|fusermount|agent)'
|
||||||
keep=()
|
keep=()
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,162 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Tests for session/fix-panels.py: issue #18's config (the taskbar saved on spare output 8
|
||||||
|
of a 3-screen desktop), panels that are fine, an edge that's taken, and a real run of
|
||||||
|
kwriteconfig6 on a copy. Nothing here touches the running desktop or its config.
|
||||||
|
|
||||||
|
python3 session/tests/test_fix_panels.py
|
||||||
|
"""
|
||||||
|
import importlib.util
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
HERE = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
SCRIPT = os.path.join(HERE, "..", "fix-panels.py")
|
||||||
|
spec = importlib.util.spec_from_file_location("fix_panels", SCRIPT)
|
||||||
|
fp = importlib.util.module_from_spec(spec)
|
||||||
|
spec.loader.exec_module(fp)
|
||||||
|
|
||||||
|
|
||||||
|
def desktop(cid, screen):
|
||||||
|
return f"""[Containments][{cid}]
|
||||||
|
activityId=7e1d1a3c-0000-4000-8000-000000000000
|
||||||
|
formfactor=0
|
||||||
|
immutability=1
|
||||||
|
lastScreen={screen}
|
||||||
|
location=0
|
||||||
|
plugin=org.kde.plasma.folder
|
||||||
|
wallpaperplugin=org.kde.image
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def panel(cid, screen, location=4, tray=None):
|
||||||
|
text = f"""[Containments][{cid}]
|
||||||
|
activityId=
|
||||||
|
formfactor=2
|
||||||
|
immutability=1
|
||||||
|
lastScreen={screen}
|
||||||
|
location={location}
|
||||||
|
plugin=org.kde.panel
|
||||||
|
wallpaperplugin=org.kde.image
|
||||||
|
|
||||||
|
[Containments][{cid}][Applets][{cid}1]
|
||||||
|
immutability=1
|
||||||
|
plugin=org.kde.plasma.kickoff
|
||||||
|
"""
|
||||||
|
if tray:
|
||||||
|
text += f"""
|
||||||
|
[Containments][{cid}][Applets][{cid}2]
|
||||||
|
immutability=1
|
||||||
|
plugin=org.kde.plasma.systemtray
|
||||||
|
|
||||||
|
[Containments][{cid}][Applets][{cid}2][Configuration]
|
||||||
|
PreloadWeight=90
|
||||||
|
SystrayContainmentId={tray}
|
||||||
|
|
||||||
|
[Containments][{tray}]
|
||||||
|
activityId=
|
||||||
|
formfactor=2
|
||||||
|
immutability=1
|
||||||
|
lastScreen={screen}
|
||||||
|
location={location}
|
||||||
|
plugin=org.kde.plasma.private.systemtray
|
||||||
|
popupHeight=432
|
||||||
|
"""
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
ISSUE_18 = "\n".join([desktop(1, 0), desktop(18, 1), desktop(19, 2)] + [desktop(20 + i, 3 + i) for i in range(8)]
|
||||||
|
+ [panel(10, 8, tray=11), "[ScreenMapping]\nitemsOnDisabledScreens=\n"])
|
||||||
|
|
||||||
|
|
||||||
|
class Plan(unittest.TestCase):
|
||||||
|
def test_issue_18(self):
|
||||||
|
moves, kept = fp.plan(fp.parse(ISSUE_18), 3)
|
||||||
|
self.assertEqual(moves, [("10", 8, ["10", "11"])])
|
||||||
|
self.assertEqual(kept, [])
|
||||||
|
|
||||||
|
def test_panel_on_a_screen_stays(self):
|
||||||
|
for screen in (0, 2, -1):
|
||||||
|
moves, kept = fp.plan(fp.parse(desktop(1, 0) + panel(2, screen, tray=8)), 3)
|
||||||
|
self.assertEqual((moves, kept), ([], []), screen)
|
||||||
|
|
||||||
|
def test_tray_is_not_a_panel(self):
|
||||||
|
found = fp.panels(fp.parse(panel(2, 0, tray=8)))
|
||||||
|
self.assertEqual(list(found), ["2"])
|
||||||
|
self.assertEqual(found["2"]["trays"], ["8"])
|
||||||
|
|
||||||
|
def test_desktops_never_move(self):
|
||||||
|
moves, _ = fp.plan(fp.parse(ISSUE_18), 1)
|
||||||
|
self.assertEqual([m[0] for m in moves], ["10"])
|
||||||
|
|
||||||
|
def test_edge_taken_on_first_screen(self):
|
||||||
|
text = panel(2, 0, tray=8) + panel(10, 8, tray=11)
|
||||||
|
moves, kept = fp.plan(fp.parse(text), 3)
|
||||||
|
self.assertEqual(moves, [])
|
||||||
|
self.assertEqual([k[:2] for k in kept], [("10", 8)])
|
||||||
|
|
||||||
|
def test_other_edge_is_free(self):
|
||||||
|
moves, kept = fp.plan(fp.parse(panel(2, 0) + panel(10, 4, location=3)), 3)
|
||||||
|
self.assertEqual(moves, [("10", 4, ["10"])])
|
||||||
|
self.assertEqual(kept, [])
|
||||||
|
|
||||||
|
def test_two_lost_on_one_edge(self):
|
||||||
|
moves, kept = fp.plan(fp.parse(panel(10, 5) + panel(12, 8)), 3)
|
||||||
|
self.assertEqual([m[0] for m in moves], ["10"])
|
||||||
|
self.assertEqual([k[0] for k in kept], ["12"])
|
||||||
|
|
||||||
|
def test_screen_count_went_down(self):
|
||||||
|
moves, _ = fp.plan(fp.parse(panel(2, 1, location=3)), 1)
|
||||||
|
self.assertEqual(moves, [("2", 1, ["2"])])
|
||||||
|
|
||||||
|
|
||||||
|
class Run(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.dir = tempfile.TemporaryDirectory()
|
||||||
|
self.path = os.path.join(self.dir.name, "plasma-org.kde.plasma.desktop-appletsrc")
|
||||||
|
with open(self.path, "w") as f:
|
||||||
|
f.write(ISSUE_18)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.dir.cleanup()
|
||||||
|
|
||||||
|
def run_script(self, *args):
|
||||||
|
return subprocess.run([sys.executable, SCRIPT, "--file", self.path, "--screens", "3", *args],
|
||||||
|
capture_output=True, text=True)
|
||||||
|
|
||||||
|
def test_check_reports_and_changes_nothing(self):
|
||||||
|
r = self.run_script("--check")
|
||||||
|
self.assertEqual(r.returncode, 1)
|
||||||
|
self.assertIn("panel 10: screen 8, bottom (lost", r.stdout)
|
||||||
|
with open(self.path) as f:
|
||||||
|
self.assertEqual(f.read(), ISSUE_18)
|
||||||
|
|
||||||
|
def test_repair(self):
|
||||||
|
r = self.run_script()
|
||||||
|
self.assertEqual(r.returncode, 0, r.stderr)
|
||||||
|
self.assertIn("moved it to the first screen", r.stderr)
|
||||||
|
with open(self.path) as f:
|
||||||
|
groups = fp.parse(f.read())
|
||||||
|
self.assertEqual(groups[("Containments", "10")]["lastScreen"], "0")
|
||||||
|
self.assertEqual(groups[("Containments", "11")]["lastScreen"], "0")
|
||||||
|
self.assertEqual(groups[("Containments", "10", "Applets", "101")]["plugin"], "org.kde.plasma.kickoff")
|
||||||
|
self.assertEqual(groups[("Containments", "25")]["lastScreen"], "8") # a spare's desktop
|
||||||
|
with open(self.path + ".ft-bak") as f:
|
||||||
|
self.assertEqual(f.read(), ISSUE_18)
|
||||||
|
# A second run finds nothing to do and leaves the backup alone.
|
||||||
|
os.remove(self.path + ".ft-bak")
|
||||||
|
r = self.run_script()
|
||||||
|
self.assertEqual((r.returncode, r.stderr), (0, ""))
|
||||||
|
self.assertFalse(os.path.exists(self.path + ".ft-bak"))
|
||||||
|
self.assertEqual(self.run_script("--check").returncode, 0)
|
||||||
|
|
||||||
|
def test_no_config_yet(self):
|
||||||
|
os.remove(self.path)
|
||||||
|
self.assertEqual(self.run_script().returncode, 0)
|
||||||
|
self.assertEqual(self.run_script("--check").returncode, 0)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
Reference in new issue
Block a user