Repository navigation
feat(linux): record on Hyprland with cursor positions, auto-zoom and GPU import #1406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shilai-li
wants to merge
29
commits into
getopenscreen:main
Choose a base branch
from
shilai-li:feat/linux-hyprland
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,837
−337
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
3d22bf4
perf(linux): read write-combined dmabufs with streaming loads
shilai-li 908902f
fix(linux): stamp frames by arrival slot, not encode time
shilai-li e11b16c
perf(linux): thread colour conversion via sws_scale_frame
shilai-li 285ef54
fix(linux): pass the real dmabuf size to the VA-API import
shilai-li eb19300
fix(linux): fall back to the embedded cursor when the portal lacks ME…
shilai-li fd6b5a5
feat(linux): cursor positions and click zooms on Hyprland
shilai-li f2ce222
fix(linux): poll Hyprland's pointer at a steady rate
shilai-li fd12234
fix(linux): size the HUD window to the bar alone
shilai-li c215ad8
feat(linux): ship a pointer-only udev rule for click capture
shilai-li 2ae896c
perf(linux): import LINEAR dmabufs on the GPU when VA-API can
shilai-li b12c261
perf(linux): read the dmabuf size without a dup per frame
shilai-li c4c97ff
fix(linux): find the granted Hyprland monitor by its size
shilai-li 690e9c6
feat(linux): auto-zoom system-cursor takes on Hyprland
shilai-li 96bb0f8
fix(linux): keep audio and video aligned when the first frame waits f…
shilai-li 805024e
fix(linux): harden the Hyprland pointer path
shilai-li 72afec0
fix: keep painted-in takes painted-in
shilai-li 0c40fe8
fix(linux): HUD panel review fixes
shilai-li ad50829
test(linux): tighten the arrival-placement test bounds
shilai-li 8a5275f
fix(linux): translate the panel's toast dismiss label live
shilai-li 54cb530
fix(linux): restart a take without raising the portal picker again
shilai-li bb122d2
fix(linux): keep the HUD bar at the bottom and above fullscreen on Hy…
shilai-li 452aa9f
fix(linux): release the camera when the device settings close
shilai-li e368758
fix(linux): open the HUD panel next to the bar on Hyprland
shilai-li 3516ed3
fix(linux): ask for a persistent portal grant only on Hyprland
shilai-li 311eaa8
fix(linux): draw the HUD square inside Hyprland's own frame
shilai-li 1f05473
fix(linux): place the HUD bar before it maps on Hyprland
shilai-li e63be7e
fix(linux): address CodeRabbit's review of the Hyprland HUD changes
shilai-li 841fcfc
fix(linux): draw the countdown without Hyprland's frame and blur
shilai-li 5bd8a66
fix(linux): settle the two open CodeRabbit threads
shilai-li File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # OpenScreen click zooms: let the logged-in user read mice and touchpads, never keyboards. | ||
| # | ||
| # The Linux capture helper reads left-button presses from /dev/input/event* (Wayland has no | ||
| # portal for mouse buttons; see electron/native/pipewire-capture/src/input.rs). Those nodes | ||
| # are root:input. The `input` group would open every input device, keyboards included, to | ||
| # every program the user runs. `uaccess` instead has systemd-logind put an ACL for the user | ||
| # of the active local session on the matched nodes, and on nothing else. A node that reports | ||
| # any keyboard key (ID_INPUT_KEY) is never matched, even when it is also a mouse. | ||
| # | ||
| # The 70- prefix is load-bearing: the tag has to be set before systemd's 73-seat-late.rules, | ||
| # which is where uaccess is applied. The deb, rpm and pacman packages install this file to | ||
| # /usr/lib/udev/rules.d/, and the NixOS module adds it to services.udev.packages. For the | ||
| # AppImage, copy it to /etc/udev/rules.d/ by hand: website/docs/installation.md, | ||
| # "Mouse clicks on Wayland". | ||
| SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT_KEY}!="1", ENV{ID_INPUT_MOUSE}=="1", TAG+="uaccess" | ||
| SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT_KEY}!="1", ENV{ID_INPUT_TOUCHPAD}=="1", TAG+="uaccess" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| #!/bin/bash | ||
|
|
||
| if type update-alternatives >/dev/null 2>&1; then | ||
| # Remove previous link if it doesn't use update-alternatives | ||
| if [ -L '/usr/bin/${executable}' -a -e '/usr/bin/${executable}' -a "`readlink '/usr/bin/${executable}'`" != '/etc/alternatives/${executable}' ]; then | ||
| rm -f '/usr/bin/${executable}' | ||
| fi | ||
| update-alternatives --install '/usr/bin/${executable}' '${executable}' '/opt/${sanitizedProductName}/${executable}' 100 || ln -sf '/opt/${sanitizedProductName}/${executable}' '/usr/bin/${executable}' | ||
| else | ||
| ln -sf '/opt/${sanitizedProductName}/${executable}' '/usr/bin/${executable}' | ||
| fi | ||
|
|
||
| # Check if user namespaces are supported by the kernel and working with a quick test: | ||
| if ! { [[ -L /proc/self/ns/user ]] && unshare --user true; }; then | ||
| # Use SUID chrome-sandbox only on systems without user namespaces: | ||
| chmod 4755 '/opt/${sanitizedProductName}/chrome-sandbox' || true | ||
| else | ||
| chmod 0755 '/opt/${sanitizedProductName}/chrome-sandbox' || true | ||
| fi | ||
|
|
||
| if hash update-mime-database 2>/dev/null; then | ||
| update-mime-database /usr/share/mime || true | ||
| fi | ||
|
|
||
| if hash update-desktop-database 2>/dev/null; then | ||
| update-desktop-database /usr/share/applications || true | ||
| fi | ||
|
|
||
| # Install apparmor profile. (Ubuntu 24+) | ||
| # First check if the version of AppArmor running on the device supports our profile. | ||
| # This is in order to keep backwards compatibility with Ubuntu 22.04 which does not support abi/4.0. | ||
| # In that case, we just skip installing the profile since the app runs fine without it on 22.04. | ||
| # | ||
| # Those apparmor_parser flags are akin to performing a dry run of loading a profile. | ||
| # https://wiki.debian.org/AppArmor/HowToUse#Dumping_profiles | ||
| # | ||
| # Unfortunately, at the moment AppArmor doesn't have a good story for backwards compatibility. | ||
| # https://askubuntu.com/questions/1517272/writing-a-backwards-compatible-apparmor-profile | ||
| if apparmor_status --enabled > /dev/null 2>&1; then | ||
| APPARMOR_PROFILE_SOURCE='/opt/${sanitizedProductName}/resources/apparmor-profile' | ||
| APPARMOR_PROFILE_TARGET='/etc/apparmor.d/${executable}' | ||
| if apparmor_parser --skip-kernel-load --debug "$APPARMOR_PROFILE_SOURCE" > /dev/null 2>&1; then | ||
| cp -f "$APPARMOR_PROFILE_SOURCE" "$APPARMOR_PROFILE_TARGET" | ||
|
|
||
| # Updating the current AppArmor profile is not possible and probably not meaningful in a chroot'ed environment. | ||
| # Use cases are for example environments where images for clients are maintained. | ||
| # There, AppArmor might correctly be installed, but live updating makes no sense. | ||
| if ! { [ -x '/usr/bin/ischroot' ] && /usr/bin/ischroot; } && hash apparmor_parser 2>/dev/null; then | ||
| # Extra flags taken from dh_apparmor: | ||
| # > By using '-W -T' we ensure that any abstraction updates are also pulled in. | ||
| # https://wiki.debian.org/AppArmor/Contribute/FirstTimeProfileImport | ||
| apparmor_parser --replace --write-cache --skip-read-cache "$APPARMOR_PROFILE_TARGET" | ||
| fi | ||
| else | ||
| echo "Skipping the installation of the AppArmor profile as this version of AppArmor does not seem to support the bundled profile" | ||
| fi | ||
| fi | ||
|
|
||
| # --------------------------------------------------------------------------------------- | ||
| # OpenScreen. Everything above is app-builder-lib's templates/linux/after-install.tpl, | ||
| # verbatim: naming a script in electron-builder.json5 REPLACES that template instead of | ||
| # extending it, and it is what creates /usr/bin/openscreen and sets chrome-sandbox's mode. | ||
| # scripts/linux-package-scripts.test.mjs fails when the two drift apart. | ||
| # | ||
| # The package ships /usr/lib/udev/rules.d/70-openscreen-pointer.rules (build/linux/), which | ||
| # gives the logged-in user read access to mice and touchpads for click capture. udev only | ||
| # applies a rule to an event, so a mouse that is already plugged in would wait for a replug | ||
| # or a reboot; reloading and replaying a change event on the input devices applies it now. | ||
| # | ||
| # Skipped where no udev daemon is listening (a container, a chroot, an image build): there | ||
| # is nothing to reload, and the rule applies on the first boot anyway. Never fatal. | ||
| if command -v udevadm >/dev/null 2>&1 && [ -S /run/udev/control ] \ | ||
| && ! { [ -x '/usr/bin/ischroot' ] && /usr/bin/ischroot; }; then | ||
| udevadm control --reload-rules || true | ||
| udevadm trigger --subsystem-match=input --action=change || true | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Delete the link to the binary | ||
| # update-alternatives --remove <name> <path>: 'path' must be the registered alternative binary, | ||
| # not the generic symlink — see https://man7.org/linux/man-pages/man1/update-alternatives.1.html | ||
| if type update-alternatives >/dev/null 2>&1; then | ||
| update-alternatives --remove '${executable}' '/opt/${sanitizedProductName}/${executable}' | ||
| else | ||
| rm -f '/usr/bin/${executable}' | ||
| fi | ||
|
|
||
| APPARMOR_PROFILE_DEST='/etc/apparmor.d/${executable}' | ||
|
|
||
| # Remove and unload apparmor profile. | ||
| if [ -f "$APPARMOR_PROFILE_DEST" ]; then | ||
| # Unload the profile from the running kernel before deleting the file so the | ||
| # policy is not left enforced until the next reboot. Mirror the chroot guard | ||
| # used in the after-install script — live AppArmor operations are not | ||
| # meaningful inside a chroot. | ||
| # https://wiki.debian.org/AppArmor/HowToUse | ||
| if apparmor_status --enabled > /dev/null 2>&1; then | ||
| if ! { [ -x '/usr/bin/ischroot' ] && /usr/bin/ischroot; } && hash apparmor_parser 2>/dev/null; then | ||
| apparmor_parser --remove "$APPARMOR_PROFILE_DEST" || true | ||
| fi | ||
| fi | ||
| rm -f "$APPARMOR_PROFILE_DEST" | ||
| fi | ||
|
|
||
| # --------------------------------------------------------------------------------------- | ||
| # OpenScreen. Everything above is app-builder-lib's templates/linux/after-remove.tpl, | ||
| # verbatim: naming a script in electron-builder.json5 REPLACES that template instead of | ||
| # extending it. scripts/linux-package-scripts.test.mjs fails when the two drift apart. | ||
| # | ||
| # The package manager has already deleted 70-openscreen-pointer.rules by now. Reload so | ||
| # udev stops tagging pointer devices for uaccess, and replay a change event so the current | ||
| # devices are re-evaluated without it. An ACL logind already placed on a node can outlive | ||
| # this until the device is replugged or the machine reboots: udev has no event that | ||
| # withdraws one. | ||
| # | ||
| # This also runs on upgrade (deb postrm, rpm %postun), when the new package's copy of the | ||
| # rule is in place. Reloading then is harmless. Same guard as after-install. | ||
| if command -v udevadm >/dev/null 2>&1 && [ -S /run/udev/control ] \ | ||
| && ! { [ -x '/usr/bin/ischroot' ] && /usr/bin/ischroot; }; then | ||
| udevadm control --reload-rules || true | ||
| udevadm trigger --subsystem-match=input --action=change || true | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.