Compare commits

..

1 Commits

Author SHA1 Message Date
wheaney 8b3e02a93f Pull in driver setup script failure improvement 2023-12-15 21:25:21 -08:00
215 changed files with 121 additions and 29410 deletions

View File

@ -1,311 +0,0 @@
name: Create Release
on:
push:
branches:
- main
paths:
- 'VERSION'
jobs:
check-version-change:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.get-version.outputs.version }}
should-release: ${{ steps.check-tag.outputs.should-release }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from VERSION file
id: get-version
run: |
VERSION=$(cat VERSION)
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Version: ${VERSION}"
- name: Check if tag exists
id: check-tag
run: |
VERSION="${{ steps.get-version.outputs.version }}"
git fetch --tags
if git rev-parse "v${VERSION}" >/dev/null 2>&1; then
echo "Tag v${VERSION} already exists, skipping release"
echo "should-release=false" >> "$GITHUB_OUTPUT"
else
echo "Tag v${VERSION} does not exist, proceeding with release"
echo "should-release=true" >> "$GITHUB_OUTPUT"
fi
build-libs:
needs: check-version-change
if: needs.check-version-change.outputs.should-release == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build library packages
run: |
bin/package_libs
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts-libs
path: out/*.tar.gz
build-gnome-x86_64:
needs: check-version-change
if: needs.check-version-change.outputs.should-release == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install build dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y \
gnome-shell-extension-prefs \
meson \
ninja-build \
librsvg2-bin \
libglib2.0-dev \
gettext \
wget \
desktop-file-utils \
appstream
- name: Build Breezy GNOME (x86_64)
run: |
ARCH=x86_64 bin/package_gnome
env:
UA_API_SECRET: ${{ secrets.UA_API_SECRET }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts-gnome-x86_64
path: out/*.tar.gz
build-gnome-aarch64:
needs: check-version-change
if: needs.check-version-change.outputs.should-release == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install build dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y \
gnome-shell-extension-prefs \
meson \
ninja-build \
librsvg2-bin \
libglib2.0-dev \
gettext \
wget \
desktop-file-utils \
appstream
- name: Build Breezy GNOME (aarch64)
run: |
ARCH=aarch64 bin/package_gnome
env:
UA_API_SECRET: ${{ secrets.UA_API_SECRET }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts-gnome-aarch64
path: out/*.tar.gz
build-kwin-steamos-3_7:
needs: check-version-change
if: needs.check-version-change.outputs.should-release == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Breezy KWin (steamos-3.7)
run: |
STEAMOS=3.7 bin/package_kwin
env:
UA_API_SECRET: ${{ secrets.UA_API_SECRET }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts-kwin-steamos-3.7
path: out/*.tar.gz
build-kwin-steamos-3_8:
needs: check-version-change
if: needs.check-version-change.outputs.should-release == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Breezy KWin (steamos-3.8)
run: |
STEAMOS=3.8 bin/package_kwin
env:
UA_API_SECRET: ${{ secrets.UA_API_SECRET }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts-kwin-steamos-3.8
path: out/*.tar.gz
build-kwin-steamos-3_9:
needs: check-version-change
if: needs.check-version-change.outputs.should-release == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Breezy KWin (steamos-3.9)
run: |
STEAMOS=3.9 bin/package_kwin
env:
UA_API_SECRET: ${{ secrets.UA_API_SECRET }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts-kwin-steamos-3.9
path: out/*.tar.gz
build-vulkan-x86_64:
needs: check-version-change
if: needs.check-version-change.outputs.should-release == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Breezy Vulkan (x86_64)
run: |
ARCH=x86_64 bin/package_vulkan
env:
UA_API_SECRET: ${{ secrets.UA_API_SECRET }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts-vulkan-x86_64
path: out/*.tar.gz
create-release:
needs:
- check-version-change
- build-libs
- build-gnome-x86_64
- build-gnome-aarch64
- build-kwin-steamos-3_7
- build-kwin-steamos-3_8
- build-kwin-steamos-3_9
- build-vulkan-x86_64
if: needs.check-version-change.outputs.should-release == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: release-artifacts-*
path: artifacts
merge-multiple: true
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ needs.check-version-change.outputs.version }}"
# Verify setup scripts exist
for script in bin/breezy_gnome_setup bin/breezy_kwin_setup bin/breezy_vulkan_setup; do
if [ ! -f "$script" ]; then
echo "Error: $script not found"
exit 1
fi
done
# Create a tag
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${VERSION}" -m "Release v${VERSION}"
git push origin "v${VERSION}"
# Create release with artifacts
gh release create "v${VERSION}" \
--title "Release v${VERSION}" \
--generate-notes \
artifacts/* \
bin/breezy_gnome_setup \
bin/breezy_kwin_setup \
bin/breezy_vulkan_setup

13
.gitignore vendored
View File

@ -1,12 +1 @@
build/
__pycache__
*.zip
gschemas.compiled
out/
*.po~
kwin/src/xrdriveripc/xrdriveripc.py
kwin/VERSION
kwin/build-test/
kwin/src/qml/calibrating.png
kwin/src/qml/custom_banner.png
kwin/src/kcm/com.xronlinux.BreezyDesktop.svg
/vulkan/build/

18
.gitmodules vendored
View File

@ -1,13 +1,11 @@
[submodule "vulkan/modules/vkBasalt"]
path = vulkan/modules/vkBasalt
url = https://github.com/wheaney/vkBasalt.git
url = git@github.com:wheaney/vkBasalt.git
branch = runtime_uniforms
[submodule "modules/XRLinuxDriver"]
path = modules/XRLinuxDriver
url = https://github.com/wheaney/XRLinuxDriver.git
[submodule "modules/sombrero"]
path = modules/sombrero
url = https://github.com/wheaney/sombrero.git
[submodule "ui/modules/PyXRLinuxDriverIPC"]
path = ui/modules/PyXRLinuxDriverIPC
url = https://github.com/wheaney/PyXRLinuxDriverIPC.git
[submodule "vulkan/modules/sombrero"]
path = vulkan/modules/sombrero
url = git@github.com:wheaney/sombrero.git
[submodule "modules/xrealAirLinuxDriver"]
path = modules/xrealAirLinuxDriver
url = git@github.com:wheaney/xrealAirLinuxDriver.git
branch = failure_handling

223
README.md
View File

@ -4,150 +4,11 @@
[![Chat](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/azSBTXNXMt)
![Breezy KDE screenshot](assets/breezy-kde.png)
## What is this?
This repo contains a collection of tools to enable virtual desktop environments for gaming and productivity on Linux using [supported XR glasses](https://github.com/wheaney/XRLinuxDriver#supported-devices).
This repo will eventually contain a collection of tools to enable virtual desktop environments for gaming and productivity on Linux using XREAL Air glasses.
There are two installations available. **Note: Don't manually install either of these if you're running the Decky plugin on the same machine, as they invalidate each other's installations. This is only temporary.**
* [Breezy Desktop](#breezy-desktop) for KDE Plasma or GNOME desktop environments on Linux.
* [Breezy Vulkan](#breezy-vulkan) primarily for gaming but would work with pretty much any application that uses Vulkan rendering.
## Breezy Desktop
Breezy Desktop is a virtual workspace solution for Linux desktops that use the KDE Plasma 6 or GNOME desktop environments (versions 42 through 49). It supports launching multiple virtual monitors alongside multiple physical monitors.
For the best performance, ensure you have the latest graphics drivers installed for your distro.
### KDE Plasma Setup
Breezy Desktop is only compatible with KDE Plasma 6.
**IMPORTANT** - Please read carefully through this list before you get started
* **Make sure your glasses are in the [supported devices list](https://github.com/wheaney/XRLinuxDriver#supported-devices)** and are on the latest firmware.
* **If you're on SteamOS**, use the [bash setup instructions](#kde-plasma-bash-setup).
* **If you're installing on an immutable distro BESIDES SteamOS**, you'll need to follow the [Distrobox setup](https://github.com/wheaney/breezy-desktop/wiki/Breezy-KDE-Distrobox-setup).
* **If this is the first time you're using your glasses with KDE**, you'll be presented with some options around how to extend your desktop that aren't very clear. Choose the "No action" option to leave the glasses' display independent.
* **If you're running KDE on `X11`**, you won't be able to launch virtual displays. If you're not on SteamOS, look for Wayland options on the login screen.
* **Steam Deck users** note the extra step in the setup instructions for switching to `Wayland` if you want virtual display features.
* **If you're using XREAL Ones** or other glasses that provide built-in 3DoF/stabilization/anchoring features (e.g. VITURE Beast), you must disable ALL such features first, using the menu on the glasses.
* **For the best experience**
* To prevent a broken taskbar: in `Panel Settings`, set `Visibility` to `always-visible`.
* To prevent a magnified cursor from showing in the wrong place: in `System Settings` / `Accessibility`, disable the `Shake Cursor` effect.
#### KDE Plasma Bash Setup
**Note: an [AUR installation](#kde-plasma-arch-linux-setup) is also available for non-SteamOS Arch users**
To setup Breezy on KDE Plasma using `bash`, with your glasses unplugged:
1. Download the [Breezy KWin setup script](https://github.com/wheaney/breezy-desktop/releases/latest/download/breezy_kwin_setup)
2. Set the execute flag: `chmod +x ~/Downloads/breezy_kwin_setup`
3. Run the setup script: `~/Downloads/breezy_kwin_setup`
4. If you're on SteamOS and want to use virtual displays, use the `Enable Breezy Wayland` desktop script
* **IMPORTANT** - this will prevent you from accessing Game Mode again, until you undo it by running the `Disable Breezy Wayland` desktop script
5. Log out and back in.
#### KDE Plasma Arch Linux setup
Breezy KWin is in AUR. To install, run these commands from a terminal with your glasses unplugged:
1. If you've previously installed Breezy KWin using the setup script, you must uninstall it first with `breezy_kwin_uninstall`
2. `yay -S breezy-desktop-kwin-git`
3. `systemctl --user enable --now xr-driver.service`
4. Log out and back in, then proceed to [usage](#breezy-kwin-usage).
#### Breezy KWin Usage
After setup, you'll have an application called `Breezy Desktop` installed. Launch that and follow any instructions. You can also configure keyboard shortcuts for the most common toggle actions. The Breezy Desktop app doesn't have to be running to use the virtual desktop or the keyboard shortcuts once you've configured everything to your liking.
### GNOME Setup
Breezy Desktop has best compatibility with GNOME versions 45 through 49.
**IMPORTANT** - Please read carefully through this list before you get started
* **Make sure your glasses are in the [supported devices list](https://github.com/wheaney/XRLinuxDriver#supported-devices)** and are on the latest firmware.
* **If this is the first time you're using your glasses with GNOME**, make sure your glasses are extending your workspace and not just mirroring your primary monitor by opening up the `Displays` settings dialog and choosing the `Join` option for multiple displays.
* **If you're running `GNOME on Xorg`**, you won't be able to launch virtual displays unless you switch to `Wayland`.
* **If you're using XREAL Ones** or other glasses that provide built-in 3DoF/stabilization/anchoring features (e.g. VITURE Beast), you must disable ALL such features first, using the menu on the glasses.
#### GNOME Bash Setup
**Note: an [AUR installation](#gnome-arch-linux-setup) is also available for Arch users**
To setup Breezy on GNOME using `bash`, with your glasses unplugged:
1. Download the Breezy GNOME [setup script](https://github.com/wheaney/breezy-desktop/releases/latest/download/breezy_gnome_setup) and set the execute flag (e.g. from the terminal: `chmod +x ~/Downloads/breezy_gnome_setup`)
2. Run the setup script: `~/Downloads/breezy_gnome_setup`
3. Log out and back in, then proceed to [usage](#breezy-gnome-usage).
#### GNOME Arch Linux setup
Breezy GNOME is in AUR. To install, run these commands from a terminal with your glasses unplugged:
1. If you've previously installed Breezy GNOME using the setup script, you must uninstall it first with `breezy_gnome_uninstall`
2. `yay -S breezy-desktop-gnome-git`
3. `systemctl --user enable --now xr-driver.service`
4. Log out and back in, then proceed to [usage](#breezy-gnome-usage).
#### Breezy GNOME Usage
After setup, you'll have an application called `Breezy Desktop` installed. Launch that and follow any instructions. You will need to log out and back in at least once to get the GNOME extension working. You can also configure keyboard shortcuts for the most common toggle actions. The Breezy Desktop app doesn't have to be running to use the virtual desktop or the keyboard shortcuts once you've configured everything to your liking.
For a double-wide screen, enable "widescreen mode" using the toggle in the Breezy Desktop application. **Note: this can be significantly more resource intensive than non-widescreen, you may notice performance dips on older hardware.**
### Breezy Desktop Pricing
Breezy Desktop for GNOME and KDE comes with 2 free trial months. Trial access is granted automatically after setup (no token entry required), and you only need to be online once after setup so your device can activate/refresh access.
After the trial period ends, you must have an active Productivity license (Basic or Pro) to keep Productivity features enabled.
Productivity licenses apply to **Breezy Desktop (GNOME/KDE)**. **Breezy Vulkan** uses a separate Supporter Tier (see below).
Paid plans are currently only available via [Ko-fi](https://ko-fi.com/wheaney).
#### Productivity Basic
The Basic plan includes everything needed for multi-screen productivity using only device orientation (3DoF). For device position (6DoF) — e.g. for the VITURE Luma Ultra glasses or supplementing with OpenTrack+NeuralNet — see the Productivity Pro plan.
| Payment period | Price | Upgrade window \* |
| -------------- | ------------------ | ------------------------------------- |
| Yearly | $10 USD, recurring | Within 90 days to upgrade to lifetime |
| Lifetime | $25 USD, one-time | — |
\* If you pay for a plan and decide to upgrade to a longer-term plan, you may pay the difference within this window.
#### Productivity Pro
The Pro plan provides all the same multi-screen productivity features as Basic, plus device position (6DoF) allowing you to lean in and move more naturally about the displays.
| Payment period | Price | Upgrade window \* |
| -------------- | ------------------ | ------------------------------------- |
| Monthly | $2 USD, recurring | Within 7 days to upgrade to yearly |
| Yearly | $20 USD, recurring | Within 90 days to upgrade to lifetime |
| Lifetime | $50 USD, one-time | — |
\* If you pay for a plan and decide to upgrade to a longer-term plan, you may pay the difference within this window.
For recurring plans (monthly/yearly), renewals are processed automatically during the renewal window (7 days prior to expiration). Your device does not need to stay online during normal use, but it must go online at least once to refresh your license. If you remain offline past your expiration time, features will pause until the next time you go online and refresh.
#### Free Productivity Basic
To make Breezy widely accessible, Productivity Basic is currently free of charge for qualified individuals using it for non-commercial purposes. Eligible groups include:
* Students
* Public school educators
* Active duty service members and veterans of the U.S. Armed Forces
* Individuals experiencing financial hardship or special circumstances that make electronic payments prohibitive
* Individuals affected by active war zones or humanitarian crises (e.g. Ukrainian citizens)
If you believe you qualify, please email wayne@xronlinux.com. You may be asked to provide documentation to verify your eligibility.
#### Unlocking a Productivity License
After your trial ends, purchase (or being granted free eligibility) will result in an email with a verification token. Once you receive that, enter it in the `License Details` view of the `Breezy Desktop` application, available from the menu in the top window bar.
If you don't receive a token, you can request one in the `License Details` view by entering your email address.
As of now, only a Vulkan implementation is available, primarily for gaming but could theoretically be used for anything that uses Vulkan rendering.
## Breezy Vulkan
@ -155,66 +16,45 @@ If you don't receive a token, you can request one in the `License Details` view
#### Steam Deck via Decky Loader
For Steam Deck users, the driver is now available via the [Decky plugin loader](https://github.com/SteamDeckHomebrew/decky-loader). Just search "xr" in the Decky store to install and use without leaving Gaming Mode. You can now enable or disable the driver and manage other driver settings via the Decky sidebar menu.
For Steam Deck users, the driver is now available via the [Decky plugin loader](https://github.com/SteamDeckHomebrew/decky-loader). Just search "xreal" in the Decky store to install and use without leaving Gaming Mode. You can now enable or disable the driver and manage other driver settings via the Decky sidebar menu.
You may still opt to do a manual installation using the instructions below if you enter Desktop Mode.
#### Manual installation
1. Download the [setup script](https://github.com/wheaney/breezy-desktop/releases/latest/download/breezy_vulkan_setup) and set the execute flag (e.g. from the terminal: `chmod +x ~/Downloads/breezy_vulkan_setup`)
1. [Download the setup script](https://github.com/wheaney/breezy-desktop/releases/latest/download/breezy_vulkan_setup) and set the execute flag (e.g. from the terminal: `chmod +x ~/Downloads/breezy_vulkan_setup`)
2. Run the setup script as root (e.g. `sudo ~/Downloads/breezy_vulkan_setup`)
3. If you're not on Steam Deck, you'll need to set the `ENABLE_VKBASALT` environment variable to `1`. You'll either need to set this globally to enable it for all games, or set it as a launch option for individual games (e.g. in Steam's Launch Options field `ENABLE_VKBASALT=1 %command%`).
### Supported Devices
See [XRLinuxDriver's supported devices](https://github.com/wheaney/XRLinuxDriver#supported-devices).
### Usage
Once installed, you'll want to make sure you've enabled the driver (`xr_driver_cli -e`) and then you can go into whichever output mode you'd like using (`xr_driver_cli -m`) where `-m` is for mouse mode, `-j` for joystick, `-vd` for virtual display, and `-sv` for sideview; note that these two commands can't be combined, they have to be done separately. From there, you should be able to launch any Vulkan game, plug in your glasses (at any point, not just after launching), and see a floating virtual display or a sideview screen (depending on which mode you've chosen).
Once installed, you'll want to make sure you've enabled the driver (`~/bin/xreal_driver_config -e`) and you'll probably want to disable mouse/joystick output (`~/bin/xreal_driver_config -eo`); note that these two commands can't be combined, they have to be done separately. From there, you should be able to launch any Vulkan game, plug in your glasses (at any point, not just after launching), and see a floating screen.
There's a wait period of 15 seconds after plugging in XREAL glasses where the screen will stay static to allow for the glasses to calibrate. Once ready, the screen will anchor to the space where you are looking.
### Configurations
To see all the configuration options available to you, type `xr_driver_cli` with no parameters to get the usage statement. There are some things you can't trigger from the script, like re-centering the virtual display or entering SBS mode; you can achieve these things through multi-tap or through the physical buttons on the glasses, respectively.
There's a wait period of 15 seconds after plugging in the glasses where the screen will stay static to allow for the glasses to calibrate. Once ready, the screen will anchor to the space where you are looking.
#### Multi-tap to re-center or re-calibrate
I've implemented an experimental multi-tap detection feature for screen **re-centering (2 taps)** and **re-calibrating the device (3 taps)**. To perform a multi-tap, you'll want to give decent taps on the top of the glasses. I tend to do this on the corner, right on top of the hinge. It should be a firm, sharp tap, and wait just a split second to do the second tap, as it needs to detect a slight pause in between (but it also shouldn't take more than a half a second between taps so don't wait too long).
### Supporter Tier
### Troubleshooting
Breezy Vulkan's Supporter Tier features are enhancements to core functionality, offered as a way to reward those who have [supported the project](https://ko-fi.com/wheaney). Core features — like Virtual Display mode, VR-Lite mouse/joystick modes, and Follow mode's display positioning/resizing settings — will always remain available to everyone regardless of supporter status. Here's the pricing structure:
#### Screen drag or flickering
Framerate is really important here, because individual frames are static, so moving your head quickly may produce a noticeable flicker as it moves the screen. Higher framerates will produce an overall better experience (less flicker and smoother follow), but lower framerates should still be totally usable.
| Payment period | Price | Upgrade window \* |
| -------------- | ------------------ | ------------------------------------- |
| Yearly | $10 USD, recurring | Within 90 days to upgrade to lifetime |
| Lifetime | $25 USD, one-time | — |
#### Unexpected screen movement or drift
It's important that your glasses are either on your head or sitting on a flat surface when they're first plugged in and calibrated. If you notice that your screen is constantly drifting in one direction or continues to move for several seconds after a head movement, almost as if the screen has some momentum that takes time to slow down, then you'll want to re-calibrate them. To do this, do a triple-tap as described in the Multi-tap section above.
\* If you pay for a plan and decide to upgrade to a longer-term plan, you may pay the difference within this window.
#### Display size
For recurring plans, access renews automatically during the renewal window (7 days prior to expiration). Your device does not need to stay online during normal use, but it must go online at least once to refresh your license. If you remain offline past your expiration time, features will pause until the next time you go online and refresh.
If the screen appears very small in your view, you may be playing at the Deck screen's native resolution, and not at the glasses' native
resolution. To fix this:
1. Go to the game details in Steam, hit the Settings/cog icon, and open `Properties`, then for `Game Resolution` choose `Native`.
2. After launching the game, if it's still small, go into the game options, and in the graphics or video settings, change the resolution (the glasses run at 1920x1080).
Features currently offered:
* Smooth Follow (in Follow mode)
* Automatic Recentering (in Virtual Display mode)
* Side-by-side support (in Virtual Display mode)
#### Unlocking Supporter Tier
If you donate at least $10, you should immediately receive an email (to your Ko-fi email address) with a verification token. If you don't, request it using the config script:
```bash
xr_driver_cli --request-token [emailAddress]
```
Once you have a token, verify it using:
```bash
xr_driver_cli --verify-token [token]
xr_driver_cli --refresh-license
```
If you *WANT* to keep a low resolution, then you can just use the `Zoom` setting to make the screen appear larger. For now this is done through the config script: `~/bin/xreal_driver_config -z 1.0`. Larger numbers zoom in (e.g. `2.0` doubles the screen size) and smaller numbers zoom out (e.g. `0.5` is half the screen size).
### Disabling
To disable the floating screen effect, either disable the driver (`xr_driver_cli -d`), unplug the glasses, or hit the `Home` key (you'll need to bind this to your controller, if on Steam Deck).
To disable the floating screen effect, either disable the driver (`~/bin/xreal_driver_config -d`), unplug the glasses, or hit the `Home` key (you'll need to bind this to your controller, if on Steam Deck).
### Updating
@ -222,29 +62,4 @@ Rerun the `breezy_vulkan_setup` script. No need to re-download this script, as i
### Uninstalling
If you wish to completely remove the installation:
* For **Breezy KDE** run the following: `breezy_kwin_uninstall`
* For **Breezy GNOME**:
* If you installed *via the setup script* run the following: `~/.local/bin/breezy_gnome_uninstall`
* If you installed via `yay` run the following: `pacman -R breezy-desktop-gnome-git`, you may also want to uninstall the base driver with `pacman -R xr-driver-breezy-gnome-git`
* For **Breezy Vulkan** run the following: `~/.local/bin/breezy_vulkan_uninstall`. This won't uninstall the base driver package, follow the instructions at the end of the uninstallation to do this manually.
## Data Privacy Notice
Your right to privacy and the protection of your personal data are baked into every decision around how your personal data is collected, handled and stored. Your personal data will never be shared, sold, or distributed in any form.
### Data Collected
In order to provide you with Supporter Tier features, this application and its backend services have to collect the following pieces of personal information:
* Your email address is sent to this application's backend server from either the payment vendor (Ko-fi) or from your device (at your request). Your email address may be used immediately upon receipt in its unaltered form to send you a transactional email, but it is then hashed prior to storage. The unaltered form of your email address is never stored and can no longer be referenced. The hashed value is stored for later reference.
* Other personal data may be sent from the payment vendor, but is never utilized nor stored.
* Your device's MAC address is hashed on your device. It never leaves your device in its original, unaltered form. The hashed value is sent to this application's backend server and stored for later reference.
Hashing functions are a one-way process that serve to anonymize your personal data by irreversibly changing them. Once hashed, they can never be unhashed or traced back to their original values.
### Contact
For inquires about data privacy or any related concerns, please contact:
Wayne Heaney - **wayne@xronlinux.com**
If you wish to completely remove the installation, run the following: `sudo ~/bin/breezy_vulkan_uninstall`. This won't uninstall the base driver package, follow the instructions at the end of the uninstallation to do this manually.

View File

@ -1 +0,0 @@
2.9.13

Binary file not shown.

Before

Width:  |  Height:  |  Size: 938 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,119 +0,0 @@
#!/usr/bin/env bash
# This setup script should do the minimum work required to download the release package, unzip it, and kick off the
# setup script contained within.
# exit when any command fails
set -e
if [ "$(id -u)" == "0" ]; then
echo "This script must not be run as root" 1>&2
exit 1
fi
check_command() {
if ! command -v "$1" &>/dev/null; then
echo "Please install \"$1\" and make sure it's available in your \$PATH, then rerun the setup."
exit 1
fi
}
check_command "curl"
check_command "gnome-shell"
check_command "jq"
ARCH=$(uname -m)
FILE_NAME="breezyGNOME-$ARCH.tar.gz"
LIBS_FILE_NAME="breezyGNOME-libs-$ARCH.tar.gz"
GNOME_VERSION=$(gnome-shell --version | cut -d' ' -f3 | cut -d'.' -f1)
VERSION_SPECIFIC_FILENAME="breezyGNOME-$GNOME_VERSION-$ARCH.tar.gz"
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/wheaney/breezy-desktop/releases/latest")
if echo "$LATEST_RELEASE" | jq -e --arg filename "$VERSION_SPECIFIC_FILENAME" '.assets[] | select(.name == $filename)' > /dev/null; then
echo "Performing setup for GNOME $GNOME_VERSION ($ARCH)"
FILE_NAME=$VERSION_SPECIFIC_FILENAME
elif [ "$GNOME_VERSION" -lt 45 ]; then
echo "Performing setup for GNOME 44 and below ($ARCH)"
FILE_NAME="breezyGNOME-44-max-$ARCH.tar.gz"
else
echo "Performing setup for GNOME 45 and up ($ARCH)"
fi
start_dir=$(pwd)
# create temp directory
tmp_dir=$(mktemp -d -t breezy-gnome-XXXXXXXXXX)
pushd $tmp_dir > /dev/null
echo "Created temp directory: ${tmp_dir}"
binary_download_url="https://github.com/wheaney/breezy-desktop/releases/latest/download/$FILE_NAME"
libs_download_url="https://github.com/wheaney/breezy-desktop/releases/latest/download/$LIBS_FILE_NAME"
if [ "$1" = "-v" ]
then
metrics_version="$2"
local_dir_arg="$3"
elif [ "$1" = "--tag" ] && [ -n "$2" ]
then
binary_download_url="https://github.com/wheaney/breezy-desktop/releases/download/$2/$FILE_NAME"
libs_download_url="https://github.com/wheaney/breezy-desktop/releases/download/$2/$LIBS_FILE_NAME"
else
local_dir_arg="$1"
fi
if [ -n "$local_dir_arg" ]
then
if [[ "$local_dir_arg" = /* ]]; then
local_dir="$local_dir_arg"
else
local_dir=$(realpath "$start_dir/$local_dir_arg")
fi
binary_path_arg="$local_dir/$FILE_NAME"
if [ ! -f "$binary_path_arg" ]; then
echo "Error: Breezy GNOME archive not found at $binary_path_arg" 1>&2
exit 1
fi
lib_path_arg="$local_dir/$LIBS_FILE_NAME"
if [ ! -f "$lib_path_arg" ]; then
echo "Error: Breezy GNOME libs archive not found at $lib_path_arg" 1>&2
exit 1
fi
fi
if [ -z "$binary_path_arg" ]
then
# download and unzip the binary
binary_path_arg="$FILE_NAME"
echo "Downloading to: ${tmp_dir}/$binary_path_arg"
curl -L "$binary_download_url" > "$binary_path_arg"
else
cp "$binary_path_arg" "$tmp_dir"
fi
echo "Extracting to: ${tmp_dir}/breezy_gnome"
tar -xf $(basename $binary_path_arg)
if [ -z "$lib_path_arg" ]
then
lib_path_arg="$LIBS_FILE_NAME"
echo "Downloading to: ${tmp_dir}/$lib_path_arg"
curl -L "$libs_download_url" > "$lib_path_arg"
else
cp "$lib_path_arg" "$tmp_dir"
fi
echo "Extracting lib to: ${tmp_dir}/breezy_gnome"
# Extract libs into the extracted directory
tar -xf $(basename $lib_path_arg)
mv breezy_desktop_lib/* breezy_gnome/
pushd breezy_gnome > /dev/null
# run the setup script that comes with this release
bin/setup $metrics_version
echo "Deleting temp directory: ${tmp_dir}"
rm -rf $tmp_dir
cd "$(dirs -l -0)" && dirs -c

View File

@ -1,211 +0,0 @@
#!/usr/bin/env bash
# This setup script should do the minimum work required to download the release package, unzip it, and kick off the
# setup script contained within.
# exit when any command fails
set -e
if [ "$(id -u)" == "0" ]; then
echo "This script must not be run as root" 1>&2
exit 1
fi
check_command() {
if ! command -v "$1" &>/dev/null; then
echo "Please install \"$1\" and make sure it's available in your \$PATH, then rerun the setup."
exit 1
fi
}
check_command "curl"
print_missing_dependencies() {
echo ""
printf "\n\033[1;31mMissing required components\033[0m\n"
if [ -n "${BREEZY_DISTROBOX:-}" ]; then
echo ""
printf "\033[1;33mFirst, enter your Distrobox container:\033[0m\n"
printf "\tdistrobox enter $BREEZY_DISTROBOX\n"
fi
echo ""
printf "\033[1;33mInstall the missing packages\033[0m with your package manager, then rerun this setup:\n"
printf "\tDebian/Ubuntu:\tsudo apt-get update && sudo apt-get install -y extra-cmake-modules kwin-dev libkf6config-dev libkf6configwidgets-dev libkf6coreaddons-dev libkf6kcmutils-dev libkf6globalaccel-dev libkf6i18n-dev libkf6windowsystem-dev libkf6xmlgui-dev qt6-base-dev qt6-declarative-dev libdrm-dev && (sudo apt-get install -y qml6-module-qtquick3d-helpers || true)\n"
printf "\tFedora/RHEL:\tsudo dnf install -y cmake gcc gcc-c++ extra-cmake-modules kwin-devel kf6-kconfig-devel kf6-kconfigwidgets-devel kf6-kcoreaddons-devel kf6-kcmutils-devel kf6-kglobalaccel-devel kf6-ki18n-devel kf6-kwindowsystem-devel kf6-kxmlgui-devel qt6-qtbase-devel qt6-qttools-devel qt6-qtquick3d wayland-devel libepoxy-devel libdrm-devel\n"
printf "\tArch:\t\tsudo pacman -S --needed extra-cmake-modules qt6-base qt6-declarative qt6-tools qt6-quick3d kconfig kconfigwidgets kcoreaddons kglobalaccel ki18n kcmutils kxmlgui kwindowsystem kwin\n"
echo ""
if [ -z "${BREEZY_DISTROBOX:-}" ]; then
printf "\033[1;33mOn immutable distributions\033[0m (e.g. Fedora Silverblue) you can run the build inside a container.\n"
printf "\tBREEZY_DISTROBOX=your-container-name %s\n" "$0 $*"
echo ""
fi
printf "\n\033[1;33mIf you continue to see this issue\033[0m rerun as follows and attach the full output to a bug report:\n"
printf "\n\tPRINT_FULL_STDERR=1 %s\n" "$0 $*"
exit 1
}
ARCH=$(uname -m)
LIBS_ARCH="$ARCH"
if [ -f /etc/os-release ]; then
. /etc/os-release
if [ "$ID" == "steamos" ]; then
IFS=. read -r steamos_major steamos_minor _ <<< "$VERSION_ID"
ARCH="steamos-${steamos_major}.${steamos_minor}"
fi
fi
FILE_NAME="breezyKWin-$ARCH.tar.gz"
LIBS_FILE_NAME="breezyKWin-libs-$LIBS_ARCH.tar.gz"
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/wheaney/breezy-desktop/releases/latest")
echo "Performing setup for KWin ($ARCH)"
start_dir=$(pwd)
# create temp directory
tmp_dir=$(mktemp -d -t breezy-kwin-XXXXXXXXXX)
pushd $tmp_dir > /dev/null
echo "Created temp directory: ${tmp_dir}"
binary_download_url="https://github.com/wheaney/breezy-desktop/releases/latest/download/$FILE_NAME"
libs_download_url="https://github.com/wheaney/breezy-desktop/releases/latest/download/$LIBS_FILE_NAME"
if [ "$1" = "-v" ]
then
metrics_version="$2"
local_dir_arg="$3"
elif [ "$1" = "--tag" ] && [ -n "$2" ]
then
binary_download_url="https://github.com/wheaney/breezy-desktop/releases/download/$2/$FILE_NAME"
libs_download_url="https://github.com/wheaney/breezy-desktop/releases/download/$2/$LIBS_FILE_NAME"
else
local_dir_arg="$1"
fi
if [ -n "$local_dir_arg" ]
then
if [[ "$local_dir_arg" = /* ]]; then
local_dir="$local_dir_arg"
else
local_dir=$(realpath "$start_dir/$local_dir_arg")
fi
binary_path_arg="$local_dir/$FILE_NAME"
if [ ! -f "$binary_path_arg" ]; then
echo "Error: Breezy KWin archive not found at $binary_path_arg" 1>&2
exit 1
fi
lib_path_arg="$local_dir/$LIBS_FILE_NAME"
if [ ! -f "$lib_path_arg" ]; then
echo "Error: Breezy KWin libs archive not found at $lib_path_arg" 1>&2
exit 1
fi
fi
if [ -z "$binary_path_arg" ]
then
http_code=$(curl -s -o /dev/null -w "%{http_code}" -L "$binary_download_url" || echo "000")
if [[ "$http_code" =~ ^(2|3) ]]; then
echo "Downloading to: ${tmp_dir}/$FILE_NAME"
curl -L "$binary_download_url" -o "$FILE_NAME"
binary_path_arg="$FILE_NAME"
else
check_command "git"
check_command "cmake"
check_command "make"
# handle -v / --tag like the rest of the script
if [ "$1" = "--tag" ] && [ -n "$2" ]; then
requested_tag="$2"
fi
# resolve tag: prefer requested_tag, then LATEST_RELEASE if already fetched, else query GitHub API
if [ -n "$requested_tag" ]; then
tag="$requested_tag"
else
tag=$(curl -s "https://api.github.com/repos/wheaney/breezy-desktop/releases/latest" \
| grep -m1 '"tag_name":' \
| sed -E 's/.*"tag_name":[[:space:]]*"([^"]+)".*/\1/')
fi
if [ -z "$tag" ]; then
echo "Failed to determine latest tag for wheaney/breezy-desktop" 1>&2
exit 1
fi
if [ -z "${DEV_BUILD+x}" ]; then
echo "Cloning wheaney/breezy-desktop (tag: ${tag})"
if git clone --depth 1 --branch "$tag" "https://github.com/wheaney/breezy-desktop.git" breezy-desktop 2>/dev/null; then
pushd breezy-desktop > /dev/null
else
git clone "https://github.com/wheaney/breezy-desktop.git" breezy-desktop
pushd breezy-desktop > /dev/null
git checkout "$tag"
fi
echo "Downloading git submodules"
git submodule sync --recursive || true
git submodule update --init modules/XRLinuxDriver
git submodule update --init modules/sombrero
git submodule update --init ui/modules/PyXRLinuxDriverIPC
else
pushd $start_dir > /dev/null
fi
set +e
distrobox_name="${BREEZY_DISTROBOX:-}"
if [ -n "$distrobox_name" ]; then
check_command "distrobox"
echo "Building Breezy Desktop from source inside Distrobox container: $distrobox_name"
build_dir=$(pwd)
distrobox_shell_cmd="cd \"$build_dir\" && LOCAL_BUILD_SYSTEM=1 bin/package_kwin --download-driver"
pkgkwin_stderr=$(distrobox enter --name "$distrobox_name" -- /bin/sh --noprofile --norc -lc "$distrobox_shell_cmd" 2>&1)
pkgkwin_rc=$?
else
echo "Building Breezy Desktop from source, this may take a while..."
pkgkwin_stderr=$(LOCAL_BUILD_SYSTEM=1 bin/package_kwin --download-driver 2>&1)
pkgkwin_rc=$?
fi
set -e
if [ "$pkgkwin_rc" -ne 0 ]; then
if echo "$pkgkwin_stderr" | grep -qiE 'could not find|Please install "cmake"' && [ -z "${PRINT_FULL_STDERR+x}" ]; then
print_missing_dependencies "$*"
else
echo "$pkgkwin_stderr"
fi
echo "Error: Breezy Desktop build failed with exit code $pkgkwin_rc"
exit $pkgkwin_rc
fi
FILE_NAME="breezyKWin-$ARCH.tar.gz"
binary_path_arg="$FILE_NAME"
cp "out/$binary_path_arg" "$tmp_dir"
popd > /dev/null
fi
else
cp "$binary_path_arg" "$tmp_dir"
fi
if [ -z "$lib_path_arg" ]
then
lib_path_arg="$LIBS_FILE_NAME"
echo "Downloading to: ${tmp_dir}/$lib_path_arg"
curl -L "$libs_download_url" -o "$lib_path_arg"
else
cp "$lib_path_arg" "$tmp_dir"
fi
echo "Extracting to: ${tmp_dir}/breezy_kwin"
tar -xf $(basename "$binary_path_arg")
echo "Extracting lib to: ${tmp_dir}/breezy_kwin"
tar -xf $(basename "$lib_path_arg")
mv breezy_desktop_lib/* breezy_kwin/
pushd breezy_kwin > /dev/null
# run the setup script that comes with this release
ARCH="$ARCH" bin/setup $metrics_version
echo "Deleting temp directory: ${tmp_dir}"
rm -rf $tmp_dir
cd "$(dirs -l -0)" && dirs -c

View File

@ -14,84 +14,33 @@ fi
start_dir=$(pwd)
ARCH=$(uname -m)
if [ "$ARCH" != "x86_64" ]; then
echo "Breezy Vulkan only supports x86_64 currently"
exit 1
fi
# create temp directory
tmp_dir=$(mktemp -d -t breezy-vulkan-XXXXXXXXXX)
pushd $tmp_dir > /dev/null
echo "Created temp directory: ${tmp_dir}"
binary_download_url="https://github.com/wheaney/breezy-desktop/releases/latest/download/breezyVulkan-$ARCH.tar.gz"
libs_download_url="https://github.com/wheaney/breezy-desktop/releases/latest/download/breezyVulkan-libs-$ARCH.tar.gz"
LIBS_FILE_NAME="breezyVulkan-libs-$ARCH.tar.gz"
FILE_NAME="breezyVulkan-$ARCH.tar.gz"
if [ "$1" = "-v" ]
if [ -z "$1" ]
then
metrics_version="$2"
local_dir_arg="$3"
elif [ "$1" = "--tag" ] && [ -n "$2" ]
then
binary_download_url="https://github.com/wheaney/breezy-desktop/releases/download/$2/breezyVulkan-$ARCH.tar.gz"
libs_download_url="https://github.com/wheaney/breezy-desktop/releases/download/$2/breezyVulkan-libs-$ARCH.tar.gz"
# download and unzip the latest driver
echo "Downloading latest release to: ${tmp_dir}/breezyVulkan.tar.gz"
curl -L -O https://github.com/wheaney/breezy-desktop/releases/latest/download/breezyVulkan.tar.gz
else
local_dir_arg="$1"
fi
if [ -n "$local_dir_arg" ]
then
if [[ "$local_dir_arg" = /* ]]; then
local_dir="$local_dir_arg"
if [[ "$1" = /* ]]; then
abs_path="$1"
else
local_dir=$(realpath "$start_dir/$local_dir_arg")
# Convert relative path to absolute path
abs_path=$(realpath "$start_dir/$1")
fi
binary_path_arg="$local_dir/$FILE_NAME"
if [ ! -f "$binary_path_arg" ]; then
echo "Error: Breezy Vulkan archive not found at $binary_path_arg" 1>&2
exit 1
fi
lib_path_arg="$local_dir/$LIBS_FILE_NAME"
if [ ! -f "$lib_path_arg" ]; then
echo "Error: Breezy Vulkan libs archive not found at $lib_path_arg" 1>&2
exit 1
fi
fi
if [ -z "$binary_path_arg" ]
then
# download and unzip the binary
binary_path_arg="$FILE_NAME"
echo "Downloading to: ${tmp_dir}/$binary_path_arg"
curl -L "$binary_download_url" > "$binary_path_arg"
else
cp "$binary_path_arg" "$tmp_dir"
cp $abs_path $tmp_dir
fi
echo "Extracting to: ${tmp_dir}/breezy_vulkan"
tar -xf $(basename "$binary_path_arg")
if [ -z "$lib_path_arg" ]
then
lib_path_arg="$LIBS_FILE_NAME"
echo "Downloading to: ${tmp_dir}/$lib_path_arg"
curl -L "$libs_download_url" > "$lib_path_arg"
else
cp "$lib_path_arg" "$tmp_dir"
fi
echo "Extracting lib to: ${tmp_dir}/breezy_vulkan"
tar -xf $(basename "$lib_path_arg")
mv breezy_desktop_lib/* breezy_vulkan/
tar -xf breezyVulkan.tar.gz
pushd breezy_vulkan > /dev/null
# run the setup script that comes with this release
bin/setup $metrics_version
bin/setup
echo "Deleting temp directory: ${tmp_dir}"
rm -rf $tmp_dir

View File

@ -1,9 +0,0 @@
#!/usr/bin/env bash
# exit when any command fails
set -e
ARCH=x86_64 bin/package_gnome "$@"
ARCH=aarch64 bin/package_gnome "$@"
STEAMOS=1 bin/package_kwin "$@"
bin/package_vulkan "$@"

View File

@ -1,121 +0,0 @@
#!/usr/bin/env bash
# exit when any command fails
set -e
ARCH=${ARCH:-$(uname -m)}
# https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(realpath $SCRIPT_DIR/..)
VULKAN_DIR=$ROOT_DIR/vulkan
UI_DIR=$ROOT_DIR/ui
XR_DRIVER_DIR=$ROOT_DIR/modules/XRLinuxDriver
if [ -z "$GNOME_BACKPORT" ]; then
# standard build for GNOME 45 and up
echo "Building Breezy GNOME for $ARCH, GNOME versions 45 and up"
GNOME_DIR=$ROOT_DIR/gnome
BUILD_FILE_NAME=breezyGNOME-$ARCH.tar.gz
else
# special build process for backports
echo "Building Breezy GNOME backport \"$GNOME_BACKPORT\" for $ARCH"
# strip the prefix "gnome-" from the backport name, if it's there
GNOME_BACKPORT_NAME=${GNOME_BACKPORT#gnome-}
GNOME_DIR=$ROOT_DIR/gnome/backports/$GNOME_BACKPORT/gnome
UI_DIR=$ROOT_DIR/gnome/backports/$GNOME_BACKPORT/ui
BUILD_FILE_NAME=breezyGNOME-$GNOME_BACKPORT_NAME-$ARCH.tar.gz
rm -rf $GNOME_DIR/build
pushd $GNOME_DIR
git submodule update --init
popd
fi
GNOME_BUILD_DIR=$GNOME_DIR/build
mkdir -p $GNOME_BUILD_DIR
if [ -e "$GNOME_BUILD_DIR/$BUILD_FILE_NAME" ]; then
rm $GNOME_BUILD_DIR/$BUILD_FILE_NAME
fi
PACKAGE_DIR=$GNOME_BUILD_DIR/breezy_gnome
rm -rf $PACKAGE_DIR
mkdir -p $PACKAGE_DIR
source $XR_DRIVER_DIR/bin/inject_ua
# if a custom_banner image exists, copy it over the sombrero one
if [ -e "$VULKAN_DIR/custom_banner.png" ]; then
cp $VULKAN_DIR/custom_banner.png $PACKAGE_DIR
fi
# copy vulkan setup scripts and configs
mkdir -p $PACKAGE_DIR/bin
copy_and_inject_ua "$XR_DRIVER_DIR/bin/ua.sh" "$PACKAGE_DIR/bin" "$GNOME_DIR/bin/setup" "$GNOME_DIR/bin/breezy_gnome_verify" "$GNOME_DIR/bin/breezy_gnome_uninstall" "$GNOME_DIR/bin/breezy_gnome_logs"
XR_DRIVER_BINARY_NAME=xrDriver-$ARCH.tar.gz
XR_DRIVER_BINARY="$XR_DRIVER_DIR/out/$XR_DRIVER_BINARY_NAME"
if [ ! -e "$XR_DRIVER_BINARY" ] || [ "$1" == "--rebuild-driver" ] || [ "$1" == "--rebuild-all" ]; then
# if a file exists at custom_banner_config.yml, copy it to the xrealAirLinuxDriver directory
if [ -e "$VULKAN_DIR/custom_banner_config.yml" ]; then
cp $VULKAN_DIR/custom_banner_config.yml $XR_DRIVER_DIR
fi
pushd $XR_DRIVER_DIR
# strange issue where the base library produces a .so file if the build is not cleaned
rm -rf build/
docker-build/init.sh
docker-build/run-build.sh $ARCH
popd
fi
TMP_DIR=$(mktemp -d -t breezy-gnome-XXXXXXXXXX)
pushd $TMP_DIR
cp "$XR_DRIVER_BINARY" "$TMP_DIR/$XR_DRIVER_BINARY_NAME"
tar -xf "$TMP_DIR/$XR_DRIVER_BINARY_NAME"
XR_DRIVER_MANIFEST_LINE=$(sha256sum xr_driver/manifest)
popd
rm -rf $TMP_DIR
cp $XR_DRIVER_BINARY $PACKAGE_DIR/$XR_DRIVER_BINARY_NAME
cp $XR_DRIVER_DIR/bin/xr_driver_setup $PACKAGE_DIR/bin
$GNOME_DIR/bin/package_extension
cp $GNOME_DIR/out/breezydesktop@xronlinux.com.shell-extension.zip $PACKAGE_DIR
# create a checksum that combines the checksums of all files in the directory
pushd $GNOME_DIR/src
GNOME_MANIFEST_LINE=$(find -L . -type f ! -name "*.compiled" -exec sha256sum {} \; | sort | sha256sum | sed 's/ .*//')
popd
UI_BUILD_ARTIFACT=$UI_DIR/out/breezyUI-$ARCH.tar.gz
if [ ! -e "$UI_BUILD_ARTIFACT" ] || [ "$1" == "--rebuild-ui" ] || [ "$1" == "--rebuild-all" ]; then
pushd $UI_DIR
bin/package $ARCH
popd
fi
tar -xf $UI_BUILD_ARTIFACT -C $PACKAGE_DIR
# create manifest file for verifying installed file checksums against the originally packaged versions
# include any file that doesn't get modified during setup (e.g. vkBasalt.json files)
pushd $PACKAGE_DIR
echo $XR_DRIVER_MANIFEST_LINE > manifest
echo -e "$GNOME_MANIFEST_LINE breezydesktop@xronlinux.com" >> manifest
popd
# bundle everything up
pushd $GNOME_BUILD_DIR
tar -zcvf $BUILD_FILE_NAME breezy_gnome
popd
mkdir -p out
if [ -e "out/$BUILD_FILE_NAME" ]; then
rm out/$BUILD_FILE_NAME
fi
cp $GNOME_BUILD_DIR/$BUILD_FILE_NAME out

View File

@ -1,104 +0,0 @@
#!/usr/bin/env bash
# exit when any command fails
set -e
ARCH=${ARCH:-$(uname -m)}
BUILD_ARCH=$ARCH
if [ -n "${STEAMOS+x}" ]; then
ARCH="x86_64"
BUILD_ARCH="steamos-$STEAMOS"
fi
# https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(realpath $SCRIPT_DIR/..)
XR_DRIVER_DIR=$ROOT_DIR/modules/XRLinuxDriver
echo "Building Breezy KWin for $BUILD_ARCH"
KWIN_DIR=$ROOT_DIR/kwin
BUILD_FILE_NAME=breezyKWin-$BUILD_ARCH.tar.gz
TMP_DIR=$(mktemp -d -t breezy-kwin-XXXXXXXXXX)
PACKAGE_DIR=$TMP_DIR/breezy_kwin
mkdir -p $PACKAGE_DIR
source $XR_DRIVER_DIR/bin/inject_ua
# copy vulkan setup scripts and configs
mkdir -p $PACKAGE_DIR/bin
copy_and_inject_ua "$XR_DRIVER_DIR/bin/ua.sh" "$PACKAGE_DIR/bin" "$KWIN_DIR/bin/setup" "$KWIN_DIR/bin/breezy_kwin_uninstall" "$KWIN_DIR/bin/breezy_kwin_logs"
XR_DRIVER_BINARY_NAME=xrDriver-$ARCH.tar.gz
XR_DRIVER_BINARY="$XR_DRIVER_DIR/out/$XR_DRIVER_BINARY_NAME"
XR_DRIVER_VERSION=$(sed -nE 's/^project\([^)]*VERSION[[:space:]]+([0-9]+\.[0-9]+\.[0-9]+).*$/\1/p' "$XR_DRIVER_DIR/CMakeLists.txt" | head -n 1)
if [ "$1" == "--download-driver" ]; then
driver_download_url="https://github.com/wheaney/XRLinuxDriver/releases/download/v$XR_DRIVER_VERSION/xrDriver-$ARCH.tar.gz"
setup_download_url="https://github.com/wheaney/XRLinuxDriver/releases/download/v$XR_DRIVER_VERSION/xr_driver_setup"
curl -L "$driver_download_url" > "$PACKAGE_DIR/$XR_DRIVER_BINARY_NAME"
curl -L "$setup_download_url" > "$PACKAGE_DIR/bin/xr_driver_setup"
chmod +x "$PACKAGE_DIR/bin/xr_driver_setup"
echo "Downloaded XRLinuxDriver binary and setup script, with hashes:"
printf '\txrDriver-%s.tar.gz: %s\n' "$ARCH" "$(sha256sum "$PACKAGE_DIR/$XR_DRIVER_BINARY_NAME" | sort | sha256sum | sed 's/ .*//')"
printf '\txr_driver_setup: %s\n' "$(sha256sum "$PACKAGE_DIR/bin/xr_driver_setup" | sort | sha256sum | sed 's/ .*//')"
else
if [ ! -e "$XR_DRIVER_BINARY" ] || [ "$1" == "--rebuild-driver" ] || [ "$1" == "--rebuild-all" ]; then
# if a file exists at custom_banner_config.yml, copy it to the xrealAirLinuxDriver directory
if [ -e "$VULKAN_DIR/custom_banner_config.yml" ]; then
cp $VULKAN_DIR/custom_banner_config.yml $XR_DRIVER_DIR
fi
pushd $XR_DRIVER_DIR > /dev/null
# strange issue where the base library produces a .so file if the build is not cleaned
rm -rf build/
docker-build/init.sh
docker-build/run-build.sh $ARCH
popd > /dev/null
fi
XR_DRIVER_TMP_DIR=$(mktemp -d -t xr-driver-XXXXXXXXXX)
pushd $XR_DRIVER_TMP_DIR > /dev/null
cp "$XR_DRIVER_BINARY" "$XR_DRIVER_TMP_DIR/$XR_DRIVER_BINARY_NAME"
tar -xf "$XR_DRIVER_TMP_DIR/$XR_DRIVER_BINARY_NAME"
XR_DRIVER_MANIFEST_LINE=$(sha256sum xr_driver/manifest)
popd > /dev/null
rm -rf $XR_DRIVER_TMP_DIR
cp "$XR_DRIVER_BINARY" "$PACKAGE_DIR/$XR_DRIVER_BINARY_NAME"
cp $XR_DRIVER_DIR/bin/xr_driver_setup $PACKAGE_DIR/bin/xr_driver_setup
fi
# alternative to symlinking, since the Docker build can't resolve to the parent directory
# this file is in .gitignore so it doesn't get duplicated
cp ui/modules/PyXRLinuxDriverIPC/xrdriveripc.py $KWIN_DIR/src/xrdriveripc/xrdriveripc.py
cp VERSION $KWIN_DIR
cp modules/sombrero/*.png $KWIN_DIR/src/qml
cp ui/data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg $KWIN_DIR/src/kcm/
pushd $KWIN_DIR > /dev/null
if [ -z "${LOCAL_BUILD_SYSTEM+x}" ]; then
docker-build/init.sh
docker-build/run-build.sh "$BUILD_ARCH"
else
bin/package_kwin_plugin
fi
popd > /dev/null
cp $KWIN_DIR/out/breezyKWinPlugin-$BUILD_ARCH.tar.gz $PACKAGE_DIR/breezyKWinPlugin.tar.gz
pushd $TMP_DIR > /dev/null
tar -zcvf $BUILD_FILE_NAME breezy_kwin
popd > /dev/null
mkdir -p out
if [ -e "out/$BUILD_FILE_NAME" ]; then
rm out/$BUILD_FILE_NAME
fi
cp $TMP_DIR/$BUILD_FILE_NAME out
rm -rf $TMP_DIR

View File

@ -1,78 +0,0 @@
#!/usr/bin/env bash
# exit when any command fails
set -e
# Package shared/rarely-changing library artifacts.
#
# Produces 5 total artifacts:
# - breezyVulkan-libs-x86_64.tar.gz
# - breezyGNOME-libs-$ARCH.tar.gz (x86_64 + aarch64)
# - breezyKWin-libs-$ARCH.tar.gz (x86_64 + aarch64)
ARCHITECTURES=("x86_64" "aarch64")
VULKAN_ARCHITECTURES=("x86_64")
APPS=("breezyVulkan" "breezyGNOME" "breezyKWin")
# https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(realpath "$SCRIPT_DIR/..")
XR_DRIVER_DIR="$ROOT_DIR/modules/XRLinuxDriver"
VULKAN_DIR="$ROOT_DIR/vulkan"
VKBASALT_MODULE_DIR="$VULKAN_DIR/modules/vkBasalt"
VKBASALT_BUILD_DIR="$VKBASALT_MODULE_DIR/out"
echo "Building XR Driver libs packages"
pushd "$XR_DRIVER_DIR" > /dev/null
./bin/package_libs
popd > /dev/null
echo "Building vkBasalt build artifacts"
if [ ! -d "$VKBASALT_BUILD_DIR" ] || [ "${1:-}" == "--rebuild-vkbasalt" ]; then
pushd "$VKBASALT_MODULE_DIR" > /dev/null
./docker-build
popd > /dev/null
fi
echo "Building Breezy libs packages for all architectures"
BUILD_PATH="$ROOT_DIR/build"
mkdir -p "$BUILD_PATH"
pushd "$BUILD_PATH" > /dev/null
for APP in "${APPS[@]}"; do
ARCHES=("${ARCHITECTURES[@]}")
if [ "$APP" == "breezyVulkan" ]; then
ARCHES=("${VULKAN_ARCHITECTURES[@]}")
fi
for ARCH in "${ARCHES[@]}"; do
XR_LIB_ARCHIVE="$XR_DRIVER_DIR/out/xrDriver-libs-$ARCH.tar.gz"
PACKAGE_LIB_DIR=breezy_desktop_lib
rm -rf "$PACKAGE_LIB_DIR"
mkdir -p "$PACKAGE_LIB_DIR"
cp "$XR_LIB_ARCHIVE" "$PACKAGE_LIB_DIR/"
if [ "$APP" == "breezyVulkan" ]; then
mkdir -p "$PACKAGE_LIB_DIR"/{vkBasalt.64,vkBasalt.32}
cp "$VKBASALT_BUILD_DIR/builddir/src/libvkbasalt.so" "$PACKAGE_LIB_DIR/vkBasalt.64/"
cp "$VKBASALT_BUILD_DIR/builddir/config/vkBasalt.json" "$PACKAGE_LIB_DIR/vkBasalt.64/"
cp "$VKBASALT_BUILD_DIR/builddir.32/src/libvkbasalt.so" "$PACKAGE_LIB_DIR/vkBasalt.32/"
fi
LIB_ARTIFACT_NAME="$APP-libs-$ARCH.tar.gz"
tar -zcvf "$LIB_ARTIFACT_NAME" "$PACKAGE_LIB_DIR" > /dev/null
# Clean up for next iteration
rm -rf "$PACKAGE_LIB_DIR"
done
done
popd > /dev/null
mkdir -p "$ROOT_DIR/out"
cp "$BUILD_PATH"/breezy*-libs-*.tar.gz "$ROOT_DIR/out/"
rm -f "$BUILD_PATH"/breezy*-libs-*.tar.gz

View File

@ -3,92 +3,65 @@
# exit when any command fails
set -e
ARCH=${ARCH:-$(uname -m)}
echo "Building Breezy Vulkan for $ARCH"
XREAL_DRIVER_DIR=modules/xrealAirLinuxDriver
source $XREAL_DRIVER_DIR/bin/inject_ua
XR_DRIVER_DIR=modules/XRLinuxDriver
source $XR_DRIVER_DIR/bin/inject_ua
# check out submodules, recursively for nested ones
git submodule update --init --recursive
VULKAN_DIR=vulkan
VULKAN_BUILD_DIR=$VULKAN_DIR/build
if [ ! -d "$VULKAN_BUILD_DIR" ]; then
mkdir -p $VULKAN_BUILD_DIR
VULKAN_BUILD=$VULKAN_DIR/build
if [ ! -d "$VULKAN_BUILD" ]; then
mkdir -p $VULKAN_BUILD
else
rm -rf $VULKAN_BUILD_DIR/*
rm -rf $VULKAN_BUILD/*
fi
VULKAN_MODULES=$VULKAN_DIR/modules
PACKAGE_DIR=$VULKAN_BUILD_DIR/breezy_vulkan
PACKAGE_DIR=$VULKAN_BUILD/breezy_vulkan
if [ ! -d "$PACKAGE_DIR" ]; then
mkdir -p $PACKAGE_DIR
else
rm -rf $PACKAGE_DIR/*
fi
BUILD_FILE_NAME=breezyVulkan-$ARCH.tar.gz
# copy Sombrero shader, get ReShade headers
cp modules/sombrero/*.frag $PACKAGE_DIR
cp modules/sombrero/*.png $PACKAGE_DIR
wget -P $PACKAGE_DIR https://raw.githubusercontent.com/crosire/reshade-shaders/384465d0287999caa6190b5ebea506200b4f4a0a/Shaders/ReShade.fxh
wget -P $PACKAGE_DIR https://raw.githubusercontent.com/crosire/reshade-shaders/384465d0287999caa6190b5ebea506200b4f4a0a/Shaders/ReShadeUI.fxh
# if a custom_banner image exists, copy it over the sombrero one
if [ -e "$VULKAN_DIR/custom_banner.png" ]; then
cp $VULKAN_DIR/custom_banner.png $PACKAGE_DIR
fi
# copy vulkan setup scripts and configs
mkdir -p $PACKAGE_DIR/bin
copy_and_inject_ua "$XR_DRIVER_DIR/bin/ua.sh" "$PACKAGE_DIR/bin" "$VULKAN_DIR/bin/setup" "$VULKAN_DIR/bin/breezy_vulkan_verify" "$VULKAN_DIR/bin/breezy_vulkan_uninstall" "$VULKAN_DIR/bin/breezy_vulkan_logs"
cp -r $VULKAN_DIR/config $PACKAGE_DIR
# build XR driver
XR_DRIVER_BINARY_NAME=xrDriver-$ARCH.tar.gz
XR_DRIVER_BINARY="$XR_DRIVER_DIR/out/$XR_DRIVER_BINARY_NAME"
if [ ! -e "$XR_DRIVER_BINARY" ] || [ "$1" == "--rebuild-driver" ]; then
# if a file exists at custom_banner_config.yml, copy it to the xrealAirLinuxDriver directory
if [ -e "$VULKAN_DIR/custom_banner_config.yml" ]; then
cp $VULKAN_DIR/custom_banner_config.yml $XR_DRIVER_DIR
fi
pushd $XR_DRIVER_DIR
# strange issue where the base library produces a .so file if the build is not cleaned
rm -rf build/
docker-build/init.sh
docker-build/run-build.sh $ARCH
# build vkBasalt
VKBASALT_MODULE_DIR=$VULKAN_MODULES/vkBasalt
VKBASALT_BUILD_DIR=$VKBASALT_MODULE_DIR/out
if [ ! -d "$VKBASALT_BUILD_DIR" ] || [ "$1" != "--skip-module-builds" ]; then
pushd $VKBASALT_MODULE_DIR
./docker-build
popd
fi
TMP_DIR=$(mktemp -d -t breezy-vulkan-XXXXXXXXXX)
cp "$XR_DRIVER_BINARY" "$TMP_DIR/$XR_DRIVER_BINARY_NAME"
pushd $TMP_DIR
tar -xf "$TMP_DIR/$XR_DRIVER_BINARY_NAME"
# copy vkBasalt binaries and configs
mkdir -p $PACKAGE_DIR/{vkBasalt.64,vkBasalt.32}
cp $VKBASALT_BUILD_DIR/builddir/src/libvkbasalt.so $PACKAGE_DIR/vkBasalt.64/
cp $VKBASALT_BUILD_DIR/builddir/config/vkBasalt.json $PACKAGE_DIR/vkBasalt.64/
cp $VKBASALT_BUILD_DIR/builddir.32/src/libvkbasalt.so $PACKAGE_DIR/vkBasalt.32/
XR_DRIVER_MANIFEST_LINE=$(sha256sum xr_driver/manifest)
popd
rm -rf $TMP_DIR
# copy Sombrero FX, get ReShade headers
cp $VULKAN_MODULES/sombrero/IMUAdjust.fx $PACKAGE_DIR
cp $VULKAN_MODULES/sombrero/calibrating.png $PACKAGE_DIR
wget -P $PACKAGE_DIR https://raw.githubusercontent.com/crosire/reshade-shaders/384465d0287999caa6190b5ebea506200b4f4a0a/Shaders/ReShade.fxh
wget -P $PACKAGE_DIR https://raw.githubusercontent.com/crosire/reshade-shaders/384465d0287999caa6190b5ebea506200b4f4a0a/Shaders/ReShadeUI.fxh
# copy XR driver binary and setup script
cp "$XR_DRIVER_BINARY" "$PACKAGE_DIR/$XR_DRIVER_BINARY_NAME"
cp $XR_DRIVER_DIR/bin/xr_driver_setup $PACKAGE_DIR/bin
# copy vulkan setup scripts and configs
mkdir -p $PACKAGE_DIR/bin
copy_and_inject_ua "$XREAL_DRIVER_DIR/bin/ua.sh" "$PACKAGE_DIR/bin" "$VULKAN_DIR/bin/setup" "$VULKAN_DIR/bin/breezy_vulkan_uninstall"
cp -r $VULKAN_DIR/config $PACKAGE_DIR
# create manifest file for verifying installed file checksums against the originally packaged versions
# include any file that doesn't get modified during setup (e.g. vkBasalt.json files)
pushd $PACKAGE_DIR
echo $XR_DRIVER_MANIFEST_LINE > manifest
sha256sum bin/breezy_vulkan_uninstall bin/breezy_vulkan_logs *.frag *.fx* *.png >> manifest
popd
# build xreal driver
XREAL_BINARY=$XREAL_DRIVER_DIR/build/xrealAirLinuxDriver.tar.gz
if [ ! -e "$XREAL_BINARY" ] || [ "$1" != "--skip-module-builds" ]; then
pushd $XREAL_DRIVER_DIR
bin/package
popd
fi
# copy xreal binary and setup script
cp $XREAL_BINARY $PACKAGE_DIR
cp $XREAL_DRIVER_DIR/bin/xreal_driver_setup $PACKAGE_DIR/bin
# bundle everything up
pushd $VULKAN_BUILD_DIR
tar -zcvf $BUILD_FILE_NAME breezy_vulkan
popd
mkdir -p out
if [ -e "out/$BUILD_FILE_NAME" ]; then
rm out/$BUILD_FILE_NAME
fi
cp $VULKAN_BUILD_DIR/$BUILD_FILE_NAME out
tar -zcvf $VULKAN_BUILD/breezyVulkan.tar.gz --directory $VULKAN_BUILD breezy_vulkan

View File

@ -1,50 +0,0 @@
#!/usr/bin/env bash
# exit when any command fails
set -e
if [ "$(id -u)" == "0" ]; then
echo "This script must not be run as root" 1>&2
exit 1
fi
XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
copy_latest_file() {
local src_dir="$1"
local dest_dir="$2"
local description="$3"
if [ ! -d "$src_dir" ]; then
echo "Warning: ${description} not found at $src_dir"
return 0
fi
local latest_file
latest_file=$(find "$src_dir" -type f -printf '%T@ %p\n' 2>/dev/null | sort -nr | head -n 1 | cut -d' ' -f2-)
if [ -z "$latest_file" ]; then
echo "Warning: No files found under $src_dir"
return 0
fi
mkdir -p "$dest_dir"
cp "$latest_file" "$dest_dir/"
echo "Copied latest ${description}: $latest_file"
}
# Create a temp directory to gather logs
tmp_dir=$(mktemp -d -t breezy-gnome-logs-XXXXXXXXXX)
echo "Gathering logs into temp directory: ${tmp_dir}"
mkdir -p "$tmp_dir/breezy_gnome_logs"
# Copy the most recent GNOME log file
copy_latest_file "$XDG_STATE_HOME/breezy_gnome/logs/ui" "$tmp_dir/breezy_gnome_logs/breezy_gnome" "Breezy GNOME UI logs"
copy_latest_file "$XDG_STATE_HOME/breezy_gnome/logs/gjs" "$tmp_dir/breezy_gnome_logs/breezy_gnome" "Breezy GNOME GJS logs"
# Create archive
archive_name="breezy_gnome_logs_$(date +%Y%m%d_%H%M%S).tar.gz"
tar -czf "$archive_name" -C "$tmp_dir" breezy_gnome_logs
echo "Created log archive: $(pwd)/$archive_name"
rm -rf "$tmp_dir"

View File

@ -1,65 +0,0 @@
#!/usr/bin/env bash
for_install=0
if [[ -n "$1" ]] && [[ "$1" == "--for-install" ]]; then
for_install=1
fi
# we don't want the uninstall script to be able to cause a failure if being triggered by the setup script
[ "$for_install" -eq 0 ] && set -e
if [ "$(id -u)" == "0" ]; then
echo "This script must not be run as root" 1>&2
exit 1
fi
USER_HOME=$(realpath ~)
if [ "$for_install" -eq 0 ]; then
UA_EVENT_NAME="breezy_gnome_uninstall"
UA_CLIENT_ID="BreezyGNOME"
#INJECT_UA_CALL
fi
if [ -z "$XDG_BIN_HOME" ]; then
XDG_BIN_HOME="$USER_HOME/.local/bin"
fi
if [ -z "$XDG_DATA_HOME" ]; then
XDG_DATA_HOME="$USER_HOME/.local/share"
fi
DATA_DIR="$XDG_DATA_HOME/breezy_gnome"
[ "$for_install" -eq 0 ] && echo "Removing ${DATA_DIR} and its contents"
rm -rf $DATA_DIR
[ "$for_install" -eq 0 ] && echo "Uninstalling the breezydesktop@xronlinux.com GNOME extension"
gnome-extensions uninstall breezydesktop@xronlinux.com || true
[ "$for_install" -eq 0 ] && echo "Uninstalling the Breezy Desktop UI application"
rm -rf $XDG_DATA_HOME/breezydesktop
rm -f $XDG_DATA_HOME/applications/com.xronlinux.BreezyDesktop.desktop
rm -f $XDG_DATA_HOME/icons/hicolor/*/apps/com.xronlinux.BreezyDesktop.png
rm -f $XDG_DATA_HOME/locale/*/LC_MESSAGES/breezydesktop.mo
rm -f $XDG_BIN_HOME/breezydesktop
rm -f $XDG_BIN_HOME/virtualdisplay
[ "$for_install" -eq 0 ] && echo "Clearing Breezy Desktop icons from the GTK icon cache"
gtk-update-icon-cache -f -t "$XDG_DATA_HOME/icons/hicolor" >/dev/null 2>&1 || true
if [ -e "$XDG_BIN_HOME/xr_driver_uninstall" ]; then
[ "$for_install" -eq 0 ] && echo "Uninstalling XRLinuxDriver"
if [ "$for_install" -eq 1 ]; then
sudo $XDG_BIN_HOME/xr_driver_uninstall --for-install
else
sudo $XDG_BIN_HOME/xr_driver_uninstall
fi
fi
[ "$for_install" -eq 0 ] && echo "Removing the breezy_gnome scripts from ${XDG_BIN_HOME}"
rm -f $XDG_BIN_HOME/breezy_gnome_verify
rm -f $XDG_BIN_HOME/breezy_gnome_logs
# this script is self-deleting, leave this as the last command
rm -f $XDG_BIN_HOME/breezy_gnome_uninstall

View File

@ -1,42 +0,0 @@
#!/usr/bin/env bash
set -e
# create a string to string mapping, file name to expected file location
declare -A file_paths
file_paths=(
["xr_driver/manifest"]="{xr_driver_data_dir}/manifest"
["breezydesktop@xronlinux.com"]="{gnome_shell_data_dir}/extensions/breezydesktop@xronlinux.com"
)
# verify the file hashes in ./manifest
while IFS= read -r line
do
# split the line into hash and filename
manifest_hash=$(echo $line | awk '{print $1}')
file=$(echo $line | awk '{print $2}')
actual_file_path=${file_paths[$file]}
# check if the file path is a directory
if [ -d "$actual_file_path" ]; then
# compute the SHA256 hash of the directory contents
pushd $actual_file_path > /dev/null
actual_hash=$(find -L . -type f ! -name "*.compiled" -exec sha256sum {} \; | sort | sha256sum | sed 's/ .*//')
popd > /dev/null
else
# compute the SHA256 hash of the actual file
actual_hash=$(sha256sum $actual_file_path | awk '{print $1}')
fi
# compare the hashes
if ! [ "$manifest_hash" = "$actual_hash" ]; then
echo "Verification failed" >&2
exit 1
fi
done < "{data_dir}/manifest"
# if our checks succeeded, run the xr_driver verify script
{bin_dir}/xr_driver_verify > /dev/null
echo "Verification succeeded"

View File

@ -1,30 +0,0 @@
USER_HOME=$(realpath ~)
# https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
if [ -z "$XDG_DATA_HOME" ]; then
XDG_DATA_HOME="$USER_HOME/.local/share"
fi
DATA_DIR="$XDG_DATA_HOME/breezy_gnome"
mkdir -p $DATA_DIR
# if $XDG_DATA_HOME/gnome-shell/extensions/breezydesktop@xronlinux.com exists
extension_path="$XDG_DATA_HOME/gnome-shell/extensions/breezydesktop@xronlinux.com"
if [ -d $extension_path ]; then
# remove it
rm -rf $extension_path
fi
# recursively copy the $SCRIPT_DIR/../../src to extension_path, don't preserve symlinks
cp -rL $SCRIPT_DIR/../../src $extension_path
glib-compile-schemas $extension_path/schemas
pushd $extension_path
GNOME_MANIFEST_LINE=$(find -L . -type f ! -name "*.compiled" -exec sha256sum {} \; | sort | sha256sum | sed 's/ .*//')
popd
pushd $DATA_DIR
echo -e "$GNOME_MANIFEST_LINE breezydesktop@xronlinux.com" > manifest
popd

View File

@ -1,74 +0,0 @@
#!/usr/bin/env bash
UUID="breezydesktop@xronlinux.com"
# fail on error
set -e
# https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
SRC_DIR="$SCRIPT_DIR/../src"
TMP_DIR=$(mktemp -d -t breezy-gnome-XXXXXXXXXX)
DEST_DIR="$TMP_DIR/$UUID"
OUT_DIR="$SCRIPT_DIR/../out"
rm -rf "$OUT_DIR"
cd "$SCRIPT_DIR" || exit 1
check_command() {
if ! command -v "$1" &>/dev/null; then
echo "Please install \"$1\" and make sure it's available in your \$PATH"
exit 1
fi
}
compile_schemas() {
check_command "glib-compile-schemas"
mkdir -p "$DEST_DIR/schemas/"
# the pack command also compiles the schemas but only into the zip file
glib-compile-schemas --targetdir="$DEST_DIR/schemas" "$SRC_DIR/schemas/"
}
copy_static_files() {
# Copy non generated files to destdir
cp $SRC_DIR/*.js $DEST_DIR/
cp $SRC_DIR/*.frag $DEST_DIR/
mkdir -p "$DEST_DIR/schemas/"
cp $SRC_DIR/schemas/*.xml $DEST_DIR/schemas/
mkdir -p $DEST_DIR/dbus-interfaces/
cp $SRC_DIR/dbus-interfaces/*.xml $DEST_DIR/dbus-interfaces/
mkdir -p $DEST_DIR/textures/
cp -rL $SRC_DIR/textures/* $DEST_DIR/textures/
cp $SRC_DIR/metadata.json $DEST_DIR/
}
pack() {
check_command "gnome-extensions"
# pack everything into a sharable zip file
extra_source=()
for file in "$DEST_DIR"/*; do
extra_source+=("--extra-source=$file")
done
mkdir -p "$OUT_DIR"
gnome-extensions pack --force "${extra_source[@]}" "$DEST_DIR" -o "$OUT_DIR"
}
if [ $# -eq 0 ]; then
# No arguments, do everything
compile_schemas
copy_static_files
pack
elif [ "$1" == "build_local" ]; then
compile_schemas
copy_static_files
elif [ "$1" == "pack" ]; then
pack
elif [ "$1" == "copy_static" ]; then
copy_static_files
fi
rm -rf "$TMP_DIR"

View File

@ -1,184 +0,0 @@
#!/usr/bin/env bash
set -e
check_command() {
for cmd in "$@"; do
if command -v "$cmd" &>/dev/null; then
return
fi
done
echo "Please install one of the following: ${*}, and make sure it's available in your \$PATH, then rerun the setup."
exit 1
}
check_command "gnome-extensions"
check_command "glib-compile-schemas"
check_command "update-desktop-database"
check_command "gtk-update-icon-cache"
check_command "python" "python3"
PYTHON_GI_CHECK="import gi; gi.require_version('Gtk', '4.0'); gi.require_version('Adw', '1'); gi.require_version('Gio', '2.0'); gi.require_version('GLib', '2.0'); gi.require_version('GObject', '2.0'); gi.require_version('Gst', '1.0'); from gi.repository import Gtk, Adw, Gio, GLib, GObject, Gst"
if ! { python3 -c "$PYTHON_GI_CHECK" 2>/dev/null || python -c "$PYTHON_GI_CHECK" 2>/dev/null; }; then
if [ -z "$BREEZY_IGNORE_PYTHON_ERRORS" ]; then
printf "\033[1;31mERROR:\033[0m Python GObject libraries are missing\n"
printf "Please install the required Python GObject dependencies: GTK4, libadwaita, and GStreamer libraries:\n"
printf "If you're using a Python installation from a package manager, you may need to install the following packages:\n"
printf "\tFor Debian/Ubuntu: sudo apt install python3-gi gir1.2-gtk-4.0 libadwaita-1-0 gir1.2-adw-1 gir1.2-glib-2.0 gir1.2-gobject-2.0 gir1.2-gstreamer-1.0\n"
printf "\tFor Fedora: sudo dnf install python3-gobject python3-gstreamer1 gtk4 libadwaita\n"
printf "\tFor Arch Linux: sudo pacman -S python-gobject gst-python gtk4 libadwaita\n"
printf "\nIf you continue to have issues, rerun the setup with BREEZY_IGNORE_PYTHON_ERRORS=1 to skip this check.\n\n"
exit 1
else
printf "\033[1;33mWARNING:\033[0m Ignoring Python dependency failures. "
printf "Be aware that the Breezy Desktop UI application may fail to launch.\n\n"
fi
fi
gst_pipewire_found=0
if command -v dpkg >/dev/null 2>&1; then
# Debian/Ubuntu
gst_pipewire_found=$(dpkg -l | grep -c "gstreamer1.0-pipewire")
elif command -v pacman >/dev/null 2>&1; then
# Arch Linux
gst_pipewire_found=$(pacman -Qq gst-plugin-pipewire 2>/dev/null | wc -l)
elif command -v rpm >/dev/null 2>&1; then
# RPM-based (Fedora, RHEL, openSUSE, etc.)
gst_pipewire_found=$((rpm -q pipewire-gstreamer &>/dev/null && echo "found") | wc -l)
fi
if [ "$gst_pipewire_found" -eq 0 ]; then
if [ -z "$BREEZY_IGNORE_GST_ERRORS" ]; then
printf "\033[1;31mERROR:\033[0m Pipewire GStreamer plugin not found\n"
printf "Please install the required Pipewire GStreamer plugin:\n"
printf "\tFor Debian/Ubuntu: sudo apt install gstreamer1.0-pipewire\n"
printf "\tFor Fedora: sudo dnf install pipewire-gstreamer\n"
printf "\tFor Arch Linux: sudo pacman -S gst-plugin-pipewire\n"
printf "\nIf you continue to have issues, rerun the setup with BREEZY_IGNORE_GST_ERRORS=1 to skip this check.\n\n"
exit 1
else
printf "\033[1;33mWARNING:\033[0m Ignoring GStreamer dependency failures. "
printf "Be aware that virtual display functionality may be disabled.\n\n"
fi
fi
if [ "$XDG_SESSION_TYPE" != "wayland" ]; then
printf "\033[1;33mWARNING:\033[0m Windowing system is %s\n" "$XDG_SESSION_TYPE"
printf "\033[1;33mWARNING:\033[0m Virtual display functionality requires GNOME on Wayland\n"
fi
# Check the actual dependencies used by the UI for virtual displays.
if command -v gdbus &>/dev/null; then
if ! gdbus call --session \
--dest org.gnome.Mutter.ScreenCast \
--object-path /org/gnome/Mutter/ScreenCast \
--method org.freedesktop.DBus.Introspectable.Introspect &>/dev/null; then
printf "\033[1;33mWARNING:\033[0m org.gnome.Mutter.ScreenCast D-Bus API not available on the session bus\n"
printf "\033[1;33mWARNING:\033[0m Virtual display requires GNOME/Mutter with ScreenCast support\n"
fi
else
printf "\033[1;33mWARNING:\033[0m Cannot check Mutter ScreenCast API (missing gdbus)\n"
printf "\033[1;33mWARNING:\033[0m Install GLib tools (gdbus) to enable this check\n"
fi
# This script gets packaged with the release and should do the bulk of the setup work. This allows this setup to be tied
# to a specific release of the code, and guarantees it will never run along-side newer or older binaries.
USER_HOME=$(realpath ~)
if [ -z "$XDG_DATA_HOME" ]; then
XDG_DATA_HOME="$USER_HOME/.local/share"
fi
XR_DRIVER_DATA_DIR="$XDG_DATA_HOME/xr_driver"
GNOME_SHELL_DATA_DIR="$XDG_DATA_HOME/gnome-shell"
BREEZY_GNOME_DATA_DIR="$XDG_DATA_HOME/breezy_gnome"
if [ -z "$XDG_BIN_HOME" ]; then
XDG_BIN_HOME="$USER_HOME/.local/bin"
fi
if [ -d "$XDG_BIN_HOME" ]; then
# check ownership and permissions before doing chown and chmod
XDG_BIN_USER=$(stat -c %U $XDG_BIN_HOME)
XDG_BIN_GROUP=$(stat -c %G $XDG_BIN_HOME)
USER=$(whoami)
GROUP=$(id -gn)
if [ "$XDG_BIN_USER" != "$USER" ] || [ "$XDG_BIN_GROUP" != "$GROUP" ]; then
echo "Fixing ownership and permissions of $XDG_BIN_HOME"
sudo chown -R $USER:$GROUP $XDG_BIN_HOME
sudo chmod -R 700 $XDG_BIN_HOME
fi
fi
UA_EVENT_NAME="breezy_gnome_install"
if [ -e "$XDG_BIN_HOME/breezy_gnome_uninstall" ]; then
echo "Cleaning up the previous installation"
# ` || true` will ensure that this can't cause a failure, even with `set -e`
$XDG_BIN_HOME/breezy_gnome_uninstall --for-install || true
UA_EVENT_NAME="breezy_gnome_update"
fi
UA_CLIENT_ID="BreezyGNOME"
UA_EVENT_VERSION="$1"
#INJECT_UA_CALL
# escaping sed replace: https://stackoverflow.com/questions/407523/escape-a-string-for-a-sed-replace-pattern
ESCAPED_XDG_BIN_HOME=$(printf '%s\n' "$XDG_BIN_HOME" | sed -e 's/[\/&]/\\&/g')
ESCAPED_BREEZY_GNOME_DATA_DIR=$(printf '%s\n' "$BREEZY_GNOME_DATA_DIR" | sed -e 's/[\/&]/\\&/g')
ESCAPED_XR_DRIVER_DATA_DIR=$(printf '%s\n' "$XR_DRIVER_DATA_DIR" | sed -e 's/[\/&]/\\&/g')
ESCAPED_GNOME_SHELL_DATA_DIR=$(printf '%s\n' "$GNOME_SHELL_DATA_DIR" | sed -e 's/[\/&]/\\&/g')
echo "Copying the breezy_gnome scripts to ${XDG_BIN_HOME}"
mkdir -p $XDG_BIN_HOME
cp bin/breezy_gnome_uninstall $XDG_BIN_HOME
cp bin/breezy_gnome_logs $XDG_BIN_HOME
sed -i -e "s/{bin_dir}/$ESCAPED_XDG_BIN_HOME/g" \
-e "s/{data_dir}/$ESCAPED_BREEZY_GNOME_DATA_DIR/g" \
-e "s/{xr_driver_data_dir}/$ESCAPED_XR_DRIVER_DATA_DIR/g" \
-e "s/{gnome_shell_data_dir}/$ESCAPED_GNOME_SHELL_DATA_DIR/g" \
bin/breezy_gnome_verify
cp bin/breezy_gnome_verify $XDG_BIN_HOME
echo "Copying the manifest file to ${BREEZY_GNOME_DATA_DIR}"
mkdir -p "$BREEZY_GNOME_DATA_DIR"
cp manifest "$BREEZY_GNOME_DATA_DIR/manifest"
echo "Installing the breezydesktop@xronlinux.com GNOME extension"
gnome-extensions install --force breezydesktop@xronlinux.com.shell-extension.zip
echo "Installing the Breezy Desktop UI application"
cp -r breezy_ui/data/* $XDG_DATA_HOME
cp -r breezy_ui/bin/* $XDG_BIN_HOME
# update copied files to use the local XDG paths
ESCAPED_XDG_DATA_HOME=$(printf '%s\n' "$XDG_DATA_HOME" | sed -e 's/[\/&]/\\&/g')
sed -i -e "s/\/usr\/local\/share/$ESCAPED_XDG_DATA_HOME/g" $XDG_BIN_HOME/breezydesktop
sed -i "/Exec/c\Exec=$XDG_BIN_HOME/breezydesktop" $XDG_DATA_HOME/applications/com.xronlinux.BreezyDesktop.desktop
glib-compile-schemas $XDG_DATA_HOME/glib-2.0/schemas
update-desktop-database $XDG_DATA_HOME/applications
gtk-update-icon-cache
# refresh bash session so new commands in the PATH are available
hash -r
# set up the XR driver using the local binary
echo "Installing xrDriver"
echo "BEGIN - xr_driver_setup"
if [ -z "$1" ]
then
sudo --preserve-env=SKIP_SYSTEMD bin/xr_driver_setup $(pwd)
else
sudo --preserve-env=SKIP_SYSTEMD bin/xr_driver_setup -v $1 $(pwd)
fi
echo "END - xr_driver_setup"
echo "Setting up productivity features"
printf "request_features=productivity,productivity_pro\n" >> /dev/shm/xr_driver_control 2>/dev/null || true

View File

@ -1 +0,0 @@
../../modules/sombrero/Sombrero.frag

View File

@ -1,67 +0,0 @@
// Taken from https://github.com/jkitching/soft-brightness-plus
//
// Copyright (C) 2023 Joel Kitching (jkitching on Github)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import Clutter from 'gi://Clutter';
import GObject from 'gi://GObject';
// Copied almost verbatim from ui/magnifier.js.
export const MouseSpriteContent = GObject.registerClass({
Implements: [Clutter.Content],
}, class MouseSpriteContent extends GObject.Object {
_init() {
super._init();
this._texture = null;
}
vfunc_get_preferred_size() {
if (!this._texture)
return [false, 0, 0];
return [true, this._texture.get_width(), this._texture.get_height()];
}
vfunc_paint_content(actor, node, _paintContext) {
if (!this._texture)
return;
let [minFilter, magFilter] = actor.get_content_scaling_filters();
let textureNode = new Clutter.TextureNode(this._texture,
null, minFilter, magFilter);
textureNode.set_name('BreezyDesktopSpriteContent');
node.add_child(textureNode);
textureNode.add_rectangle(actor.get_content_box());
}
get texture() {
return this._texture;
}
set texture(coglTexture) {
if (this._texture === coglTexture)
return;
let oldTexture = this._texture;
this._texture = coglTexture;
this.invalidate();
if (!oldTexture || !coglTexture ||
oldTexture.get_width() !== coglTexture.get_width() ||
oldTexture.get_height() !== coglTexture.get_height())
this.invalidate_size();
}
});

View File

@ -1,274 +0,0 @@
import Clutter from 'gi://Clutter';
import Meta from 'gi://Meta';
import * as PointerWatcher from 'resource:///org/gnome/shell/ui/pointerWatcher.js';
import { MouseSpriteContent } from './cursor.js';
import Globals from './globals.js';
// Taken from https://github.com/jkitching/soft-brightness-plus
export class CursorManager {
constructor(targetMonitors, refreshRate) {
this._targetMonitors = targetMonitors;
this._refreshRate = refreshRate;
// Set/destroyed by _enableCloningMouse/_disableCloningMouse
this._cursorTracker = null;
this._mouseSprite = null;
this._cursorRoot = null;
this._cursorUnfocusInhibited = false;
// Set/destroyed by _startCloningMouse / _stopCloningMouse
this._cursorWatch = null;
this._cursorChangedConnection = null;
this._systemCursorShown = true;
}
enable() {
Globals.logger.log_debug('CursorManager enable');
this._enableCloningMouse();
this.startCloning();
}
disable() {
Globals.logger.log_debug('CursorManager disable');
this._disableCloningMouse();
}
startCloning() {
Globals.logger.log_debug('CursorManager startCloning');
this._startCloningMouse();
}
stopCloning() {
Globals.logger.log_debug('CursorManager stopCloning');
this._stopCloningMouse();
}
// After this:
// * real cursor is disabled
// * cloning is "on"
// * cloned cursor not visible, but ready for _startCloningMouse to make it visible
//
// okay if _startCloningMouse is not immediately called since set_pointer_visible is bound to our replacement function
// and will trigger _startCloningMouse when the cursor should be shown
_enableCloningMouse() {
Globals.logger.log_debug('CursorManager _enableCloningMouse');
this._cursorTracker = global.backend.get_cursor_tracker?.() ?? Meta.CursorTracker.get_for_display(global.display);
this._mouseSprite = new Clutter.Actor({ request_mode: Clutter.RequestMode.CONTENT_SIZE });
this._mouseSprite.content = new MouseSpriteContent();
this._cursorRoot = new Clutter.Actor();
this._cursorRoot.add_child(this._mouseSprite);
}
_backend() {
return global.stage.get_context?.().get_backend() ?? Clutter.get_default_backend();
}
_hideSystemCursor() {
this._systemCursorShown = false;
this._cursorRoot.show();
if (!this._cursorUnfocusInhibited) {
this._backend().get_default_seat().inhibit_unfocus();
this._cursorUnfocusInhibited = true;
}
if (!this._cursorVisibilityChangedId) {
if (this._cursorTracker.inhibit_cursor_visibility) {
this._cursorTracker.inhibit_cursor_visibility();
} else {
this._cursorTracker.set_pointer_visible(false);
}
this._cursorVisibilityChangedId = this._cursorTracker.connect('visibility-changed', (() => {
if (this._cursorTracker.get_pointer_visible()) {
if (this._cursorTracker.inhibit_cursor_visibility) {
this._cursorTracker.inhibit_cursor_visibility();
} else {
this._cursorTracker.set_pointer_visible(false);
}
}
}).bind(this));
}
}
// After this:
// * real cursor enabled, manages its own visibility
// * cloning is "off"
// * no cloned cursor
//
// completely reverts _enableCloningMouse
_disableCloningMouse() {
Globals.logger.log_debug('CursorManager _disableCloningMouse');
this._stopCloningMouse();
if (this._mouseSprite) {
this._mouseSprite.content = null;
if (this._cursorRoot) this._cursorRoot.remove_child(this._mouseSprite);
}
this._cursorTracker = null;
this._mouseSprite = null;
this._cursorRoot = null;
}
// After this:
// * real cursor is hidden
// * cloning is "on"
// * clone cursor is visible
//
// add the clone cursor actor, watch for pointer movement and cursor changes, reflect them in the cloned cursor
// prereqs: setup in _enableCloningMouse
_startCloningMouse() {
Globals.logger.log_debug('CursorManager _startCloningMouse');
this._updateMouseSprite();
this._cursorTracker.connectObject('cursor-changed', this._updateMouseSprite.bind(this), this);
// cap the refresh rate for performance reasons
const interval = 1000.0 / Math.min(this._refreshRate, 60);
this._cursorWatch = PointerWatcher.getPointerWatcher().addWatch(interval, this._updateMousePosition.bind(this));
this._updateMousePosition();
}
// After this:
// * real cursor is hidden
// * cloning is "on"
// * cloned cursor not visible, but ready for _startCloningMouse to make it visible
//
// completely reverts _startCloningMouse
_stopCloningMouse() {
Globals.logger.log_debug('CursorManager _stopCloningMouse');
if (this._cursorWatch != null) {
this._cursorWatch.remove();
this._cursorWatch = null;
}
if (this._cursorTracker) this._cursorTracker.disconnectObject(this);
if (this._mouseSprite?.content?.texture) this._mouseSprite.content.texture = null;
if (!this._systemCursorShown) this._showSystemCursor();
}
_showSystemCursor() {
this._systemCursorShown = true;
if (this._cursorRoot) this._cursorRoot.hide();
if (this._cursorUnfocusInhibited) {
this._backend().get_default_seat().uninhibit_unfocus();
this._cursorUnfocusInhibited = false;
}
if (this._cursorVisibilityChangedId) {
this._cursorTracker.disconnect(this._cursorVisibilityChangedId);
delete this._cursorVisibilityChangedId;
if (this._cursorTracker.uninhibit_cursor_visibility) {
this._cursorTracker.uninhibit_cursor_visibility();
} else {
this._cursorTracker.set_pointer_visible(true);
}
}
}
_updateMousePosition(...args) {
const [xMouse, yMouse] = args.length ? args : global.get_pointer();
let onMonitorIndex;
let xRel;
let yRel;
const inBoundsCheck = (monitorObj, index) => {
const inBoundsCoordinates = this._getInBoundsCoordinates(xMouse, yMouse, monitorObj.monitor);
if (inBoundsCoordinates) {
onMonitorIndex = index;
xRel = inBoundsCoordinates.xRel;
yRel = inBoundsCoordinates.yRel;
return true;
}
return false;
}
// check the previously in-bounds monitor first to avoid iterating over the whole list in the likely case that the cursor
// is still on the same monitor
if (this.onMonitorIndex === undefined || !inBoundsCheck(this._targetMonitors[this.onMonitorIndex], this.onMonitorIndex)) {
for (let i = 0; i < this._targetMonitors.length; i++) {
if (this.onMonitorIndex === i) continue;
if (inBoundsCheck(this._targetMonitors[i], i)) break;
}
}
if (this.onMonitorIndex !== onMonitorIndex) {
try {
if (this.onMonitorIndex !== undefined) this._targetMonitors[this.onMonitorIndex].actor.remove_child(this._cursorRoot);
this.onMonitorIndex = onMonitorIndex;
if (this.onMonitorIndex !== undefined) {
const actor = this._targetMonitors[this.onMonitorIndex].actor;
actor.add_child(this._cursorRoot);
actor.set_child_above_sibling(this._cursorRoot, null);
}
} catch (e) {
Globals.logger.log_debug(e);
}
}
if (this.onMonitorIndex !== undefined) {
if (this._systemCursorShown) this._hideSystemCursor();
this._cursorRoot.set_position(xRel, yRel);
} else if (!this._systemCursorShown) {
this._showSystemCursor();
}
this.xRel = xRel;
this.xRel = xRel;
const seat = this._backend().get_default_seat();
if (this._cursorUnfocusInhibited && !seat.is_unfocus_inhibited()) {
Globals.logger.log_debug('reinhibiting');
seat.inhibit_unfocus();
}
}
_updateMouseSprite() {
this._updateSpriteTexture();
let [xHot, yHot] = this._cursorTracker.get_hot();
this._mouseSprite.set({
translation_x: -xHot,
translation_y: -yHot,
});
}
_updateSpriteTexture() {
let sprite = this._cursorTracker.get_sprite();
if (sprite) {
this._mouseSprite.content.texture = sprite;
this._mouseSprite.show();
} else {
this._mouseSprite.hide();
}
}
_getInBoundsCoordinates(x, y, monitor) {
const xRel = x - monitor.x;
const yRel = y - monitor.y;
if (xRel >= 0 && xRel < monitor.width && yRel >= 0 && yRel < monitor.height) {
return {
xRel,
yRel,
}
}
return null;
}
moveCursorTo(x, y) {
this._backend().get_default_seat().warp_pointer(x, y);
}
}

View File

@ -1,453 +0,0 @@
<!DOCTYPE node PUBLIC
'-//freedesktop//DTD D-BUS Object Introspection 1.0//EN'
'http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd'>
<node>
<!--
org.gnome.Mutter.DisplayConfig:
@short_description: display configuration interface
This interface is used by mutter and gnome-settings-daemon
to apply multiple monitor configuration.
-->
<interface name="org.gnome.Mutter.DisplayConfig">
<!--
GetResources:
@serial: configuration serial
@crtcs: available CRTCs
@outputs: available outputs
@modes: available modes
@max_screen_width:
@max_screen_height:
Retrieves the current layout of the hardware.
@serial is an unique identifier representing the current state
of the screen. It must be passed back to ApplyConfiguration()
and will be increased for every configuration change (so that
mutter can detect that the new configuration is based on old
state).
A CRTC (CRT controller) is a logical monitor, ie a portion
of the compositor coordinate space. It might correspond
to multiple monitors, when in clone mode, but not that
it is possible to implement clone mode also by setting different
CRTCs to the same coordinates.
The number of CRTCs represent the maximum number of monitors
that can be set to expand and it is a HW constraint; if more
monitors are connected, then necessarily some will clone. This
is complementary to the concept of the encoder (not exposed in
the API), which groups outputs that necessarily will show the
same image (again a HW constraint).
A CRTC is represented by a DBus structure with the following
layout:
* u ID: the ID in the API of this CRTC
* x winsys_id: the low-level ID of this CRTC (which might
be a XID, a KMS handle or something entirely
different)
* i x, y, width, height: the geometry of this CRTC
(might be invalid if the CRTC is not in
use)
* i current_mode: the current mode of the CRTC, or -1 if this
CRTC is not used
Note: the size of the mode will always correspond
to the width and height of the CRTC
* u current_transform: the current transform (espressed according
to the wayland protocol)
* au transforms: all possible transforms
* a{sv} properties: other high-level properties that affect this
CRTC; they are not necessarily reflected in
the hardware.
No property is specified in this version of the API.
Note: all geometry information refers to the untransformed
display.
An output represents a physical screen, connected somewhere to
the computer. Floating connectors are not exposed in the API.
An output is a DBus struct with the following fields:
* u ID: the ID in the API
* x winsys_id: the low-level ID of this output (XID or KMS handle)
* i current_crtc: the CRTC that is currently driving this output,
or -1 if the output is disabled
* au possible_crtcs: all CRTCs that can control this output
* s name: the name of the connector to which the output is attached
(like VGA1 or HDMI)
* au modes: valid modes for this output
* au clones: valid clones for this output, ie other outputs that
can be assigned the same CRTC as this one; if you
want to mirror two outputs that don't have each other
in the clone list, you must configure two different
CRTCs for the same geometry
* a{sv} properties: other high-level properties that affect this
output; they are not necessarily reflected in
the hardware.
Known properties:
- "vendor" (s): (readonly) the human readable name
of the manufacturer
- "product" (s): (readonly) the human readable name
of the display model
- "serial" (s): (readonly) the serial number of this
particular hardware part
- "display-name" (s): (readonly) a human readable name
of this output, to be shown in the UI
- "backlight" (i): (readonly, use the specific interface)
the backlight value as a percentage
(-1 if not supported)
- "primary" (b): whether this output is primary
or not
- "presentation" (b): whether this output is
for presentation only
Note: properties might be ignored if not consistenly
applied to all outputs in the same clone group. In
general, it's expected that presentation or primary
outputs will not be cloned.
A mode represents a set of parameters that are applied to
each output, such as resolution and refresh rate. It is a separate
object so that it can be referenced by CRTCs and outputs.
Multiple outputs in the same CRTCs must all have the same mode.
A mode is exposed as:
* u ID: the ID in the API
* x winsys_id: the low-level ID of this mode
* u width, height: the resolution
* d frequency: refresh rate
* u flags: mode flags as defined in xf86drmMode.h and randr.h
Output and modes are read-only objects (except for output properties),
they can change only in accordance to HW changes (such as hotplugging
a monitor), while CRTCs can be changed with ApplyConfiguration().
XXX: actually, if you insist enough, you can add new modes
through xrandr command line or the KMS API, overriding what the
kernel driver and the EDID say.
Usually, it only matters with old cards with broken drivers, or
old monitors with broken EDIDs, but it happens more often with
projectors (if for example the kernel driver doesn't add the
640x480 - 800x600 - 1024x768 default modes). Probably something
that we need to handle in mutter anyway.
-->
<method name="GetResources">
<arg name="serial" direction="out" type="u" />
<arg name="crtcs" direction="out" type="a(uxiiiiiuaua{sv})" />
<arg name="outputs" direction="out" type="a(uxiausauaua{sv})" />
<arg name="modes" direction="out" type="a(uxuudu)" />
<arg name="max_screen_width" direction="out" type="i" />
<arg name="max_screen_height" direction="out" type="i" />
</method>
<!--
ApplyConfiguration:
@serial: configuration serial
@persistent: whether this configuration should be saved on disk
@crtcs: new data for CRTCs
@outputs: new data for outputs
Applies the requested configuration changes.
@serial must match the serial from the last GetResources() call,
or org.freedesktop.DBus.AccessDenied will be generated.
If @persistent is true, mutter will attempt to replicate this
configuration the next time this HW layout appears.
@crtcs represents the new logical configuration, as a list
of structures containing:
- u ID: the API ID from the corresponding GetResources() call
- i new_mode: the API ID of the new mode to configure the CRTC
with, or -1 if the CRTC should be disabled
- i x, y: the new coordinates of the top left corner
the geometry will be completed with the size information
from @new_mode
- u transform: the desired transform
- au outputs: the API ID of outputs that should be assigned to
this CRTC
- a{sv} properties: properties whose value should be changed
Note: CRTCs not referenced in the array will be disabled.
@outputs represent the output property changes as:
- u ID: the API ID of the output to change
- a{sv} properties: properties whose value should be changed
Note: both for CRTCs and outputs, properties not included in
the dictionary will not be changed.
Note: unrecognized properties will have no effect, but if the
configuration change succeeds the property will be reported
by the next GetResources() call, and if @persistent is true,
it will also be saved to disk.
If the configuration is invalid according to the previous
GetResources() call, for example because a CRTC references
an output it cannot drive, or not all outputs support the
chosen mode, the error org.freedesktop.DBus.InvalidArgs will
be generated.
If the configuration cannot be applied for any other reason
(eg. the screen size would exceed texture limits), the error
org.freedesktop.DBus.Error.LimitsExceeded will be generated.
-->
<method name="ApplyConfiguration">
<arg name="serial" direction="in" type="u" />
<arg name="persistent" direction="in" type="b" />
<arg name="crtcs" direction="in" type="a(uiiiuaua{sv})" />
<arg name="outputs" direction="in" type="a(ua{sv})" />
</method>
<!--
ChangeBacklight:
@serial: configuration serial
@output: the API id of the output
@value: the new backlight value
Changes the backlight of @output to @value, which is
expressed as a percentage and rounded to the HW limits.
Returns the new value after rounding.
-->
<method name="ChangeBacklight">
<arg name="serial" direction="in" type="u" />
<arg name="output" direction="in" type="u" />
<arg name="value" direction="in" type="i" />
<arg name="new_value" direction="out" type="i" />
</method>
<!--
GetCrtcGamma:
@serial: configuration serial
@crtc: API id of the crtc
@red: red gamma ramp
@green: green gamma ramp
@blue: blue gamma ramp
Requests the current gamma ramps of @crtc.
-->
<method name="GetCrtcGamma">
<arg name="serial" direction="in" type="u" />
<arg name="crtc" direction="in" type="u" />
<arg name="red" direction="out" type="aq" />
<arg name="green" direction="out" type="aq" />
<arg name="blue" direction="out" type="aq" />
</method>
<!--
SetCrtcGamma:
@serial: configuration serial
@crtc: API id of the crtc
@red: red gamma ramp
@green: green gamma ramp
@blue: blue gamma ramp
Changes the gamma ramps of @crtc.
-->
<method name="SetCrtcGamma">
<arg name="serial" direction="in" type="u" />
<arg name="crtc" direction="in" type="u" />
<arg name="red" direction="in" type="aq" />
<arg name="green" direction="in" type="aq" />
<arg name="blue" direction="in" type="aq" />
</method>
<!--
PowerSaveMode:
Contains the current power saving mode for the screen, and
allows changing it.
Possible values:
- 0: on
- 1: standby
- 2: suspend
- 3: off
- -1: unknown (unsupported)
A client should not attempt to change the powersave mode
from -1 (unknown) to any other value, and viceversa.
Note that the actual effects of the different values
depend on the hardware and the kernel driver in use, and
it's perfectly possible that all values different than on
have the same effect.
Also, setting the PowerSaveMode to 3 (off) may or may
not have the same effect as disabling all outputs by
setting no CRTC on them with ApplyConfiguration(), and
may or may not cause a configuration change.
Also note that this property might become out of date
if changed through different means (for example using the
XRandR interface directly).
-->
<property name="PowerSaveMode" type="i" access="readwrite" />
<!--
MonitorsChanged:
The signal is emitted every time the screen configuration
changes.
The client should then call GetResources() to read the new layout.
-->
<signal name="MonitorsChanged" />
<!--
GetCurrentState:
@serial: configuration serial
@monitors: available monitors
@logical_monitors: current logical monitor configuration
@properties: display configuration properties
@monitors represent connected physical monitors
* s connector: connector name (e.g. HDMI-1, DP-1, etc)
* s vendor: vendor name
* s product: product name
* s serial: product serial
* a(siiddada{sv}) modes: available modes
* s id: mode ID
* i width: width in physical pixels
* i height: height in physical pixels
* d refresh rate: refresh rate
* d preferred scale: scale preferred as per calculations
* ad supported scales: scales supported by this mode
* a{sv} properties: optional properties, including:
- "is-current" (b): the mode is currently active mode
- "is-preferred" (b): the mode is the preferred mode
- "is-interlaced" (b): the mode is an interlaced mode
* a{sv} properties: optional properties, including:
- "width-mm" (i): physical width of monitor in millimeters
- "height-mm" (i): physical height of monitor in millimeters
- "is-underscanning" (b): whether underscanning is enabled
(absence of this means underscanning
not being supported)
- "max-screen-size" (ii): the maximum size a screen may have
(absence of this means unlimited screen
size)
- "is-builtin" (b): whether the monitor is built in, e.g. a
laptop panel (absence of this means it is
not built in)
- "display-name" (s): a human readable display name of the monitor
Possible mode flags:
1 : preferred mode
2 : current mode
@logical_monitors represent current logical monitor configuration
* i x: x position
* i y: y position
* d scale: scale
* u transform: transform (see below)
* b primary: true if this is the primary logical monitor
* a(sss) monitors: monitors displaying this logical monitor
* connector: name of the connector (e.g. DP-1, eDP-1 etc)
* vendor: vendor name
* product: product name
* serial: product serial
* a{sv} properties: possibly other properties
Posisble transform values:
0: normal
1: 90°
2: 180°
3: 270°
4: flipped
5: 90° flipped
6: 180° flipped
7: 270° flipped
@layout_mode current layout mode represents the way logical monitors
are layed out on the screen. Possible modes include:
1 : physical
2 : logical
With physical layout mode, each logical monitor has the same dimensions
as the monitor modes of the associated monitors assigned to it, no
matter what scale is in use.
With logical mode, the dimension of a logical monitor is the dimension
of the monitor mode, divided by the logical monitor scale.
Possible @properties are:
* "supports-mirroring" (b): FALSE if mirroring not supported; TRUE or not
present if mirroring is supported.
* "layout-mode" (u): Represents in what way logical monitors are laid
out on the screen. The layout mode can be either
of the ones listed below. Absence of this property
means the layout mode cannot be changed, and that
"logical" mode is assumed to be used.
* 1 : logical - the dimension of a logical monitor is derived from
the monitor modes associated with it, then scaled
using the logical monitor scale.
* 2 : physical - the dimension of a logical monitor is derived from
the monitor modes associated with it.
* "supports-changing-layout-mode" (b): True if the layout mode can be
changed. Absence of this means the
layout mode cannot be changed.
* "global-scale-required" (b): True if all the logical monitors must
always use the same scale. Absence of
this means logical monitor scales can
differ.
* "legacy-ui-scaling-factor" (i): The legacy scaling factor traditionally
used to scale X11 clients (commonly
communicated via the
Gdk/WindowScalingFactor XSetting entry).
-->
<method name="GetCurrentState">
<arg name="serial" direction="out" type="u" />
<arg name="monitors" direction="out" type="a((ssss)a(siiddada{sv})a{sv})" />
<arg name="logical_monitors" direction="out" type="a(iiduba(ssss)a{sv})" />
<arg name="properties" direction="out" type="a{sv}" />
</method>
<!--
ApplyMonitorsConfig:
@serial: configuration serial
@method: configuration method
@logical_monitors: monitors configuration
@properties: properties
@method represents the way the configuration should be handled.
Possible methods:
0: verify
1: temporary
2: persistent
@logical_monitors consists of a list of logical monitor configurations.
Each logical monitor configuration consists of:
* i: layout x position
* i: layout y position
* d: scale
* u: transform (see GetCurrentState)
* b primary: true if this is the primary logical monitor
* a(ssa{sv}): a list of monitors, each consisting of:
* s: connector
* s: monitor mode ID
* a{sv}: monitor properties, including:
- "enable_underscanning" (b): enable monitor underscanning;
may only be set when underscanning
is supported (see GetCurrentState).
@properties may effect the global monitor configuration state. Possible
properties are:
* "layout-mode" (u): layout mode the passed configuration is in; may
only be set when changing the layout mode is
supported (see GetCurrentState).
-->
<method name="ApplyMonitorsConfig">
<arg name="serial" direction="in" type="u" />
<arg name="method" direction="in" type="u" />
<arg name="logical_monitors" direction="in" type="a(iiduba(ssa{sv}))" />
<arg name="properties" direction="in" type="a{sv}" />
</method>
</interface>
</node>

View File

@ -1,343 +0,0 @@
import Gio from 'gi://Gio';
import GObject from 'gi://GObject';
import Globals from './globals.js';
import {
dataViewEnd,
dataViewUint8,
dataViewBigUint,
dataViewUint32Array,
dataViewUint8Array,
dataViewFloat,
dataViewFloatArray,
BOOL_SIZE,
FLOAT_SIZE,
UINT_SIZE,
UINT8_SIZE
} from "./ipc.js";
import { isValidKeepAlive, getEpochSec, toSec } from "./time.js";
const IPC_FILE_PATH = "/dev/shm/breezy_desktop_imu";
const KEEPALIVE_REFRESH_INTERVAL_SEC = 1;
// the driver should be using the same data layout version
const DATA_LAYOUT_VERSION = 5;
// DataView info: [offset, size, count]
const VERSION = [0, UINT8_SIZE, 1];
const ENABLED = [dataViewEnd(VERSION), BOOL_SIZE, 1];
const LOOK_AHEAD_CFG = [dataViewEnd(ENABLED), FLOAT_SIZE, 4];
const DISPLAY_RES = [dataViewEnd(LOOK_AHEAD_CFG), UINT_SIZE, 2];
const DISPLAY_FOV = [dataViewEnd(DISPLAY_RES), FLOAT_SIZE, 1];
const LENS_DISTANCE_RATIO = [dataViewEnd(DISPLAY_FOV), FLOAT_SIZE, 1];
const SBS_ENABLED = [dataViewEnd(LENS_DISTANCE_RATIO), BOOL_SIZE, 1];
const CUSTOM_BANNER_ENABLED = [dataViewEnd(SBS_ENABLED), BOOL_SIZE, 1];
const SMOOTH_FOLLOW_ENABLED = [dataViewEnd(CUSTOM_BANNER_ENABLED), BOOL_SIZE, 1];
const SMOOTH_FOLLOW_ORIGIN_DATA = [dataViewEnd(SMOOTH_FOLLOW_ENABLED), FLOAT_SIZE, 16];
const POSE_POSITION = [dataViewEnd(SMOOTH_FOLLOW_ORIGIN_DATA), FLOAT_SIZE, 3];
const EPOCH_MS = [dataViewEnd(POSE_POSITION), UINT_SIZE, 2];
const POSE_ORIENTATION = [dataViewEnd(EPOCH_MS), FLOAT_SIZE, 16];
const IMU_PARITY_BYTE = [dataViewEnd(POSE_ORIENTATION), UINT8_SIZE, 1];
const DATA_VIEW_LENGTH = dataViewEnd(IMU_PARITY_BYTE);
function checkParityByte(dataView) {
const parityByte = dataViewUint8(dataView, IMU_PARITY_BYTE);
let parity = 0;
const epochUint8 = dataViewUint8Array(dataView, EPOCH_MS);
const imuDataUint8 = dataViewUint8Array(dataView, POSE_ORIENTATION);
for (let i = 0; i < epochUint8.length; i++) {
parity ^= epochUint8[i];
}
for (let i = 0; i < imuDataUint8.length; i++) {
parity ^= imuDataUint8[i];
}
return parityByte === parity;
}
const COUNTER_MAX = 300;
function nextDebugIMUQuaternion(counter) {
const angle = counter / COUNTER_MAX * 2 * Math.PI;
const yaw = 10 * Math.PI / 180 * Math.cos(angle);
const roll = 0;
const pitch = 10 * Math.PI / 180 * Math.sin(angle);
const cy = Math.cos(yaw * 0.5);
const sy = Math.sin(yaw * 0.5);
const cp = Math.cos(pitch * 0.5);
const sp = Math.sin(pitch * 0.5);
const cr = Math.cos(roll * 0.5);
const sr = Math.sin(roll * 0.5);
const w = cr * cp * cy + sr * sp * sy;
const x = sr * cp * cy - cr * sp * sy;
const y = cr * sp * cy + sr * cp * sy;
const z = cr * cp * sy - sr * sp * cy;
return [x, y, z, w];
}
export const DeviceDataStream = GObject.registerClass({
Properties: {
'breezy-desktop-running': GObject.ParamSpec.boolean(
'breezy-desktop-running',
'Breezy Desktop running',
'Whether Breezy Desktop mode is enabled in xr_driver and supported glasses are connected',
GObject.ParamFlags.READWRITE,
false
),
'widescreen-mode-state': GObject.ParamSpec.boolean(
'widescreen-mode-state',
'Widescreen mode state',
'The state of widescreen mode from the perspective of the driver',
GObject.ParamFlags.READWRITE,
false
),
'imu-snapshots': GObject.ParamSpec.jsobject(
'imu-snapshots',
'IMU Snapshots',
'Latest IMU quaternion snapshots and epoch timestamp for when it was collected',
GObject.ParamFlags.READWRITE
),
'smooth-follow-enabled': GObject.ParamSpec.boolean(
'smooth-follow-enabled',
'Smooth follow enabled',
'Whether smooth follow is enabled',
GObject.ParamFlags.READWRITE,
false
),
'show-banner': GObject.ParamSpec.boolean(
'show-banner',
'Show banner',
'Whether the banner should be displayed',
GObject.ParamFlags.READWRITE,
false
),
'custom-banner-enabled': GObject.ParamSpec.boolean(
'custom-banner-enabled',
'Custom banner enabled',
'Whether the custom banner should be displayed',
GObject.ParamFlags.READWRITE,
false
),
'legacy-follow-mode': GObject.ParamSpec.boolean(
'legacy-follow-mode',
'Legacy follow mode',
'Whether the legacy follow mode is enabled',
GObject.ParamFlags.READWRITE,
false
),
'debug-no-device': GObject.ParamSpec.boolean(
'debug-no-device',
'Debug without device',
'Debug mode that allows for testing with moving IMU values without a device connected',
GObject.ParamFlags.READWRITE,
false
)
}
}, class DeviceDataStream extends GObject.Object {
constructor(params = {}) {
super(params);
// this may be set true if debug_no_device is set, so it doesn't mean a device is actually connected
this.breezy_desktop_running = false;
// use this property to set whether breezy is being operated by a real device
this.breezy_desktop_actually_running = false;
this._ipc_file = Gio.file_new_for_path(IPC_FILE_PATH);
this._running = false;
this.device_data = null;
}
start() {
this._running = true;
this._poll();
}
stop() {
this._running = false;
this.device_data = null;
this.imu_snapshots = null;
}
// polling is just intended to keep breezy_desktop_running current, anything needing up-to-date imu data should
// trigger a refresh with the default flag
_poll() {
if (this._running) {
this.refresh_data(true);
setTimeout(this._poll.bind(this), 1000);
}
}
_ipc_file_exists() {
if (!this._ipc_file_exists_cached) this._ipc_file_exists_cached = this._ipc_file.query_exists(null);
return this._ipc_file_exists_cached;
}
// Refresh the data from the IPC file. if keepalive_only is true, we'll only check and update breezy_desktop_running if it
// hasn't been checked within KEEPALIVE_REFRESH_INTERVAL_SEC.
refresh_data(keepalive_only = false) {
if (!this.debug_no_device && this.was_debug_no_device) {
this.was_debug_no_device = false;
if (!this.breezy_desktop_actually_running) {
this.device_data = null;
this.breezy_desktop_running = false;
this.breezy_desktop_actually_running = false;
this.imu_snapshots = null;
}
}
if (this._ipc_file_exists() && (
!this.device_data?.imuData ||
!keepalive_only ||
getEpochSec() - toSec(this.device_data?.imuDateMs ?? 0) > KEEPALIVE_REFRESH_INTERVAL_SEC
)) {
let data;
let data_success = false;
try {
data = this._ipc_file.load_contents(null);
data_success = data[0];
} catch (e) {
Globals.logger.log_debug(`Error loading contents from IPC file: ${e.message}\n${e.stack}`);
}
if (data_success) {
let buffer = new Uint8Array(data[1]).buffer;
let dataView = new DataView(buffer);
if (dataView.byteLength === DATA_VIEW_LENGTH) {
let imuDateMs = dataViewBigUint(dataView, EPOCH_MS);
const displayFov = dataViewFloat(dataView, DISPLAY_FOV);
const validKeepAlive = isValidKeepAlive(toSec(imuDateMs));
const validData = validKeepAlive && displayFov !== 0.0;
const version = dataViewUint8(dataView, VERSION);
const enabled = dataViewUint8(dataView, ENABLED) !== 0 && version === DATA_LAYOUT_VERSION && validData;
let poseOrientation = dataViewFloatArray(dataView, POSE_ORIENTATION);
let posePosition = dataViewFloatArray(dataView, POSE_POSITION);
let smoothFollowEnabled = !this.legacy_follow_mode && dataViewUint8(dataView, SMOOTH_FOLLOW_ENABLED) !== 0;
let smoothFollowOrigin = dataViewFloatArray(dataView, SMOOTH_FOLLOW_ORIGIN_DATA);
const imuResetState = enabled && validData && poseOrientation[0] === 0.0 && poseOrientation[1] === 0.0 && poseOrientation[2] === 0.0 && poseOrientation[3] === 1.0;
const customBannerEnabled = dataViewUint8(dataView, CUSTOM_BANNER_ENABLED) !== 0;
const sbsEnabled = dataViewUint8(dataView, SBS_ENABLED) !== 0;
if (validKeepAlive && !validData) Globals.logger.log('[ERROR] Received invalid device data');
// trigger "notify::" events for properties we want to check on every cycle
if (enabled && this.widescreen_mode_state !== sbsEnabled) this.widescreen_mode_state = sbsEnabled;
if (this.show_banner !== imuResetState) this.show_banner = imuResetState;
if (this.custom_banner_enabled !== customBannerEnabled) this.custom_banner_enabled = customBannerEnabled;
let success = keepalive_only;
if (validData) {
if (!this.device_data) {
this.device_data = {
version,
enabled,
imuResetState,
displayRes: dataViewUint32Array(dataView, DISPLAY_RES),
sbsEnabled,
displayFov,
lookAheadCfg: dataViewFloatArray(dataView, LOOK_AHEAD_CFG),
lensDistanceRatio: dataViewFloat(dataView, LENS_DISTANCE_RATIO)
};
} else if (keepalive_only) {
this.device_data = {
...this.device_data,
imuResetState,
enabled,
sbsEnabled
}
}
if (smoothFollowEnabled !== this.smooth_follow_enabled) {
Globals.logger.log_debug(`Smooth follow enabled: ${smoothFollowEnabled}`);
this.smooth_follow_enabled = smoothFollowEnabled;
}
this.imu_snapshots = {
...(this.imu_snapshots ?? {}),
smooth_follow_origin: smoothFollowOrigin
}
let attempts = 0;
while (!success && attempts < 2) {
if (dataView.byteLength === DATA_VIEW_LENGTH) {
if (checkParityByte(dataView)) {
this.imu_snapshots = {
pose_orientation: poseOrientation,
pose_position: posePosition,
timestamp_ms: imuDateMs,
smooth_follow_origin: smoothFollowOrigin
};
success = true;
}
} else if (dataView.byteLength !== 0) {
Globals.logger.log(`[ERROR] Invalid dataView.byteLength: ${dataView.byteLength} !== ${DATA_VIEW_LENGTH}`)
}
if (!success && ++attempts < 2) {
data = this._ipc_file.load_contents(null);
if (data[0]) {
buffer = new Uint8Array(data[1]).buffer;
dataView = new DataView(buffer);
imuDateMs = dataViewBigUint(dataView, EPOCH_MS);
poseOrientation = dataViewFloatArray(dataView, POSE_ORIENTATION);
posePosition = dataViewFloatArray(dataView, POSE_POSITION);
}
}
}
}
this.breezy_desktop_actually_running = success && enabled && validData;
} else {
this.breezy_desktop_actually_running = false;
}
} else {
this._ipc_file_exists_cached = false;
this.breezy_desktop_actually_running = false;
}
}
if (this.debug_no_device && !this.breezy_desktop_actually_running) {
if (!this.device_data || !this.was_debug_no_device) {
this.device_data = {
version: 1.0,
enabled: true,
imuResetState: false,
displayRes: [1920.0, 1080.0],
sbsEnabled: false,
displayFov: 46.0,
lookAheadCfg: [0.0, 0.0, 0.0, 0.0],
lensDistanceRatio: 0.05
}
}
this.was_debug_no_device = true;
if (!keepalive_only) {
this._counter = ((this._counter ?? -1)+1)%COUNTER_MAX;
const poseOrientationFirst = nextDebugIMUQuaternion(this._counter);
const poseOrientation = [
...poseOrientationFirst,
...poseOrientationFirst,
...poseOrientationFirst,
2.0, 1.0, 0.0, 0.0
]
const posePosition = [0.0, 0.0, 0.0];
this.imu_snapshots = {
pose_orientation: poseOrientation,
pose_position: posePosition,
timestamp_ms: Date.now(),
smooth_follow_origin: [0.0, 0.0, 0.0, 1.0]
};
}
this.breezy_desktop_running = true;
} else if (this.breezy_desktop_running !== this.breezy_desktop_actually_running) {
// update the breezy_desktop_running property if the state changes to trigger "notify::" events
this.breezy_desktop_running = this.breezy_desktop_actually_running;
if (!this.breezy_desktop_running && keepalive_only) {
this.device_data = null;
this.imu_snapshots = null;
}
}
}
});

View File

@ -1,748 +0,0 @@
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import Meta from 'gi://Meta';
import Shell from 'gi://Shell';
import St from 'gi://St';
import { CursorManager } from './cursormanager.js';
import { DeviceDataStream } from './devicedatastream.js';
import Globals from './globals.js';
import { Logger } from './logger.js';
import { MonitorManager, NESTED_MONITOR_PRODUCT, SUPPORTED_MONITOR_PRODUCTS, VIRTUAL_MONITOR_PRODUCT } from './monitormanager.js';
import { VirtualDisplaysActor } from './virtualdisplaysactor.js';
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
const BIN_HOME = GLib.getenv('XDG_BIN_HOME') || GLib.build_filenamev([GLib.get_home_dir(), '.local', 'bin']);
const XDG_CLI_PATH = GLib.build_filenamev([BIN_HOME, 'xr_driver_cli']);
const ALT_CLI_PATH = '/usr/bin/xr_driver_cli';
export default class BreezyDesktopExtension extends Extension {
constructor(metadata, uuid) {
super(metadata, uuid);
this.settings = this.getSettings();
// Set/destroyed by enable/disable
this._cursor_manager = null;
this._monitor_manager = null;
this._virtual_displays_actor = null;
this._virtual_displays_overlay = null;
this._target_monitor = null;
this._is_effect_running = false;
this._effect_settings_bindings = [];
this._data_stream_bindings = [];
this._show_banner_connection = null;
this._distance_connection = null;
this._display_size_connection = null;
this._focused_monitor_distance_connection = null;
this._follow_threshold_connection = null;
this._breezy_desktop_running_connection = null;
this._state_poll_timeout = null;
this._pose_has_position = null;
// "fresh" means the effect hasn't been enabled since breezy-desktop-running became true
this._fresh_session = true;
if (!Globals.logger) {
Globals.logger = new Logger({
title: 'breezydesktop',
debug: this.settings.get_boolean('debug')
});
Globals.logger.logVersion();
}
if (!Globals.data_stream) {
Globals.data_stream = new DeviceDataStream({
debug_no_device: this.settings.get_boolean('debug-no-device')
});
}
}
enable() {
Globals.logger.log_debug('BreezyDesktopExtension enable');
try {
Globals.extension_dir = this.path;
// safe to request on each load, acts as a no-op if already present
this._write_control('request_features', 'productivity,productivity_pro');
Globals.data_stream.start();
this._monitor_manager = new MonitorManager({
use_optimal_monitor_config: this.settings.get_boolean('use-optimal-monitor-config'),
headset_as_primary: this.settings.get_boolean('headset-as-primary'),
use_highest_refresh_rate: this.settings.get_boolean('use-highest-refresh-rate'),
disable_physical_displays: this.settings.get_boolean('disable-physical-displays'),
extension_path: this.path
});
this._monitor_manager.setChangeHook(this._handle_monitor_change.bind(this));
this._monitor_manager.enable();
this.settings.bind('debug', Globals.logger, 'debug', Gio.SettingsBindFlags.DEFAULT);
this.settings.bind('use-optimal-monitor-config',this._monitor_manager, 'use-optimal-monitor-config', Gio.SettingsBindFlags.DEFAULT);
this.settings.bind('headset-as-primary', this._monitor_manager, 'headset-as-primary', Gio.SettingsBindFlags.DEFAULT);
this.settings.bind('disable-physical-displays', this._monitor_manager, 'disable-physical-displays', Gio.SettingsBindFlags.DEFAULT);
this.settings.bind('legacy-follow-mode', Globals.data_stream, 'legacy-follow-mode', Gio.SettingsBindFlags.DEFAULT);
this.settings.bind('debug-no-device', Globals.data_stream, 'debug-no-device', Gio.SettingsBindFlags.DEFAULT);
this._breezy_desktop_running_connection = Globals.data_stream.connect('notify::breezy-desktop-running',
this._handle_breezy_desktop_running_change.bind(this));
this._cli_file = Gio.file_new_for_path(XDG_CLI_PATH);
if (!this._cli_file.query_exists(null)) {
this._cli_file = Gio.file_new_for_path(ALT_CLI_PATH);
if (!this._cli_file.query_exists(null)) {
this._cli_file = null;
Globals.logger.log('[ERROR] BreezyDesktopExtension enable - xr_driver_cli not found');
}
}
this._add_settings_keybinding('toggle-xr-effect-shortcut', this._toggle_xr_effect.bind(this));
this._setup();
} catch (e) {
Globals.logger.log(`[ERROR] BreezyDesktopExtension enable ${e.message}\n${e.stack}`);
}
}
_find_virtual_monitors() {
try {
Globals.logger.log_debug('BreezyDesktopExtension _find_virtual_monitors');
const virtual_monitors = this._monitor_manager.getMonitorPropertiesList()?.filter(
monitor => monitor && monitor.product === VIRTUAL_MONITOR_PRODUCT);
if (virtual_monitors.length > 0) {
Globals.logger.log(`Found ${virtual_monitors.length} virtual monitors`);
return virtual_monitors.map(monitor => {
return this._monitor_manager.getMonitors()[monitor.index];
});
}
Globals.logger.log_debug('BreezyDesktopExtension _find_virtual_monitors - No virtual monitors found');
} catch (e) {
Globals.logger.log(`[ERROR] BreezyDesktopExtension _find_virtual_monitors ${e.message}\n${e.stack}`)
}
return [];
}
_find_supported_monitor() {
if (!this._monitor_manager.getMonitorPropertiesList()) return null;
try {
Globals.logger.log_debug('BreezyDesktopExtension _find_supported_monitor');
let target_monitor = this._monitor_manager.getMonitorPropertiesList()?.find(
monitor => monitor && (SUPPORTED_MONITOR_PRODUCTS.includes(monitor.product) ||
this.settings.get_string('custom-monitor-product') === monitor.product));
let is_dummy = target_monitor?.product === NESTED_MONITOR_PRODUCT;
if (target_monitor === undefined && this.settings.get_boolean('developer-mode')) {
Globals.logger.log_debug('BreezyDesktopExtension _find_supported_monitor - Using dummy monitor');
// find the first of the physical monitors
target_monitor = this._monitor_manager.getMonitorPropertiesList()?.find(
monitor => monitor && monitor.product !== VIRTUAL_MONITOR_PRODUCT) ||
this._monitor_manager.getMonitorPropertiesList()?.[0];
is_dummy = true;
}
if (target_monitor !== undefined) {
Globals.logger.log(`Identified supported monitor: ${target_monitor.product} on ${target_monitor.connector}`);
return {
monitor: this._monitor_manager.getMonitors()[target_monitor.index],
connector: target_monitor.connector,
refreshRate: target_monitor.refreshRate,
is_dummy: is_dummy,
is_virtual: target_monitor.product === VIRTUAL_MONITOR_PRODUCT
};
}
Globals.logger.log_debug('BreezyDesktopExtension _find_supported_monitor - No supported monitor found');
return null;
} catch (e) {
Globals.logger.log(`[ERROR] BreezyDesktopExtension _find_supported_monitor ${e.message}\n${e.stack}`);
return null;
}
}
// Assumes target_monitor is set, and was returned by _find_supported_monitor.
// A false result means we'll expect _handle_monitor_change to be triggered
_target_monitor_ready(target_monitor) {
if (target_monitor.is_dummy) return true;
const needs_sbs_mode_switch = this.settings.get_boolean('fast-sbs-mode-switching') &&
this._needs_widescreen_monitor_update();
return !needs_sbs_mode_switch && !this._monitor_manager.needsOptimalModeCheck(target_monitor.connector);
}
// for_disable should be true if we're using this function to disable the
// effect without anticipating an immediate re-enable
_setup(for_disable = false) {
Globals.logger.log_debug('BreezyDesktopExtension _setup');
if (this._is_effect_running) {
Globals.logger.log('Reset triggered, disabling XR effect');
this._effect_disable(!for_disable);
}
this._target_monitor = this._find_supported_monitor();
if (this._target_monitor) {
if (Globals.data_stream.breezy_desktop_running) {
// Don't enable the effect yet if monitor updates are needed.
// _setup will be triggered again since a !ready result means it will trigger monitor changes
if (this._target_monitor_ready(this._target_monitor)) {
Globals.logger.log('Ready, enabling XR effect');
this._effect_enable();
} else {
Globals.logger.log_debug('BreezyDesktopExtension _setup - breezy desktop enabled, but async monitor action needed');
}
} else {
Globals.logger.log_debug('BreezyDesktopExtension _setup - Doing nothing, target monitor found, but device stream not being received');
}
} else {
Globals.logger.log_debug(`BreezyDesktopExtension _setup - Doing nothing, no supported monitor found, breezy_desktop_running: ${Globals.data_stream.breezy_desktop_running}`);
}
}
_needs_widescreen_monitor_update() {
Globals.logger.log_debug('BreezyDesktopExtension _needs_widescreen_monitor_update');
const state = this._read_state();
const sbs_enabled = state['sbs_mode_enabled'] === 'true';
const widescreen_setting_enabled = this.settings.get_boolean('widescreen-mode');
if (widescreen_setting_enabled !== sbs_enabled) {
Globals.logger.log_debug('BreezyDesktopExtension _needs_widescreen_monitor_update - true');
this._request_sbs_mode_change(widescreen_setting_enabled);
return true;
}
return false;
}
_effect_enable() {
Globals.logger.log_debug('BreezyDesktopExtension _effect_enable');
if (!this._is_effect_running) {
this._is_effect_running = true;
try {
const targetMonitor = this._target_monitor.monitor;
const virtualMonitors = this._find_virtual_monitors();
const refreshRate = targetMonitor.refreshRate ?? 60;
// use rgba(255, 4, 144, 1) for chroma key background
this._virtual_displays_overlay = new St.Bin({ style: 'background-color: rgba(0, 0, 0, 1);', clip_to_allocation: true });
this._virtual_displays_overlay.opacity = 255;
this._virtual_displays_overlay.set_position(targetMonitor.x, targetMonitor.y);
this._virtual_displays_overlay.set_size(targetMonitor.width, targetMonitor.height);
const state = this._read_state();
const pose_has_position = state['connected_device_pose_has_position'] === 'true';
this._pose_has_position = pose_has_position;
Globals.logger.log_debug(
`connected_device_pose_has_position=${pose_has_position}`
);
Globals.data_stream.refresh_data();
this._virtual_displays_actor = new VirtualDisplaysActor({
width: targetMonitor.width,
height: targetMonitor.height,
target_monitor: targetMonitor,
virtual_monitors: virtualMonitors,
monitor_wrapping_scheme: this.settings.get_string('monitor-wrapping-scheme'),
monitor_spacing: this.settings.get_int('monitor-spacing'),
curved_display: this.settings.get_boolean('curved-display'),
headset_display_as_viewport_center: this.settings.get_boolean('headset-display-as-viewport-center'),
viewport_offset_x: this.settings.get_double('viewport-offset-x'),
viewport_offset_y: this.settings.get_double('viewport-offset-y'),
display_distance: this.settings.get_double('display-distance'),
display_size: this.settings.get_double('display-size'),
toggle_display_distance_start: this.settings.get_double('toggle-display-distance-start'),
toggle_display_distance_end: this.settings.get_double('toggle-display-distance-end'),
framerate_cap: this.settings.get_double('framerate-cap'),
imu_snapshots: Globals.data_stream.imu_snapshots,
show_banner: Globals.data_stream.show_banner,
custom_banner_enabled: Globals.data_stream.custom_banner_enabled,
pose_has_position
});
this._virtual_displays_overlay.set_child(this._virtual_displays_actor);
this._virtual_displays_actor.renderMonitors();
Shell.util_set_hidden_from_pick(this._virtual_displays_overlay, true);
global.stage.add_child(this._virtual_displays_overlay);
const cursor_manager_monitor_objs = this._virtual_displays_actor.monitor_actors.map(monitor => {
return {
monitor: monitor.monitorDetails,
actor: monitor.containerActor
};
});
this._cursor_manager = new CursorManager(cursor_manager_monitor_objs, refreshRate);
this._cursor_manager.enable();
this._update_follow_threshold(this.settings);
this._data_stream_bindings = [
'show-banner',
'custom-banner-enabled',
'smooth-follow-enabled'
].map(data_stream_key =>
Globals.data_stream.bind_property(data_stream_key, this._virtual_displays_actor, data_stream_key, Gio.SettingsBindFlags.DEFAULT)
);
this._show_banner_connection = Globals.data_stream.connect('notify::show-banner', this._handle_show_banner_update.bind(this));
this._was_show_banner = Globals.data_stream.show_banner;
if (!this._was_show_banner && this._fresh_session) this._recenter_display();
this._effect_settings_bindings = [
'monitor-wrapping-scheme',
'curved-display',
'headset-display-as-viewport-center',
'viewport-offset-x',
'viewport-offset-y',
'monitor-spacing',
'display-distance',
'toggle-display-distance-start',
'toggle-display-distance-end',
'display-size',
'framerate-cap',
'look-ahead-override',
'disable-anti-aliasing'
]
this._effect_settings_bindings.forEach(settings_key =>
this.settings.bind(settings_key, this._virtual_displays_actor, settings_key, Gio.SettingsBindFlags.DEFAULT)
);
this._distance_connection = this.settings.connect('changed::display-distance', this._update_display_distance.bind(this));
this._toggle_distance_start_connection = this.settings.connect('changed::toggle-display-distance-start', this._update_display_distance.bind(this));
this._toggle_distance_end_connection = this.settings.connect('changed::toggle-display-distance-end', this._update_display_distance.bind(this));
this._display_size_connection = this.settings.connect('changed::display-size', this._update_display_distance.bind(this));
this._focused_monitor_distance_connection =
this._virtual_displays_actor.connect('notify::focused-monitor-details', this._update_display_distance.bind(this));
this._follow_threshold_connection = this.settings.connect('changed::follow-threshold', this._update_follow_threshold.bind(this));
if (global.compositor?.disable_unredirect) {
global.compositor.disable_unredirect();
} else {
Meta.disable_unredirect_for_display(global.display);
}
this._add_settings_keybinding('recenter-display-shortcut', this._recenter_display.bind(this));
this._add_settings_keybinding('toggle-display-distance-shortcut', this._virtual_displays_actor._change_distance.bind(this._virtual_displays_actor));
this._add_settings_keybinding('toggle-follow-shortcut', this._toggle_follow_mode.bind(this));
this._add_settings_keybinding('cursor-to-focused-display-shortcut', this._cursor_to_focused_display.bind(this));
this._start_state_poller();
this._fresh_session = false;
} catch (e) {
Globals.logger.log(`[ERROR] BreezyDesktopExtension _effect_enable ${e.message}\n${e.stack}`);
Globals.logger.log(`[ERROR] BreezyDesktopExtension _effect_enable ${e.message}\n${e.stack}`);
this._effect_disable();
}
}
}
_start_state_poller() {
if (this._state_poll_timeout) return;
this._state_poll_timeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 3000, () => {
if (!this._is_effect_running) {
this._state_poll_timeout = null;
return GLib.SOURCE_REMOVE;
}
try {
const state = this._read_state();
const pose_has_position = state['connected_device_pose_has_position'] === 'true';
if (pose_has_position !== this._pose_has_position) {
this._pose_has_position = pose_has_position;
Globals.logger.log_debug(
`BreezyDesktopExtension state poll - connected_device_pose_has_position=${pose_has_position}`
);
if (this._virtual_displays_actor) {
this._virtual_displays_actor.set_property('pose-has-position', pose_has_position);
}
}
} catch (e) {
Globals.logger.log(`[ERROR] BreezyDesktopExtension _start_state_poller ${e.message}\n${e.stack}`);
}
return GLib.SOURCE_CONTINUE;
});
}
_stop_state_poller() {
if (!this._state_poll_timeout) return;
GLib.source_remove(this._state_poll_timeout);
this._state_poll_timeout = null;
}
_add_settings_keybinding(settings_key, bind_to_function) {
try {
Main.wm.addKeybinding(
settings_key,
this.settings,
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW | Shell.ActionMode.POPUP,
bind_to_function
);
// Connect to the 'changed' signal for the keybinding property
this.settings.connect(`changed::${settings_key}`, () => {
try {
// Remove the old keybinding
Main.wm.removeKeybinding(settings_key);
// Add the updated keybinding
Main.wm.addKeybinding(
settings_key,
this.settings,
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW | Shell.ActionMode.POPUP,
bind_to_function
);
} catch (e) {
Globals.logger.log(`[ERROR] BreezyDesktopExtension _add_settings_keybinding settings binding lambda ${e.message}\n${e.stack}`);
}
});
} catch (e) {
Globals.logger.log(`[ERROR] BreezyDesktopExtension _add_settings_keybinding ${e.message}\n${e.stack}`);
}
}
_write_control(key, value) {
try {
Globals.logger.log_debug(`BreezyDesktopExtension _write_control ${key} ${value}`);
let proc = Gio.Subprocess.new(
['bash', '-c', `echo "${key}=${value}" > /dev/shm/xr_driver_control`],
Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE
);
let [success, stdout, stderr] = proc.communicate_utf8(null, null);
if (!success || !!stderr)
throw new Error(`Failed to write control: ${stderr}`);
} catch (e) {
Globals.logger.log(`[ERROR] BreezyDesktopExtension _write_control ${e.message}\n${e.stack}`);
}
}
_read_state() {
const state = {};
try {
const file = Gio.file_new_for_path('/dev/shm/xr_driver_state');
if (file.query_exists(null)) {
const data = file.load_contents(null);
if (data[0]) {
const bytes = new Uint8Array(data[1]);
const decoder = new TextDecoder();
const contents = decoder.decode(bytes);
const lines = contents.split('\n');
for (const line of lines) {
const [k, v] = line.split('=');
state[k] = v;
}
}
}
} catch (e) {
Globals.logger.log(`[ERROR] BreezyDesktopExtension _read_state ${e.message}\n${e.stack}`);
}
return state;
}
_update_display_distance(object, event) {
const distance = this.settings.get_double('display-distance');
const size = this.settings.get_double('display-size');
Globals.logger.log_debug(`BreezyDesktopExtension _update_display_distance ${distance} ${size}`);
if (distance !== undefined && size !== undefined) {
const defaultDistance = Math.max(
distance,
this.settings.get_double('toggle-display-distance-start'),
this.settings.get_double('toggle-display-distance-end')
);
let focusedMonitorSizeAdjustment = size * defaultDistance;
if (this._virtual_displays_actor?.focused_monitor_details && this._target_monitor) {
const fovMonitor = this._target_monitor.monitor;
const focusedMonitor = this._virtual_displays_actor.focused_monitor_details;
focusedMonitorSizeAdjustment *=
Math.max(focusedMonitor.width / fovMonitor.width, focusedMonitor.height / fovMonitor.height);
}
this._write_control('breezy_desktop_display_distance', distance / focusedMonitorSizeAdjustment);
}
}
_update_follow_threshold(settings, event) {
const value = settings.get_double('follow-threshold');
Globals.logger.log_debug(`BreezyDesktopExtension _update_follow_threshold ${value}`);
if (value !== undefined) this._write_control('breezy_desktop_follow_threshold', value);
}
// requests sbs_mode change and monitors to ensure the state reflects the setting
_request_sbs_mode_change(value) {
Globals.logger.log_debug(`BreezyDesktopExtension _request_sbs_mode_change ${value}`);
this._write_control('sbs_mode', value ? 'enable' : 'disable');
if (!this._sbs_mode_update_timeout) {
var attempts = 0;
this._sbs_mode_update_timeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 3000, (() => {
const state = this._read_state();
const sbs_enabled = state['sbs_mode_enabled'] === 'true';
if (sbs_enabled === value) {
Globals.logger.log_debug('BreezyDesktopExtension _request_sbs_mode_change - successfully updated');
this._sbs_mode_update_timeout = undefined;
if (this.settings.get_boolean('fast-sbs-mode-switching')) {
// setup was halted if this is enabled, so we have to re-trigger it now
this._setup();
}
return GLib.SOURCE_REMOVE;
}
if (attempts++ < 3) {
this._write_control('sbs_mode', value ? 'enable' : 'disable');
return GLib.SOURCE_CONTINUE;
}
// the state never updated to reflect our request, revert the setting
Globals.logger.log('Failed to update sbs_mode state, reverting setting');
this.settings.set_boolean('widescreen-mode', !value);
this._sbs_mode_update_timeout = undefined;
return GLib.SOURCE_REMOVE;
}).bind(this));
}
}
_update_widescreen_mode_from_settings(settings, event) {
// const value = settings.get_boolean('widescreen-mode');
// Globals.logger.log_debug(`BreezyDesktopExtension _update_widescreen_mode_from_settings ${value}`);
// if (value !== undefined && value !== this._xr_effect.widescreen_mode_state) {
// this._request_sbs_mode_change(value);
// } else
// Globals.logger.log_debug('effect.widescreen_mode_state already matched setting');
}
_update_widescreen_mode_from_state(effect, _pspec) {
// kill our state checker if it's running
if (this._sbs_mode_update_timeout) {
Globals.logger.log_debug('BreezyDesktopExtension _update_widescreen_mode_from_state - clearing timeout');
GLib.source_remove(this._sbs_mode_update_timeout);
this._sbs_mode_update_timeout = undefined;
}
const value = effect.widescreen_mode_state;
Globals.logger.log_debug(`BreezyDesktopExtension _update_widescreen_mode_from_state ${value}`);
if (value !== this.settings.get_boolean('widescreen-mode'))
this.settings.set_boolean('widescreen-mode', value);
else
Globals.logger.log_debug('settings.widescreen-mode already matched state');
}
_handle_monitor_change() {
Globals.logger.log('Monitor change detected');
this._setup();
}
_handle_breezy_desktop_running_change(datastream, _pspec) {
Globals.logger.log_debug(`BreezyDesktopExtension _handle_breezy_desktop_running_change ${datastream.breezy_desktop_running}`);
if (datastream.breezy_desktop_running !== this._is_effect_running) {
if (!datastream.breezy_desktop_running) Globals.logger.log('Breezy desktop disabled');
this._fresh_session = datastream.breezy_desktop_running;
this._setup(!datastream.breezy_desktop_running);
}
}
_handle_show_banner_update(datastream, _pspec) {
Globals.logger.log_debug(`BreezyDesktopExtension _handle_show_banner_update ${datastream.show_banner}`);
if (this._was_show_banner && !datastream.show_banner) this._recenter_display();
this._was_show_banner = datastream.show_banner;
}
_toggle_xr_effect() {
if (!this._cli_file) return;
Globals.logger.log_debug('BreezyDesktopExtension _toggle_xr_effect');
let proc = Gio.Subprocess.new(
['bash', '-c', `${this._cli_file.get_path()} --external-mode`],
Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE
);
let [success, stdout, stderr] = proc.communicate_utf8(null, null);
if (!success || !!stderr || !stdout) {
Globals.logger.log(`[ERROR] Failed to get driver status: ${stderr}`);
return;
}
Globals.logger.log_debug(`BreezyDesktopExtension _toggle_xr_effect external_mode: ${stdout}`);
const was_enabled = stdout.trim() === 'breezy_desktop';
const should_enable = !was_enabled;
// use the CLI to change the external mode, avoid using disable/enable, otherwise the driver will
// shut down and recalibrate each time
proc = Gio.Subprocess.new(
['bash', '-c', `${this._cli_file.get_path()} ${should_enable ? '--enable --breezy-desktop' : '--disable-external'}`],
Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE
);
[success, stdout, stderr] = proc.communicate_utf8(null, null);
if (!success || !!stderr) {
Globals.logger.log(`[ERROR] Failed to toggle driver: ${stderr}`);
}
}
_recenter_display() {
Globals.logger.log_debug('BreezyDesktopExtension _recenter_display');
this._write_control('recenter_screen', 'true');
}
_toggle_follow_mode() {
Globals.logger.log_debug('BreezyDesktopExtension _toggle_follow_mode');
if (!!this._virtual_displays_actor) this._virtual_displays_actor.set_property('smooth-follow-toggle-epoch-ms', Date.now());
this._write_control('toggle_breezy_desktop_smooth_follow', 'true');
}
_cursor_to_focused_display() {
Globals.logger.log_debug('BreezyDesktopExtension _cursor_to_focused_display');
if (this._virtual_displays_actor?.focused_monitor_details) {
const monitorDetails = this._virtual_displays_actor.focused_monitor_details;
const xMid = monitorDetails.x + monitorDetails.width / 2;
const yMid = monitorDetails.y + monitorDetails.height / 2;
this._cursor_manager.moveCursorTo(xMid, yMid);
}
}
// for_setup should be true if our intention is to immediately re-enable the extension
_effect_disable(for_setup = false) {
try {
Globals.logger.log_debug('BreezyDesktopExtension _effect_disable');
this._is_effect_running = false;
this._stop_state_poller();
if (Globals.data_stream.smooth_follow_enabled) this._toggle_follow_mode();
Main.wm.removeKeybinding('recenter-display-shortcut');
Main.wm.removeKeybinding('toggle-display-distance-shortcut');
Main.wm.removeKeybinding('toggle-follow-shortcut');
Main.wm.removeKeybinding('cursor-to-focused-display-shortcut');
if (global.compositor?.enable_unredirect) {
global.compositor.enable_unredirect();
} else {
Meta.enable_unredirect_for_display(global.display);
}
for (let settings_key of this._effect_settings_bindings) {
Gio.Settings.unbind(this.settings, settings_key);
}
this._effect_settings_bindings = [];
this._data_stream_bindings.forEach(binding => binding.unbind());
this._data_stream_bindings = [];
if (this._show_banner_connection) {
Globals.data_stream.disconnect(this._show_banner_connection);
this._show_banner_connection = null;
}
if (this._distance_connection) {
this.settings.disconnect(this._distance_connection);
this._distance_connection = null;
}
if (this._toggle_distance_start_connection) {
this.settings.disconnect(this._toggle_distance_start_connection);
this._toggle_distance_start_connection = null;
}
if (this._toggle_distance_end_connection) {
this.settings.disconnect(this._toggle_distance_end_connection);
this._toggle_distance_end_connection = null;
}
if (this._display_size_connection) {
this.settings.disconnect(this._display_size_connection);
this._display_size_connection = null;
}
if (this._focused_monitor_distance_connection) {
this._virtual_displays_actor.disconnect(this._focused_monitor_distance_connection);
this._focused_monitor_distance_connection = null;
}
if (this._follow_threshold_connection) {
this.settings.disconnect(this._follow_threshold_connection);
this._follow_threshold_connection = null;
}
if (this._virtual_displays_overlay) {
if (this._virtual_displays_actor) {
this._virtual_displays_overlay.set_child(null);
this._virtual_displays_actor.destroy();
this._virtual_displays_actor = null;
}
global.stage.remove_child(this._virtual_displays_overlay);
this._virtual_displays_overlay.destroy();
this._virtual_displays_overlay = null;
}
if (this._cursor_manager) {
this._cursor_manager.disable();
this._cursor_manager = null;
}
// this should always be done at the end of this function after the widescreen settings binding is removed,
// so it doesn't reset the setting to false
if (!for_setup && this.settings.get_boolean('widescreen-mode')) {
Globals.logger.log('Disabling SBS mode due to disabling effect');
this._write_control('sbs_mode', 'disable');
}
if (!for_setup && this.settings.get_boolean('remove-virtual-displays-on-disable')) {
this._remove_virtual_displays();
}
} catch (e) {
Globals.logger.log(`[ERROR] BreezyDesktopExtension _effect_disable ${e.message}\n${e.stack}`);
}
}
_remove_virtual_displays() {
try {
GLib.spawn_command_line_sync(`pkill -f "/virtualdisplay( |$)"`);
} catch (e) {
Globals.logger.log(`[ERROR] BreezyDesktopExtension _remove_virtual_displays ${e.message}\n${e.stack}`);
}
}
disable() {
try {
Globals.logger.log_debug('BreezyDesktopExtension disable');
this._effect_disable();
Globals.data_stream.stop();
this._target_monitor = null;
if (this._breezy_desktop_running_connection) {
Globals.data_stream.disconnect(this._breezy_desktop_running_connection);
this._breezy_desktop_running_connection = null;
}
Main.wm.removeKeybinding('toggle-xr-effect-shortcut');
Gio.Settings.unbind(this.settings, 'debug');
Gio.Settings.unbind(this.settings, 'use-optimal-monitor-config');
Gio.Settings.unbind(this.settings, 'headset-as-primary');
Gio.Settings.unbind(this.settings, 'disable-physical-displays');
Gio.Settings.unbind(this.settings, 'debug-no-device');
if (this._monitor_manager) {
this._monitor_manager.disable();
this._monitor_manager = null;
}
} catch (e) {
Globals.logger.log(`[ERROR] BreezyDesktopExtension disable ${e.message}\n${e.stack}`);
}
}
}
function init() {
return new Extension();
}

View File

@ -1,7 +0,0 @@
const Globals = {
logger: null,
ipc_file: null, // Gio.File instance, file exists if set
extension_dir: null, // string path
data_stream: null, // DeviceDataStream instance
}
export default Globals;

View File

@ -1,59 +0,0 @@
export const UINT8_SIZE = 1;
export const BOOL_SIZE = UINT8_SIZE;
export const UINT_SIZE = 4;
export const FLOAT_SIZE = 4;
export const DATA_VIEW_INFO_OFFSET_INDEX = 0;
export const DATA_VIEW_INFO_SIZE_INDEX = 1;
export const DATA_VIEW_INFO_COUNT_INDEX = 2;
// computes the end offset, exclusive
export function dataViewEnd(dataViewInfo) {
return dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX] + dataViewInfo[DATA_VIEW_INFO_SIZE_INDEX] * dataViewInfo[DATA_VIEW_INFO_COUNT_INDEX];
}
export function dataViewUint8(dataView, dataViewInfo) {
return dataView.getUint8(dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX]);
}
export function dataViewUint(dataView, dataViewInfo) {
return dataView.getUint32(dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX], true);
}
export function dataViewBigUint(dataView, dataViewInfo) {
return Number(dataView.getBigUint64(dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX], true));
}
export function dataViewUint32Array(dataView, dataViewInfo) {
const uintArray = []
let offset = dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX];
for (let i = 0; i < dataViewInfo[DATA_VIEW_INFO_COUNT_INDEX]; i++) {
uintArray.push(dataView.getUint32(offset, true));
offset += UINT_SIZE;
}
return uintArray;
}
export function dataViewUint8Array(dataView, dataViewInfo) {
const uintArray = []
let offset = dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX];
for (let i = 0; i < dataViewInfo[DATA_VIEW_INFO_SIZE_INDEX] * dataViewInfo[DATA_VIEW_INFO_COUNT_INDEX]; i++) {
uintArray.push(dataView.getUint8(offset));
offset += UINT8_SIZE;
}
return uintArray;
}
export function dataViewFloat(dataView, dataViewInfo) {
return dataView.getFloat32(dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX], true);
}
export function dataViewFloatArray(dataView, dataViewInfo) {
const floatArray = []
let offset = dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX];
for (let i = 0; i < dataViewInfo[DATA_VIEW_INFO_COUNT_INDEX]; i++) {
floatArray.push(dataView.getFloat32(offset, true));
offset += FLOAT_SIZE;
}
return floatArray;
}

View File

@ -1,119 +0,0 @@
// soft-brightness-plus - Control the display's brightness via an alpha channel.
// Copyright (C) 2023 Joel Kitching (jkitching on Github)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import * as Config from 'resource:///org/gnome/shell/misc/config.js';
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import GObject from 'gi://GObject';
import System from 'system';
const LOG_DIR_NAME = 'breezy_gnome/logs/gjs';
export const Logger = GObject.registerClass({
GTypeName: 'Logger',
Properties: {
'title': GObject.ParamSpec.string(
'title',
'Title',
'Title to use when logging',
GObject.ParamFlags.READWRITE,
null
),
'debug': GObject.ParamSpec.boolean(
'debug',
'Log debug messages',
'Log debug messages',
GObject.ParamFlags.READWRITE,
false
)
}
}, class Logger extends GObject.Object {
constructor(params = {}) {
super(params);
this._log_file_dir = `${GLib.get_user_state_dir()}/${LOG_DIR_NAME}/`
this._first_log = true;
}
logVersion() {
const gnomeShellVersion = Config.PACKAGE_VERSION;
if (gnomeShellVersion != undefined) {
const splitVersion = gnomeShellVersion.split('.').map((x) => {
x = Number(x);
if (Number.isNaN(x)) {
return 0;
} else {
return x;
}
});
const major = splitVersion[0];
const minor = splitVersion.length >= 2 ? splitVersion[1] : 0;
const patch = splitVersion.length >= 3 ? splitVersion[2] : 0;
const xdgSessionType = GLib.getenv('XDG_SESSION_TYPE');
const onWayland = xdgSessionType == 'wayland';
this.log_debug('_logVersion(): gnome-shell version major=' + major + ', minor=' + minor + ', patch=' + patch + ', system_version=' + System.version + ', XDG_SESSION_TYPE=' + xdgSessionType);
this.log_debug('_logVersion(): onWayland=' + onWayland);
}
}
log(text) {
if (this._first_log) {
this._first_log = false;
let msg = '';
const gnomeShellVersion = Config.PACKAGE_VERSION;
if (gnomeShellVersion != undefined) {
msg += 'Gnome-Shell ' + gnomeShellVersion;
}
const gjsVersion = System.version;
if (gjsVersion != undefined) {
const gjsVersionMajor = Math.floor(gjsVersion / 10000);
const gjsVersionMinor = Math.floor((gjsVersion % 10000) / 100);
const gjsVersionPatch = gjsVersion % 100;
msg += (' / gjs ' + gjsVersionMajor +
'.' + gjsVersionMinor +
'.' + gjsVersionPatch +
' (' + gjsVersion + ')'
);
}
const sessionType = GLib.getenv('XDG_SESSION_TYPE');
if (sessionType != undefined) {
msg += ' / ' + sessionType;
}
this.log(msg);
}
const now = GLib.DateTime.new_now_local();
const timestamp = now.format('%Y-%m-%d %H:%M:%S.') + now.format('%f').substring(0, 3);
const logFileName = `${now.format('%Y-%m-%d')}.log`;
const file = Gio.File.new_for_path(`${this._log_file_dir}/${logFileName}`);
if (!file.query_exists(null)) {
const parentDir = file.get_parent();
if (!parentDir.query_exists(null)) {
parentDir.make_directory_with_parents(null);
}
}
const stream = file.append_to(Gio.FileCreateFlags.NONE, null);
stream.write(`${timestamp} ${text}\n`, null);
stream.close(null);
}
log_debug(text) {
if (this.debug) {
this.log(`[DEBUG] ${text}`);
}
}
});

View File

@ -1,78 +0,0 @@
export function degreeToRadian(degree) {
return degree * Math.PI / 180;
}
// FOV in radians is spherical, so doesn't follow Pythagoras' theorem
export function diagonalToCrossFOVs(diagonalFOVRadians, aspectRatio) {
// first convert from a spherical FOV to a diagonal FOV on a flat plane at a unit distance of 1.0
const diagonalLengthUnitDistance = 2 * Math.tan(diagonalFOVRadians / 2);
// then convert to flat plane horizontal and vertical FOVs
const heightUnitDistance = diagonalLengthUnitDistance / Math.sqrt(1 + aspectRatio * aspectRatio);
const widthUnitDistance = heightUnitDistance * aspectRatio;
return {
// then convert back to spherical FOV
diagonalRadians: diagonalFOVRadians,
horizontalRadians: 2 * Math.atan(widthUnitDistance / 2),
verticalRadians: 2 * Math.atan(heightUnitDistance / 2),
// flat values are relative to a unit distance of 1.0
diagonalLengthUnitDistance,
widthUnitDistance,
heightUnitDistance
}
}
const segmentsPerRadian = 20.0 / degreeToRadian(90.0);
// displays are placed around a circle, these functions help determine radians and distances from the original
// FOV measurements scaled to the display dimensions
export const fovConversionFns = {
// convert curved FOV for flat displays
flat: {
// distance to an edge is the hypothenuse of the triangle where the opposite side is half the width of the reference fov screen
centerToFovEdgeDistance: (centerDistance, fovLength) => Math.sqrt(Math.pow(fovLength / 2, 2) + Math.pow(centerDistance, 2)),
fovEdgeToScreenCenterDistance: (edgeDistance, screenLength) => Math.sqrt(Math.pow(edgeDistance, 2) - Math.pow(screenLength / 2, 2)),
lengthToRadians: (fovRadians, fovLength, screenEdgeDistance, toLength) => Math.asin(toLength / 2 / screenEdgeDistance) * 2,
angleToLength: (fovRadians, fovLength, screenDistance, toAngleOpposite, toAngleAdjacent) => {
return toAngleOpposite / toAngleAdjacent * screenDistance;
},
fovRadiansAtDistance: (fovRadians, unitLength, newScreenDistance) => {
return 2 * Math.atan(unitLength / 2 / newScreenDistance);
},
radiansToSegments: (screenRadians) => 1
},
// convert curved FOV for curved displays, scaling either involves no change or is linear
curved: {
centerToFovEdgeDistance: (centerDistance, fovLength) => centerDistance,
fovEdgeToScreenCenterDistance: (edgeDistance, screenLength) => edgeDistance,
lengthToRadians: (fovRadians, fovLength, screenEdgeDistance, toLength) => fovRadians / fovLength * toLength,
angleToLength: (fovRadians, fovLength, screenDistance, toAngleOpposite, toAngleAdjacent) => fovLength / fovRadians * Math.atan2(toAngleOpposite, toAngleAdjacent),
fovRadiansAtDistance: (fovRadians, unitLength, newScreenDistance) => fovRadians / newScreenDistance,
radiansToSegments: (screenRadians) => Math.ceil(screenRadians * segmentsPerRadian)
}
}
export const applyQuaternionToVector = (vector, quaternion) => {
const t = [
2.0 * (quaternion[1] * vector[2] - quaternion[2] * vector[1]),
2.0 * (quaternion[2] * vector[0] - quaternion[0] * vector[2]),
2.0 * (quaternion[0] * vector[1] - quaternion[1] * vector[0])
];
return [
vector[0] + quaternion[3] * t[0] + quaternion[1] * t[2] - quaternion[2] * t[1],
vector[1] + quaternion[3] * t[1] + quaternion[2] * t[0] - quaternion[0] * t[2],
vector[2] + quaternion[3] * t[2] + quaternion[0] * t[1] - quaternion[1] * t[0]
];
}
export const vectorMagnitude = (vector) => {
return Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1] + vector[2] * vector[2]);
}
export const normalizeVector = (vector) => {
const length = vectorMagnitude(vector);
return [vector[0] / length, vector[1] / length, vector[2] / length];
}

View File

@ -1,11 +0,0 @@
{
"uuid": "breezydesktop@xronlinux.com",
"name": "Breezy GNOME XR Desktop",
"description": "XR virtual desktop for GNOME.",
"settings-schema": "com.xronlinux.BreezyDesktop",
"session-modes": ["user"],
"shell-version": [
"46", "47", "48", "49", "50"
],
"url": "https://github.com/wheaney/breezy-desktop"
}

View File

@ -1,581 +0,0 @@
// Taken from https://github.com/jkitching/soft-brightness-plus
//
// Copyright (C) 2019, 2021 Philippe Troin (F-i-f on Github)
// Copyright (C) 2023 Joel Kitching (jkitching on Github)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import Gio from 'gi://Gio';
import GObject from 'gi://GObject';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import Globals from './globals.js';
export const NESTED_MONITOR_PRODUCT = 'MetaMonitor';
export const VIRTUAL_MONITOR_PRODUCT = 'Virtual remote monitor';
export const SUPPORTED_MONITOR_PRODUCTS = [
'VITURE',
'nreal air',
'Air',
'Air 2',
'Air 2 Pro',
'Air 2 Ultra',
'One',
'One Pro',
'XREAL One',
'XREAL One Pro',
'XREAL 1S',
'SmartGlasses', // TCL/RayNeo
'Rokid Max',
'Rokid Max 2',
'Rokid Air',
NESTED_MONITOR_PRODUCT
];
let cachedDisplayConfigProxy = null;
function getDisplayConfigProxy(extPath) {
if (cachedDisplayConfigProxy == null) {
let xml = null;
const file = Gio.File.new_for_path(extPath + '/dbus-interfaces/org.gnome.Mutter.DisplayConfig.xml');
try {
const [ok, bytes] = file.load_contents(null);
if (ok) {
xml = new TextDecoder().decode(bytes);
}
} catch (e) {
Globals.logger.log('[ERROR] failed to load DisplayConfig interface XML');
throw e;
}
cachedDisplayConfigProxy = Gio.DBusProxy.makeProxyWrapper(xml);
}
return cachedDisplayConfigProxy;
}
export function newDisplayConfig(extPath, callback) {
const DisplayConfigProxy = getDisplayConfigProxy(extPath);
new DisplayConfigProxy(
Gio.DBus.session,
'org.gnome.Mutter.DisplayConfig',
'/org/gnome/Mutter/DisplayConfig',
callback
);
}
function getMonitorConfig(displayConfigProxy, callback) {
displayConfigProxy.GetCurrentStateRemote((result, error) => {
if (error) {
callback(null, `GetCurrentState failed: ${error}`);
} else {
Globals.logger.log_debug(`monitormanager.js getMonitorConfig GetCurrentState result: ${JSON.stringify(result)}`);
const allMonitors = [];
const [serial, monitors, logicalMonitors, properties] = result;
for (let monitor of monitors) {
const [details, modes, monProperties] = monitor;
const [connector, vendor, product, monitorSerial] = details;
const displayName = monProperties['display-name'].get_string()[0];
for (let mode of modes) {
const [modeId, width, height, refreshRate, preferredScale, supportedScales, modeProperites] = mode;
const isCurrent = !!modeProperites['is-current'];
if (isCurrent) {
allMonitors.push([displayName, connector, vendor, product, serial, refreshRate]);
}
}
}
callback(allMonitors, null);
}
});
}
// triggers callback with true result if an an async monitor config change was triggered, false if no config change needed
function performOptimalModeCheck(displayConfigProxy, connectorName, headsetAsPrimary, useHighestRefreshRate,
disablePhysicalDisplays, callback, allowConfigUpdateFn) {
Globals.logger.log_debug(`monitormanager.js performOptimalModeCheck for ${connectorName}`);
displayConfigProxy.GetCurrentStateRemote((result, error) => {
if (!allowConfigUpdateFn()) {
// other requests are in progress, this monitor state may be stale, do nothing
Globals.logger.log_debug('MonitorManager performOptimalModeCheck: allowConfigUpdate is false');
callback(false, null);
return;
}
if (error) {
callback(null, `GetCurrentState failed: ${error}`);
} else {
Globals.logger.log_debug(`monitormanager.js performOptimalModeCheck GetCurrentState result: ${JSON.stringify(result)}`);
const [serial, monitors, logicalMonitors, properties] = result;
// iterate over all monitors at least once, collecting the best fit mode for our monitor, and mode information
// for each monitor
let ourMonitor = undefined;
let monitorToCurrentModeMap = {};
let bestFitMode = undefined;
const skipScaleUpdate = !!properties['global-scale-required'];
for (let monitor of monitors) {
const [details, availableModes, monProperties] = monitor;
const [connector, vendor, product, monitorSerial] = details;
const isOurMonitor = connector == connectorName;
let modes = availableModes;
if (isOurMonitor) {
ourMonitor = monitor;
if (!useHighestRefreshRate) {
const currentMode = modes.find((mode) => !!mode[6]['is-current']);
// filter modes to only include the current refresh rate
modes = availableModes.filter((mode) => mode[3] === currentMode[3]);
}
}
for (let mode of modes) {
const [modeId, width, height, refreshRate, preferredScale, supportedScales, modeProperites] = mode;
const isCurrent = !!modeProperites['is-current'];
if (isCurrent) monitorToCurrentModeMap[connector] = mode;
if (isOurMonitor && (!bestFitMode || (
width >= bestFitMode.width &&
height >= bestFitMode.height &&
refreshRate >= bestFitMode.refreshRate))) {
// find the scale that is closest to 1.0
const bestScale = supportedScales.reduce((prev, curr) => {
return Math.abs(curr - 1.0) < Math.abs(prev - 1.0) ? curr : prev;
});
bestFitMode = {
modeId,
width,
height,
refreshRate,
bestScale
};
}
}
}
if (!!ourMonitor) {
let anyMonitorsChanged = false;
if (!!bestFitMode) {
// this will hold how much the width of the monitor has changed,
// and what range of y values is affected
let deltaX = 0;
let rangeY = [0, 0];
// sort logicalMonitors by x ascending, so we can tell if any are affected by a width change
logicalMonitors.sort((a, b) => a[0] - b[0]);
// map from original logical monitors schema to a(iiduba(ssa{sv})) for ApplyMonitorsConfig call
const removeMonitorIndexes = [];
const updatedLogicalMonitors = logicalMonitors.map((logicalMonitor, index) => {
const [x, y, scale, transform, primary, monitors, logMonProperties] = logicalMonitor;
const hasOurMonitor = !!monitors.some((monitor) => monitor[0] === connectorName);
const hasVirtualMonitor = monitors.some((monitor) => monitor[2] === VIRTUAL_MONITOR_PRODUCT);
const newScale = (!skipScaleUpdate && hasOurMonitor) ? bestFitMode.bestScale : scale;
anyMonitorsChanged |= newScale !== scale;
// there can only be one primary monitor, so we need to set all other monitors to not primary and glasses to primary,
// if headsetAsPrimary is true
anyMonitorsChanged |= headsetAsPrimary && ((hasOurMonitor && !primary) || (!hasOurMonitor && primary));
if (disablePhysicalDisplays && !hasVirtualMonitor && !hasOurMonitor) {
removeMonitorIndexes.push(index);
anyMonitorsChanged = true;
}
// we need to figure out if the deltaX applies to this logical monitor,
// i.e. if it is within the same row as our monitor and to the right of it
let thisDeltaX = deltaX;
if (thisDeltaX !== 0) {
// find the monitor with the largest height
const maxMonitorHeight = monitors.reduce((maxHeight, monitor) => {
const monitorConnector = monitor[0];
const currentMode = monitorToCurrentModeMap[monitorConnector];
const currentHeight = currentMode[2];
return Math.max(maxHeight, currentHeight);
}, 0);
if (y >= rangeY[1] || y + maxMonitorHeight <= rangeY[0]) {
// monitors outside the y range are not affected by the width change
thisDeltaX = 0;
} else {
anyMonitorsChanged = true;
}
}
return [
x + thisDeltaX,
y,
newScale,
transform,
headsetAsPrimary ? hasOurMonitor : primary,
monitors.map((monitor) => {
const monitorConnector = monitor[0];
const isOurMonitor = monitorConnector === connectorName;
const [currentModeId, currentWidth, currentHeight] = monitorToCurrentModeMap[monitorConnector];
if (isOurMonitor) {
deltaX = bestFitMode.width - currentWidth;
rangeY = [y, y + currentHeight];
}
anyMonitorsChanged |= isOurMonitor && bestFitMode.modeId !== currentModeId;
return [
monitorConnector,
isOurMonitor ? bestFitMode.modeId : currentModeId,
{} // properties
];
})
];
});
// if our monitor is already properly configured, we can skip the ApplyMonitorsConfig call
if (anyMonitorsChanged) {
if (removeMonitorIndexes.length > 0) {
let removedPrimary = false;
// remove monitors that are not virtual or our monitor
removeMonitorIndexes.reverse().forEach((index) => {
const [x, y, scale, transform, primary, monitors, logMonProperties] = updatedLogicalMonitors[index];
if (primary) removedPrimary = true;
updatedLogicalMonitors.splice(index, 1);
});
// collect sizes based on modes of attached monitors
const logicalMonitorsWithSizes = updatedLogicalMonitors.map((logicalMonitor) => {
const [x, y, scale, transform, primary, monitors, logMonProperties] = logicalMonitor;
const {width, height} = monitors.reduce(({width, height}, monitor) => {
const monitorConnector = monitor[0];
const currentMode = monitorToCurrentModeMap[monitorConnector];
const currentWidth = currentMode[1];
const currentHeight = currentMode[2];
return {
width: Math.max(width, currentWidth),
height: Math.max(height, currentHeight)
};
}, {width: 0, height: 0});
return {
logicalMonitor,
width,
height,
xEnd: x + width,
yEnd: y + height
}
});
logicalMonitorsWithSizes.sort((a, b) => a.x === b.x ? a.y - b.y : a.x - b.x);
// this array will track monitors we've already corrected, but we'll toss it out since we're modifying the
// objects in the original array
const processedLogicalMonitors = [];
// make sure all monitors have a monitor adjacent
for (let i = 0; i < logicalMonitorsWithSizes.length; i++) {
const thisMonitor = logicalMonitorsWithSizes[i];
const [x, y, scale, transform, primary, monitors, logMonProperties] = thisMonitor.logicalMonitor;
const {xEnd, yEnd} = thisMonitor;
const hasOurMonitor = !!monitors.some((monitor) => monitor[0] === connectorName);
if (removedPrimary && hasOurMonitor) {
// if we removed the primary monitor, we need to set the glasses monitor as the new primary
thisMonitor.logicalMonitor[4] = true;
}
if (logicalMonitorsWithSizes.some((monitor, index) => {
if (index === i) return false;
const [monX, monY, monScale, monTransform, monPrimary, monMonitors, monLogMonProperties] = monitor.logicalMonitor;
const monXEnd = monitor.xEnd;
const monYEnd = monitor.yEnd;
const xOverlap = x < monXEnd && xEnd > monX;
const yOverlap = y < monYEnd && yEnd > monY;
// use top or left sides to determine if it's already adjacent
return (x === monXEnd && yOverlap) || (y === monYEnd && xOverlap);
})) {
// this monitor is already adjacent to another monitor, leave it as-is
processedLogicalMonitors.push(thisMonitor);
} else {
let newX = undefined;
let newY = undefined;
// move the monitor left until it runs into one
const procMonitorsByXEndDesc = [...processedLogicalMonitors].sort((a, b) => b.xEnd - a.xEnd);
for (let j = 0; j < procMonitorsByXEndDesc.length; j++) {
const procMonitor = procMonitorsByXEndDesc[j];
const [procX, procY, procScale, procTransform, procPrimary, procMonitors, procLogMonProperties] = procMonitor.logicalMonitor;
if (procMonitor.xEnd <= x && procY < yEnd && procMonitor.yEnd > y) {
newX = procMonitor.xEnd;
newY = y;
break;
}
}
if (newX === undefined) {
newX = 0;
// we didn't find an adjacent monitor to the left, now move it up until it runs into one
const procMonitorsByYEndDesc = [...processedLogicalMonitors].sort((a, b) => b.yEnd - a.yEnd);
for (let j = 0; j < procMonitorsByYEndDesc.length; j++) {
const procMonitor = procMonitorsByYEndDesc[j];
const [procX, procY, procScale, procTransform, procPrimary, procMonitors, procLogMonProperties] = procMonitor.logicalMonitor;
if (procMonitor.yEnd <= y && procX < thisMonitor.width && procMonitor.xEnd > 0) {
newY = procMonitor.yEnd;
break;
}
}
// if nothing found, put at origin
if (newY === undefined) newY = 0;
}
thisMonitor.logicalMonitor[0] = newX;
thisMonitor.logicalMonitor[1] = newY;
thisMonitor.xEnd = newX + thisMonitor.width;
thisMonitor.yEnd = newY + thisMonitor.height;
processedLogicalMonitors.push(thisMonitor);
}
}
}
Globals.logger.log_debug(`monitormanager.js performOptimalModeCheck updatedLogicalMonitors: ${JSON.stringify(updatedLogicalMonitors)}`);
displayConfigProxy.ApplyMonitorsConfigRemote(
serial,
1, // "temporary" config -- "permanent" might be pointless since we always do this check
updatedLogicalMonitors,
{}, // properties
(_result, error) => {
if (error) {
callback(null, `ApplyMonitorsConfig failed: ${error}`);
} else {
callback(true, null);
}
}
);
}
}
if (!anyMonitorsChanged) callback(false, null);
} else {
callback(null, `Monitor ${connectorName} not found in GetCurrentState result`);
}
}
});
}
// Monitor change handling
export const MonitorManager = GObject.registerClass({
Properties: {
'use-optimal-monitor-config': GObject.ParamSpec.boolean(
'use-optimal-monitor-config',
'Use optimal monitor configuration',
'Automatically set the optimal monitor configuration upon connection',
GObject.ParamFlags.READWRITE,
true
),
'use-highest-refresh-rate': GObject.ParamSpec.boolean(
'use-highest-refresh-rate',
'Use highest refresh rate',
'Set the highest refresh rate which choosing optimal configs',
GObject.ParamFlags.READWRITE,
true
),
'headset-as-primary': GObject.ParamSpec.boolean(
'headset-as-primary',
'Use headset as primary monitor',
'Automatically set the headset as the primary display upon connection',
GObject.ParamFlags.READWRITE,
false
),
'disable-physical-displays': GObject.ParamSpec.boolean(
'disable-physical-displays',
'Disable physical displays',
'Disable physical displays when a virtual display is connected',
GObject.ParamFlags.READWRITE,
true
),
'extension-path': GObject.ParamSpec.string(
'extension-path',
'Extension path',
'Path to the extension directory',
GObject.ParamFlags.READWRITE,
''
)
}
}, class MonitorManager extends GObject.Object {
constructor(params = {}) {
super(params);
this._monitorsChangedConnection = null;
this._displayConfigProxy = null;
this._monitorProperties = null;
this._changeHookFn = null;
this._needsConfigCheck = this.use_optimal_monitor_config || this.headset_as_primary || this.disable_physical_displays;
// help prevent certain actions from taking place multiple times in the event of rapid monitor updates
this._asyncRequestsInFlight = 0;
this._configCheckRequestsCount = 0;
this._enabled = false;
}
enable() {
Globals.logger.log_debug('MonitorManager enable');
newDisplayConfig(this.extension_path, ((proxy, error) => {
if (error) {
return;
}
this._displayConfigProxy = proxy;
this._on_monitors_change();
}).bind(this));
this._monitorsChangedConnection = Main.layoutManager.connect('monitors-changed', this._on_monitors_change.bind(this));
this._disable_physical_displays_connection = this.connect('notify::disable-physical-displays', this._on_disable_physical_displays_change.bind(this));
this._enabled = true;
}
disable() {
Globals.logger.log_debug('MonitorManager disable');
this.disconnect(this._disable_physical_displays_connection);
Main.layoutManager.disconnect(this._monitorsChangedConnection);
this._enabled = false;
this._disable_physical_displays_connection = null;
this._monitorsChangedConnection = null;
this._displayConfigProxy = null;
this._monitorProperties = null;
this._changeHookFn = null;
}
setChangeHook(fn) {
this._changeHookFn = fn;
}
getMonitors() {
return Main.layoutManager.monitors;
}
getMonitorPropertiesList() {
return this._monitorProperties;
}
// returns true if an async check is needed, caller should wait for the next change hook call
needsOptimalModeCheck(monitorConnector) {
Globals.logger.log_debug(`MonitorManager needsOptimalModeCheck: ${monitorConnector}`);
if (this._displayConfigProxy == null) {
Globals.logger.log('MonitorManager needsOptimalModeCheck: _displayConfigProxy not set!');
return false;
}
const isCheckingConfig = this._needsConfigCheck;
if (this._needsConfigCheck && this._asyncRequestsInFlight === 0) {
this._asyncRequestsInFlight++;
const configCheckCountSnapshot = this._configCheckRequestsCount;
const allowConfigUpdateFn = (() => {
// allow updates to the config if this is the only in-flight request and no more requests
// were made while we were waiting for the previous request to complete
return this._asyncRequestsInFlight === 1 && this._configCheckRequestsCount === configCheckCountSnapshot;
}).bind(this);
performOptimalModeCheck(this._displayConfigProxy, monitorConnector, this.headset_as_primary, this.use_highest_refresh_rate, this.disable_physical_displays, ((configChanged, error) => {
if (--this._asyncRequestsInFlight > 0) {
Globals.logger.log_debug(`MonitorManager needsOptimalModeCheck: ${this._asyncRequestsInFlight} async requests still pending, skipping change hook`);
return;
} else if (this._configCheckRequestsCount !== configCheckCountSnapshot) {
Globals.logger.log_debug('MonitorManager needsOptimalModeCheck: config checks requested while in-flight, skipping change hook');
return;
}
this._needsConfigCheck = false;
if (error) {
Globals.logger.log(`[ERROR] Failed to switch to optimal mode for monitor ${monitorConnector}: ${error}`);
// tell the extension to proceed, this should result in another config check
this._changeHookFn();
} else {
if (configChanged) {
Globals.logger.log(`Switched to optimal mode for monitor ${monitorConnector}`);
} else if (!!this._changeHookFn) {
Globals.logger.log_debug('MonitorManager needsOptimalModeCheck: no config change');
// no config change means this won't be triggered automatically, so trigger it manually
this._changeHookFn();
} else {
Globals.logger.log('MonitorManager needsOptimalModeCheck: can\'t trigger change hook, no hook set!');
}
}
}).bind(this), allowConfigUpdateFn);
} else if (!this._needsConfigCheck) {
Globals.logger.log_debug('MonitorManager needsOptimalModeCheck: skipping config check');
} else {
Globals.logger.log_debug(`MonitorManager needsOptimalModeCheck: skipping due to async requests ${this._asyncRequestsInFlight}`);
}
return isCheckingConfig;
}
_on_monitors_change() {
if (!this._enabled) return;
Globals.logger.log_debug('MonitorManager _on_monitors_change');
if (this._displayConfigProxy == null) {
return;
}
if (this.use_optimal_monitor_config || this.headset_as_primary || this.disable_physical_displays) {
this._needsConfigCheck = true;
this._configCheckRequestsCount++;
}
this._asyncRequestsInFlight++;
getMonitorConfig(this._displayConfigProxy, ((result, error) => {
this._asyncRequestsInFlight--;
if (error) {
Globals.logger.log(`[ERROR] Failed _on_monitors_change getMonitorConfig: ${error}`);
return;
}
const monitorProperties = [];
for (let i = 0; i < result.length; i++) {
const [monitorName, connectorName, vendor, product, serial, refreshRate] = result[i];
const monitorIndex = global.backend.get_monitor_manager().get_monitor_for_connector(connectorName);
Globals.logger.log_debug(`Found monitor ${monitorName}, vendor ${vendor}, product ${product}, serial ${serial}, connector ${connectorName}, index ${monitorIndex}`);
if (monitorIndex >= 0) {
monitorProperties[monitorIndex] = {
index: monitorIndex,
name: monitorName,
vendor: vendor,
product: product,
serial: serial,
connector: connectorName,
refreshRate: refreshRate
};
}
}
this._monitorProperties = monitorProperties;
if (!!this._changeHookFn) {
if (this._asyncRequestsInFlight === 0) {
this._changeHookFn();
} else {
Globals.logger.log_debug(`MonitorManager _on_monitors_change: ${this._asyncRequestsInFlight} requests still pending, skipping change hook`);
}
} else {
Globals.logger.log('MonitorManager _on_monitors_change: can\'t trigger change hook, no hook set!');
}
}).bind(this));
}
_on_disable_physical_displays_change() {
if (this._enabled && this.disable_physical_displays && !!this._changeHookFn) {
Globals.logger.log_debug('MonitorManager _on_disable_physical_displays_change triggering change hook');
this._needsConfigCheck = true;
this._configCheckRequestsCount++;
this._changeHookFn();
}
}
});

View File

@ -1 +0,0 @@
../../../ui/data/com.xronlinux.BreezyDesktop.gschema.xml

View File

@ -1,13 +0,0 @@
import Gio from 'gi://Gio';
export function getShaderSource(path) {
const file = Gio.file_new_for_path(path);
const data = file.load_contents(null);
const bytes = new Uint8Array(data[1]);
const decoder = new TextDecoder();
const shaderSource = decoder.decode(bytes);
// version string helps with linting, but GNOME extension doesn't like it, so remove it if it's there
return shaderSource.replace(/^#version .*$/gm, '') + '\n';
}

View File

@ -1 +0,0 @@
../../../modules/sombrero/calibrating.png

View File

@ -1 +0,0 @@
../../../vulkan/custom_banner.png

View File

@ -1,11 +0,0 @@
export function getEpochSec() {
return toSec(Date.now());
}
export function toSec(milliseconds) {
return Math.floor(milliseconds / 1000);
}
export function isValidKeepAlive(dateSec) {
return Math.abs(getEpochSec() - dateSec) <= 1;
}

View File

@ -1,630 +0,0 @@
import Clutter from 'gi://Clutter'
import Cogl from 'gi://Cogl';
import GLib from 'gi://GLib';
import GObject from 'gi://GObject';
import Shell from 'gi://Shell';
import Globals from './globals.js';
import { degreeToRadian, diagonalToCrossFOVs, fovConversionFns } from './math.js';
// these need to mirror the values in XRLinuxDriver
// https://github.com/wheaney/XRLinuxDriver/blob/main/src/plugins/smooth_follow.c#L31
export const SMOOTH_FOLLOW_SLERP_TIMELINE_MS = 1000;
const SMOOTH_FOLLOW_SLERP_FACTOR = Math.pow(1-0.999, 1/SMOOTH_FOLLOW_SLERP_TIMELINE_MS);
// this mirror's how the driver's slerp function progresses so our effect will match it
function smoothFollowSlerpProgress(elapsedMs) {
return 1 - Math.pow(SMOOTH_FOLLOW_SLERP_FACTOR, elapsedMs);
}
// how far to look ahead is how old the IMU data is plus a constant that is either the default for this device or an override
function lookAheadMS(imuDateMs, lookAheadCfg, override) {
// how stale the imu data is
const dataAge = Date.now() - imuDateMs;
return (override === -1 ? lookAheadCfg[0] : override) + dataAge;
}
// Create a mesh of vertices in a pattern suitable for TRIANGLE_STRIP
function createVertexMesh(fovDetails, monitorDetails, positionVectorNWU) {
let horizontalWrap = fovDetails.monitorWrappingScheme === 'horizontal';
const horizontalConversions = fovDetails.curvedDisplay && horizontalWrap ? fovConversionFns.curved : fovConversionFns.flat;
const sideEdgeDistancePixels = horizontalConversions.centerToFovEdgeDistance(
fovDetails.completeScreenDistancePixels,
fovDetails.sizeAdjustedWidthPixels
);
const horizontalRadians = horizontalConversions.lengthToRadians(
fovDetails.defaultDistanceHorizontalRadians,
fovDetails.widthPixels,
sideEdgeDistancePixels,
monitorDetails.width
);
let verticalWrap = fovDetails.monitorWrappingScheme === 'vertical';
const verticalConversions = fovDetails.curvedDisplay && verticalWrap ? fovConversionFns.curved : fovConversionFns.flat;
const topEdgeDistancePixels = verticalConversions.centerToFovEdgeDistance(
fovDetails.completeScreenDistancePixels,
fovDetails.sizeAdjustedHeightPixels
);
const verticalRadians = verticalConversions.lengthToRadians(
fovDetails.defaultDistanceVerticalRadians,
fovDetails.heightPixels,
topEdgeDistancePixels,
monitorDetails.height
);
const xSegments = horizontalConversions.radiansToSegments(horizontalRadians);
const ySegments = verticalConversions.radiansToSegments(verticalRadians);
const texXLeft = 0;
const texYTop = 0;
const texXRight = 1;
const texYBottom = 1;
// curve the monitor placments based on the fov, wrapping, and texture coordinates
const radius = fovDetails.completeScreenDistancePixels;
function v(s, t) {
let zOffsetPixels = 0
const xOffset = s - 0.5;
let xOffsetPixels = monitorDetails.width * xOffset;
if (fovDetails.curvedDisplay && horizontalWrap) {
const xOffsetRadians = xOffset * horizontalRadians;
xOffsetPixels = Math.sin(xOffsetRadians) * radius;
zOffsetPixels = radius - Math.cos(xOffsetRadians) * radius;
}
const x = -positionVectorNWU[1] + xOffsetPixels;
const yOffset = 0.5 - t;
let yOffsetPixels = monitorDetails.height * yOffset;
if (fovDetails.curvedDisplay && verticalWrap) {
const yOffsetRadians = yOffset * verticalRadians;
yOffsetPixels = Math.sin(yOffsetRadians) * radius;
zOffsetPixels = radius - Math.cos(yOffsetRadians) * radius;
}
const y = positionVectorNWU[2] + yOffsetPixels;
const z = -positionVectorNWU[0] + zOffsetPixels;
return new Cogl.VertexP3T2({x, y, z, s, t});
}
const vertices = [];
for (let j = 0; j < ySegments; j++) {
const texY0 = texYTop - (texYTop - texYBottom) * j / ySegments;
const texY1 = texYTop - (texYTop - texYBottom) * (j + 1) / ySegments;
const evenRow = j % 2 === 0;
for (let i = 0; i <= xSegments; i++) {
// even rows stitch left-to-right, odd rows stitch right-to-left
const colIndex = evenRow ? i : xSegments - i;
const texX = texXLeft + (texXRight - texXLeft) * colIndex / xSegments;
// bottom then top
vertices.push(v(texX, texY1));
vertices.push(v(texX, texY0));
}
}
return vertices;
}
export const VirtualDisplayEffect = GObject.registerClass({
Properties: {
'monitor-index': GObject.ParamSpec.int(
'monitor-index',
'Monitor Index',
'Index of the monitor that this effect is applied to',
GObject.ParamFlags.READWRITE,
0, 100, 0
),
'monitor-details': GObject.ParamSpec.jsobject(
'monitor-details',
'Monitor Details',
'Details about the monitor that this effect is applied to',
GObject.ParamFlags.READWRITE
),
'monitor-placements': GObject.ParamSpec.jsobject(
'monitor-placements',
'Monitor Placements',
'Target and virtual monitor placement details, as relevant to rendering',
GObject.ParamFlags.READWRITE
),
'fov-details': GObject.ParamSpec.jsobject(
'fov-details',
'FOV Details',
'Details about the field of view of the headset',
GObject.ParamFlags.READWRITE
),
'target-monitor': GObject.ParamSpec.jsobject(
'target-monitor',
'Target Monitor',
'Details about the monitor being used as a viewport',
GObject.ParamFlags.READWRITE
),
'imu-snapshots': GObject.ParamSpec.jsobject(
'imu-snapshots',
'IMU Snapshots',
'Latest IMU quaternion snapshots and epoch timestamp for when it was collected',
GObject.ParamFlags.READWRITE
),
'pose-has-position': GObject.ParamSpec.boolean(
'pose-has-position',
'Pose Has Position',
'Whether the IMU snapshots contain pose data',
GObject.ParamFlags.READWRITE,
false
),
'smooth-follow-enabled': GObject.ParamSpec.boolean(
'smooth-follow-enabled',
'Smooth follow enabled',
'Whether smooth follow is enabled',
GObject.ParamFlags.READWRITE,
false
),
'smooth-follow-toggle-epoch-ms': GObject.ParamSpec.uint64(
'smooth-follow-toggle-epoch-ms',
'Smooth follow toggle epoch time',
'ms since epoch when smooth follow was toggled',
GObject.ParamFlags.READWRITE,
0, Number.MAX_SAFE_INTEGER, 0
),
'focused-monitor-index': GObject.ParamSpec.int(
'focused-monitor-index',
'Focused Monitor Index',
'Index of the monitor that is currently focused',
GObject.ParamFlags.READWRITE,
-1, 100, -1
),
'display-zoom-on-focus': GObject.ParamSpec.boolean(
'display-zoom-on-focus',
'Display zoom on focus',
'Automatically move a display closer when it becomes focused.',
GObject.ParamFlags.READWRITE,
true
),
'display-size': GObject.ParamSpec.double(
'display-size',
'Display size',
'Size of the display',
GObject.ParamFlags.READWRITE,
0.1,
2.5,
1.0
),
'display-distance': GObject.ParamSpec.double(
'display-distance',
'Display Distance',
'Distance of the display from the camera',
GObject.ParamFlags.READWRITE,
0.1,
2.5,
1.0
),
'display-distance-default': GObject.ParamSpec.double(
'display-distance-default',
'Display distance default',
'Distance to use when not explicitly set, or when reset',
GObject.ParamFlags.READWRITE,
0.1,
2.5,
1.0
),
'show-banner': GObject.ParamSpec.boolean(
'show-banner',
'Show banner',
'Whether the banner should be displayed',
GObject.ParamFlags.READWRITE,
false
),
'lens-vector': GObject.ParamSpec.jsobject(
'lens-vector',
'Lens Vector',
'Vector representing the offset of the lens from the pivot point',
GObject.ParamFlags.READWRITE
),
'actor-to-display-ratios': GObject.ParamSpec.jsobject(
'actor-to-display-ratios',
'Actor to Display Ratios',
'Ratios to convert actor coordinates to display coordinates',
GObject.ParamFlags.READWRITE
),
'actor-to-display-offsets': GObject.ParamSpec.jsobject(
'actor-to-display-offsets',
'Actor to Display Offsets',
'Offsets to convert actor coordinates to display coordinates',
GObject.ParamFlags.READWRITE
),
'is-closest': GObject.ParamSpec.boolean(
'is-closest',
'Is Closest',
'Whether this monitor is the closest to the camera',
GObject.ParamFlags.READWRITE,
false
),
'disable-anti-aliasing': GObject.ParamSpec.boolean(
'disable-anti-aliasing',
'Disable anti-aliasing',
'Disable anti-aliasing for the effect',
GObject.ParamFlags.READWRITE,
false
),
'look-ahead-override': GObject.ParamSpec.int(
'look-ahead-override',
'Look ahead override',
'Override the look ahead value',
GObject.ParamFlags.READWRITE,
-1,
45,
-1
),
}
}, class VirtualDisplayEffect extends Shell.GLSLEffect {
constructor(params = {}) {
super(params);
this._current_display_distance = this._is_focused() ? this.display_distance : this.display_distance_default;
this.no_distance_ease = false;
this._current_follow_ease_progress = 0.0;
this._use_smooth_follow_origin = false;
this.connect('notify::display-distance', this._update_display_distance.bind(this));
this.connect('notify::display-distance-default', this._update_display_distance.bind(this));
this.connect('notify::display-size', this._update_display_position.bind(this));
this.connect('notify::focused-monitor-index', this._update_display_distance.bind(this));
this.connect('notify::monitor-placements', this._update_display_position.bind(this));
this.connect('notify::show-banner', this._handle_banner_update.bind(this));
this.connect('notify::smooth-follow-enabled', this._handle_smooth_follow_enabled_update.bind(this));
this._update_display_position();
}
_is_focused() {
return this.focused_monitor_index === this.monitor_index;
}
_update_display_distance() {
const desired_distance = this._is_focused() ? this.display_distance : this.display_distance_default;
if (this._distance_ease_timeline?.is_playing()) {
// we're already easing towards the desired distance, do nothing
if (this._distance_ease_target === desired_distance) return;
this._distance_ease_timeline.stop();
}
if (this.no_distance_ease) {
this._current_display_distance = desired_distance;
this._update_display_position();
this.no_distance_ease = false;
return;
}
// if we're the focused display, we'll double the timeline and wait for the first half to let other
// displays ease out first
this._distance_ease_focus = this._is_focused();
const ease_out_timeline_ms = 150;
const pause_ms = 50;
const ease_in_timeline_ms = 500; // includes ease out and pause
const ease_in_begin_pct = (ease_out_timeline_ms + pause_ms) / ease_in_timeline_ms;
const timeline_ms = this._distance_ease_focus ?
ease_in_timeline_ms :
ease_out_timeline_ms;
this._distance_ease_start = this._current_display_distance;
this._distance_ease_timeline = Clutter.Timeline.new_for_actor(this.get_actor(), timeline_ms);
this._distance_ease_target = desired_distance;
this._distance_ease_timeline.connect('new-frame', (() => {
let progress = this._distance_ease_timeline.get_progress();
if (this._distance_ease_focus) {
// if we're the focused display, wait for the first half of the timeline to pass
if (progress < ease_in_begin_pct) return;
// treat the second half of the timeline as its own full progression
progress = (progress - ease_in_begin_pct) / (1 - ease_in_begin_pct);
// put this display in front as it starts to easy in
this.is_closest = true;
} else {
this.is_closest = false;
}
this._current_display_distance = this._distance_ease_start +
(1 - Math.cos(progress * Math.PI)) / 2 * (this._distance_ease_target - this._distance_ease_start);
this._update_display_position();
}).bind(this));
this._distance_ease_timeline.start();
if (this.smooth_follow_enabled) this._handle_smooth_follow_enabled_update();
}
_handle_smooth_follow_enabled_update() {
// we'll re-trigger this once a monitor becomes focused
if (this.focused_monitor_index === -1) return;
this._use_smooth_follow_origin = false;
if (this._follow_ease_timeline?.is_playing()) this._follow_ease_timeline.stop();
const ease_to_focus = this.smooth_follow_enabled && this._is_focused();
const from = this._current_follow_ease_progress;
const to = ease_to_focus ? 1.0 : 0.0;
const toggleTime = this.smooth_follow_toggle_epoch_ms === 0 ? Date.now() : this.smooth_follow_toggle_epoch_ms;
// would have been a slight delay between request and slerp actually starting
const toggleDelayMs = (Date.now() - toggleTime) * 0.75;
const slerpStartTime = toggleTime + toggleDelayMs;
if (to !== from) {
this._follow_ease_timeline = Clutter.Timeline.new_for_actor(
this.get_actor(),
SMOOTH_FOLLOW_SLERP_TIMELINE_MS - toggleDelayMs
);
this._follow_ease_timeline.connect('new-frame', ((timeline, elapsed_ms) => {
const toggleTimeOffsetMs = Date.now() - slerpStartTime;
// this relies on the slerp function tuned to reach 100% in about 1 second
const progress = smoothFollowSlerpProgress(toggleTimeOffsetMs);
this._current_follow_ease_progress = from + (to - from) * progress;
this._update_display_position();
}).bind(this));
this._follow_ease_timeline.connect('completed', (() => {
this._current_follow_ease_progress = to;
this._use_smooth_follow_origin = false;
this.smooth_follow_toggle_epoch_ms = 0;
this._update_display_position();
}).bind(this));
this._follow_ease_timeline.start();
} else if (!this.smooth_follow_enabled) {
// smooth follow has been turned off and this screen wasn't the focus,
// continue to use the smooth_follow_origin data for 1 more second
this._use_smooth_follow_origin = true;
GLib.timeout_add(
GLib.PRIORITY_DEFAULT,
SMOOTH_FOLLOW_SLERP_TIMELINE_MS - toggleDelayMs,
(() => {
this._use_smooth_follow_origin = false;
this.smooth_follow_toggle_epoch_ms = 0;
this._current_follow_ease_progress = to;
return GLib.SOURCE_REMOVE;
}).bind(this)
);
}
}
// follow_ease transitions this from a rotated display (progress 0.0) to a centered/focused display (progress 1.0)
_update_display_position() {
// this is in NWU coordinates
const monitorPlacement = this.monitor_placements[this.monitor_index];
const noRotationVector = monitorPlacement.centerNoRotate.map(coord => coord * this._current_display_distance / this.display_distance_default);
const inverse_follow_ease = 1.0 - this._current_follow_ease_progress;
let finalPositionVector = noRotationVector;
if (this._current_follow_ease_progress > 0.0) {
// slerp from the rotated display to the centered display
finalPositionVector = noRotationVector.map(coord => coord * inverse_follow_ease);
finalPositionVector[0] = noRotationVector[0];
}
const resizedMonitorDetails = {
width: this.monitor_details.width * this.fov_details.distanceAdjustedSize,
height: this.monitor_details.height * this.fov_details.distanceAdjustedSize
};
this._vertices = createVertexMesh(this.fov_details, resizedMonitorDetails, finalPositionVector);
const rotation_radians = this.monitor_placements[this.monitor_index].rotationAngleRadians;
if (this._initialized) {
this.set_uniform_float(this.get_uniform_location("u_rotation_x_radians"), 1, [rotation_radians.x * inverse_follow_ease]);
this.set_uniform_float(this.get_uniform_location("u_rotation_y_radians"), 1, [rotation_radians.y * inverse_follow_ease]);
}
}
_handle_banner_update() {
this.set_uniform_float(this.get_uniform_location("u_show_banner"), 1, [this.show_banner ? 1.0 : 0.0]);
}
perspective(widthUnitDistance, aspect, near, far) {
const f = 2.0 / widthUnitDistance;
const range = far - near;
return [
f / aspect, 0, 0, 0,
0, f, 0, 0,
0, 0, - (far + near) / range, -1,
0, 0, - (2.0 * near * far) / range, 0
];
}
vfunc_build_pipeline() {
const declarations = `
uniform bool u_show_banner;
uniform mat4 u_pose_orientation;
uniform vec3 u_pose_position;
uniform float u_look_ahead_ms;
uniform vec4 u_look_ahead_cfg;
uniform mat4 u_projection_matrix;
uniform float u_fov_vertical_radians;
uniform float u_rotation_x_radians;
uniform float u_rotation_y_radians;
uniform vec2 u_display_resolution;
uniform vec3 u_lens_vector;
// vector positions are relative to the width and height of the entire stage
uniform vec2 u_actor_to_display_ratios;
uniform vec2 u_actor_to_display_offsets;
// discovered through trial and error, no idea the significance
float cogl_position_mystery_factor = 29.09 * 2;
float look_ahead_ms_cap = 45.0;
vec4 quatConjugate(vec4 q) {
return vec4(-q.xyz, q.w);
}
vec3 applyQuaternionToVector(vec3 v, vec4 q) {
vec3 t = 2.0 * cross(q.xyz, v);
return v + q.w * t + cross(q.xyz, t);
}
vec3 applyXRotationToVector(vec3 v, float angle) {
float c = cos(angle);
float s = sin(angle);
return vec3(v.x, v.y * c - v.z * s, v.y * s + v.z * c);
}
vec3 applyYRotationToVector(vec3 v, float angle) {
float c = cos(angle);
float s = sin(angle);
return vec3(v.x * c + v.z * s, v.y, v.z * c - v.x * s);
}
vec4 nwuToEUS(vec4 v) {
return vec4(-v.y, v.z, -v.x, v.w);
}
vec3 nwuToEUS(vec3 v) {
return vec3(-v.y, v.z, -v.x);
}
// returns the rate of change between the two vectors, in same time units as delta_time
// e.g. if delta_time is in ms, then the rate of change is "per ms"
vec3 rateOfChange(vec3 v1, vec3 v2, float delta_time) {
return (v1-v2) / delta_time;
}
// attempt to figure out where the current position should be based on previous position and velocity.
// velocity and time values should use the same time units (secs, ms, etc...)
vec3 applyLookAhead(vec3 position, vec3 velocity, float look_ahead_ms) {
return position + velocity * look_ahead_ms;
}
// project the vector onto a flat surface, return it's vertical position relative to the vertical fov, where 0.0 is
// the top and 1.0 is the bottom. vectors that project outside the vertical range of the display will have values
// outside this range, but capped
float vectorToScanline(float fovVerticalRadians, vec3 v) {
return clamp(1.0 - (-v.y / (tan(fovVerticalRadians / 2.0) * v.z) + 1.0) / 2.0, -1.5, 2.5);
}
`;
const main = `
vec4 world_pos = cogl_position_in;
if (!u_show_banner) {
float aspect_ratio = u_display_resolution.x / u_display_resolution.y;
vec4 quat_t0 = nwuToEUS(quatConjugate(u_pose_orientation[0]));
vec3 position_vector = applyQuaternionToVector(nwuToEUS(u_pose_position), quat_t0);
vec3 final_lens_position = nwuToEUS(u_lens_vector) + position_vector;
vec3 complete_vector = applyXRotationToVector(world_pos.xyz, u_rotation_x_radians);
complete_vector = applyYRotationToVector(complete_vector, u_rotation_y_radians);
vec3 rotated_vector_t0 = applyQuaternionToVector(complete_vector, quat_t0);
vec3 rotated_vector_t1 = applyQuaternionToVector(complete_vector, nwuToEUS(quatConjugate(u_pose_orientation[1])));
float delta_time_t0 = u_pose_orientation[3][0] - u_pose_orientation[3][1];
// how quickly the vertex is moving relative to the camera
vec3 velocity_t0 = rateOfChange(
rotated_vector_t0 - final_lens_position,
rotated_vector_t1 - final_lens_position,
delta_time_t0
);
// compute the capped look ahead with scanline adjustments
float look_ahead_scanline_ms = u_look_ahead_ms == 0.0 ? 0.0 : vectorToScanline(u_fov_vertical_radians, rotated_vector_t0) * u_look_ahead_cfg[2];
float effective_look_ahead_ms = min(min(u_look_ahead_ms, look_ahead_ms_cap), u_look_ahead_cfg[3]) + look_ahead_scanline_ms;
vec3 look_ahead_vector = applyLookAhead(rotated_vector_t0, velocity_t0, effective_look_ahead_ms);
world_pos = vec4(look_ahead_vector - final_lens_position, world_pos.w);
world_pos.z /= aspect_ratio / u_actor_to_display_ratios.y;
world_pos.x *= u_actor_to_display_ratios.y / u_actor_to_display_ratios.x;
world_pos = u_projection_matrix * world_pos;
// if the perspective includes more than just our viewport actor, move the vertices back to just the area we can see.
// this needs to be done after the projection matrix multiplication so it will be projected as if centered in our vision
world_pos.x -= (u_actor_to_display_offsets.x / u_actor_to_display_ratios.x) * world_pos.w;
world_pos.y += (u_actor_to_display_offsets.y / u_actor_to_display_ratios.y) * world_pos.w;
} else {
world_pos = cogl_modelview_matrix * world_pos;
world_pos = cogl_projection_matrix * world_pos;
}
cogl_position_out = world_pos;
cogl_tex_coord_out[0] = cogl_tex_coord_in;
`
this.add_glsl_snippet(Cogl.SnippetHook?.VERTEX ?? Shell.SnippetHook.VERTEX, declarations, main, false);
}
vfunc_paint_target(node, paintContext) {
if (!this._initialized) {
this._initialized = true;
const aspect = this.target_monitor.width / this.target_monitor.height;
const fovLengths = diagonalToCrossFOVs(degreeToRadian(Globals.data_stream.device_data.displayFov), aspect);
const projection_matrix = this.perspective(
fovLengths.widthUnitDistance,
aspect,
1.0,
10000.0
);
this.set_uniform_matrix(this.get_uniform_location("u_projection_matrix"), false, 4, projection_matrix);
this.set_uniform_float(this.get_uniform_location("u_fov_vertical_radians"), 1, [fovLengths.verticalRadians]);
this.set_uniform_float(this.get_uniform_location("u_display_resolution"), 2, [this.target_monitor.width, this.target_monitor.height]);
this.set_uniform_float(this.get_uniform_location("u_look_ahead_cfg"), 4, Globals.data_stream.device_data.lookAheadCfg);
this.set_uniform_float(this.get_uniform_location("u_actor_to_display_ratios"), 2, this.actor_to_display_ratios);
this.set_uniform_float(this.get_uniform_location("u_actor_to_display_offsets"), 2, this.actor_to_display_offsets);
this._update_display_position();
this._handle_banner_update();
}
this.set_uniform_float(this.get_uniform_location("u_lens_vector"), 3, this.pose_has_position ? [0.0, 0.0, 0.0] : this.lens_vector);
if (this.imu_snapshots && !this.show_banner) {
let lookAheadSet = false;
if (!this._use_smooth_follow_origin && (!this.smooth_follow_enabled || this._is_focused() || this._current_follow_ease_progress > 0.0)) {
if (this._current_follow_ease_progress > 0.0 && this._current_follow_ease_progress < 1.0) {
// don't apply look-ahead while the display is slerping
this.set_uniform_float(this.get_uniform_location('u_look_ahead_ms'), 1, [0.0]);
lookAheadSet = true;
}
this.set_uniform_matrix(this.get_uniform_location("u_pose_orientation"), false, 4, this.imu_snapshots.pose_orientation);
} else {
this.set_uniform_matrix(this.get_uniform_location("u_pose_orientation"), false, 4, this.imu_snapshots.smooth_follow_origin);
}
let posePositionPixels = [0.0, 0.0, 0.0];
if (this.pose_has_position) {
posePositionPixels = this.imu_snapshots.pose_position.map((coord, index) => {
return coord * this.fov_details.fullScreenDistancePixels + this.lens_vector[index];
});
}
this.set_uniform_float(this.get_uniform_location("u_pose_position"), 3, posePositionPixels);
if (!lookAheadSet) {
this.set_uniform_float(this.get_uniform_location('u_look_ahead_ms'), 1, [lookAheadMS(this.imu_snapshots.timestamp_ms, Globals.data_stream.device_data.lookAheadCfg, this.look_ahead_override)]);
}
if (!this.disable_anti_aliasing) {
// improves sampling quality for smooth text and edges
this.get_pipeline().set_layer_filters(
0,
Cogl.PipelineFilter.LINEAR_MIPMAP_LINEAR,
Cogl.PipelineFilter.LINEAR
);
}
// skip the actor's default rendering, draw our custom vertices instead
const framebuffer = paintContext.get_framebuffer();
const coglContext = framebuffer.get_context();
const primitive = Cogl.Primitive.new_p3t2(coglContext, Cogl.VerticesMode.TRIANGLE_STRIP, this._vertices);
primitive.draw(framebuffer, this.get_pipeline());
} else {
super.vfunc_paint_target(node, paintContext);
}
}
});

File diff suppressed because it is too large Load Diff

View File

@ -1,64 +0,0 @@
cmake_minimum_required(VERSION 3.20)
project(breezy_desktop VERSION 0.0.1 LANGUAGES CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(cmake/default-vars.cmake)
find_package(ECM "5.100" REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${ECM_MODULE_PATH}
${ECM_KDE_MODULE_DIR}
)
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
# required frameworks by Core
find_package(KF6 REQUIRED COMPONENTS
Config
ConfigWidgets
CoreAddons
GlobalAccel
I18n
KCMUtils
WindowSystem
XmlGui
)
find_package(KWin REQUIRED COMPONENTS kwineffects)
message(STATUS "Found KWin Version: ${KWin_VERSION}")
include(cmake/info.cmake)
find_package(epoxy REQUIRED)
find_package(XCB REQUIRED COMPONENTS XCB)
find_package(KWinDBusInterface CONFIG REQUIRED)
find_package(Qt6 REQUIRED COMPONENTS Core Network)
# Qt6 sets QT6_INSTALL_QML which is distro-aware
get_target_property(QT6_QMAKE_EXECUTABLE Qt6::qmake IMPORTED_LOCATION)
execute_process(
COMMAND ${QT6_QMAKE_EXECUTABLE} -query QT_INSTALL_QML
OUTPUT_VARIABLE QT6_QML_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
find_path(QT6_QUICK3D_QML_DIR
NAMES QtQuick3D
PATHS ${QT6_QML_DIR}
NO_DEFAULT_PATH
)
if(NOT QT6_QUICK3D_QML_DIR)
message(FATAL_ERROR "cmake could not find the QtQuick3D QML module.")
endif()
add_subdirectory(src)
ki18n_install(po)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
include(cmake/test.cmake)
include(cmake/pack.cmake)

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
# exit when any command fails
set -e
if [ "$(id -u)" == "0" ]; then
echo "This script must not be run as root" 1>&2
exit 1
fi
# Create a temp directory to gather logs
tmp_dir=$(mktemp -d -t breezy-kwin-logs-XXXXXXXXXX)
echo "Gathering logs into temp directory: ${tmp_dir}"
mkdir -p "$tmp_dir/breezy_kwin_logs"
# Collect journalctl logs
if command -v journalctl &>/dev/null; then
journalctl -p warning --since "24 hours ago" > "$tmp_dir/breezy_kwin_logs/journalctl_warnings.log" 2>/dev/null || \
echo "Warning: Failed to collect journalctl warning logs"
journalctl --grep breezy --since "24 hours ago" > "$tmp_dir/breezy_kwin_logs/journalctl_breezy.log" 2>/dev/null || \
echo "Warning: Failed to collect journalctl breezy logs"
else
echo "Warning: journalctl not found, skipping journal logs"
fi
# Create archive
archive_name="breezy_kwin_logs_$(date +%Y%m%d_%H%M%S).tar.gz"
tar -czf "$archive_name" -C "$tmp_dir" breezy_kwin_logs
echo "Created log archive: $(pwd)/$archive_name"
rm -rf "$tmp_dir"

View File

@ -1,126 +0,0 @@
#!/usr/bin/env bash
for_install=0
if [[ -n "$1" ]] && [[ "$1" == "--for-install" ]]; then
for_install=1
fi
# we don't want the uninstall script to be able to cause a failure if being triggered by the setup script
[ "$for_install" -eq 0 ] && set -e
if command -v qdbus >/dev/null 2>&1; then
QDBUS_CMD=$(command -v qdbus)
elif command -v qdbus6 >/dev/null 2>&1; then
QDBUS_CMD=$(command -v qdbus6)
fi
if [ -n "$QDBUS_CMD" ]; then
if $QDBUS_CMD org.kde.KWin /Effects org.kde.kwin.Effects.unloadEffect breezy_desktop; then
[ "$for_install" -eq 0 ] && echo "Unloaded breezy_desktop effect"
fi
fi
USER_HOME=$(realpath ~)
if [ "$for_install" -eq 0 ]; then
UA_EVENT_NAME="breezy_kwin_uninstall"
UA_CLIENT_ID="BreezyKWin"
#INJECT_UA_CALL
fi
if [ -z "$XDG_BIN_HOME" ]; then
XDG_BIN_HOME="$USER_HOME/.local/bin"
fi
if [ -z "$XDG_DATA_HOME" ]; then
XDG_DATA_HOME="$USER_HOME/.local/share"
fi
if [ -z "$LIB_HOME" ]; then
LIB_HOME="$USER_HOME/.local/lib"
fi
EFFECT_ID="breezy_desktop"
EFFECT_DIR="$XDG_DATA_HOME/kwin/effects/$EFFECT_ID"
ICON_PATH="$XDG_DATA_HOME/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg"
DESKTOP_FILE_PATH="$XDG_DATA_HOME/applications/breezy_desktop.desktop"
PLUGIN_SO="$LIB_HOME/qt6/plugins/kwin/effects/plugins/${EFFECT_ID}.so"
CONFIG_SO="$LIB_HOME/qt6/plugins/plasma/kcms/${EFFECT_ID}_config.so"
BREEZY_LIBRARY_DIR="$LIB_HOME/breezy_kwin"
ENABLE_SCRIPT="$XDG_BIN_HOME/breezy_enable_wayland"
DISABLE_SCRIPT="$XDG_BIN_HOME/breezy_disable_wayland"
STEAMOS_ENABLE_DESKTOP="$XDG_DATA_HOME/applications/Enable Breezy Wayland.desktop"
STEAMOS_DISABLE_DESKTOP="$XDG_DATA_HOME/applications/Disable Breezy Wayland.desktop"
DESKTOP_DIR="$USER_HOME/Desktop"
DESKTOP_ENABLE="$DESKTOP_DIR/Enable Breezy Wayland.desktop"
DESKTOP_DISABLE="$DESKTOP_DIR/Disable Breezy Wayland.desktop"
if [[ -d "$EFFECT_DIR" ]]; then
[ "$for_install" -eq 0 ] && echo "Removing $EFFECT_DIR and its contents"
rm -rf "$EFFECT_DIR"
fi
if [[ -f "$ICON_PATH" ]]; then
[ "$for_install" -eq 0 ] && echo "Removing $ICON_PATH"
rm -f "$ICON_PATH"
fi
if [[ -f "$DESKTOP_FILE_PATH" ]]; then
[ "$for_install" -eq 0 ] && echo "Removing $DESKTOP_FILE_PATH"
rm -f "$DESKTOP_FILE_PATH"
fi
if [[ -f "$PLUGIN_SO" ]]; then
[ "$for_install" -eq 0 ] && echo "Removing $PLUGIN_SO"
rm -f "$PLUGIN_SO"
fi
if [[ -f "$CONFIG_SO" ]]; then
[ "$for_install" -eq 0 ] && echo "Removing $CONFIG_SO"
rm -f "$CONFIG_SO"
fi
if [[ -d "$BREEZY_LIBRARY_DIR" ]]; then
[ "$for_install" -eq 0 ] && echo "Removing $BREEZY_LIBRARY_DIR and its contents"
rm -rf "$BREEZY_LIBRARY_DIR"
fi
if [[ -f "$ENABLE_SCRIPT" ]]; then
[ "$for_install" -eq 0 ] && echo "Removing SteamOS desktop scripts"
rm -f "$ENABLE_SCRIPT"
fi
removed_wayland_disable_script=0
if [[ -f "$DISABLE_SCRIPT" ]]; then
rm -f "$DISABLE_SCRIPT"
removed_wayland_disable_script=1
fi
if [[ -f "$STEAMOS_ENABLE_DESKTOP" ]]; then
rm -f "$STEAMOS_ENABLE_DESKTOP"
fi
if [[ -f "$STEAMOS_DISABLE_DESKTOP" ]]; then
rm -f "$STEAMOS_DISABLE_DESKTOP"
fi
if [[ -f "$DESKTOP_ENABLE" ]]; then
rm -f "$DESKTOP_ENABLE"
fi
if [[ -f "$DESKTOP_DISABLE" ]]; then
rm -f "$DESKTOP_DISABLE"
fi
if [[ -e "$XDG_BIN_HOME/xr_driver_uninstall" && "$for_install" -eq 0 ]]; then
echo "Uninstalling XRLinuxDriver"
sudo "$XDG_BIN_HOME/xr_driver_uninstall"
fi
rm -f $XDG_BIN_HOME/breezy_kwin_logs
if [ "$removed_wayland_disable_script" -eq 1 ] && [ "$for_install" -eq 0 ]; then
printf "\n\033[1;33m!!! IMPORTANT !!!\033[0m If you enabled Breezy Wayland, you MUST run \033[1;33msteamos-session-select\033[0m from a terminal in order to return to Game Mode.\n"
fi
# this script is self-deleting, leave this as the last command
rm -f $XDG_BIN_HOME/breezy_kwin_uninstall

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
# exit when any command fails
set -e
check_command() {
if ! command -v "$1" &>/dev/null; then
echo "Please install \"$1\" and make sure it's available in your \$PATH, then rerun the setup."
exit 1
fi
}
check_command "cmake"
check_command "make"
ARCH=${ARCH:-$(uname -m)}
if [ -n "${STEAMOS+x}" ]; then
ARCH="steamos-$STEAMOS"
fi
echo "Building Breezy KWin plugin for $ARCH"
BUILD_PATH=build
rm -rf $BUILD_PATH
mkdir $BUILD_PATH
pushd $BUILD_PATH > /dev/null
cmake ..
make
cpack -G TGZ
popd > /dev/null
mkdir -p out
cp $BUILD_PATH/breezy_desktop.tar.gz out/breezyKWinPlugin-$ARCH.tar.gz

View File

@ -1,268 +0,0 @@
#!/usr/bin/env bash
set -e
if [ "$XDG_SESSION_TYPE" != "wayland" ]; then
printf "\033[1;33mWARNING:\033[0m Windowing system is %s\n" "$XDG_SESSION_TYPE"
printf "\033[1;33mWARNING:\033[0m Virtual display functionality requires Wayland\n"
fi
install_steamos_shortcuts() {
if [[ "${ARCH:-}" != "steamos-3.7" ]]; then
return
fi
local os_release="/etc/os-release"
if [[ ! -r "$os_release" ]]; then
return
fi
local ID=""
local ID_LIKE=""
# shellcheck disable=SC1090
source "$os_release"
if [[ "$ID" != "steamos" && "$ID_LIKE" != *"steamos"* && "$ID_LIKE" != *"steamdeck"* ]]; then
return
fi
if ! command -v steamos-session-select >/dev/null 2>&1; then
echo "Skipping SteamOS shortcuts: steamos-session-select not found"
return
fi
local applications_dir="$HOME/.local/share/applications"
local desktop_dir="$HOME/Desktop"
local enable_script="$XDG_BIN_HOME/breezy_enable_wayland"
local disable_script="$XDG_BIN_HOME/breezy_disable_wayland"
local enable_desktop="$applications_dir/Enable Breezy Wayland.desktop"
local disable_desktop="$applications_dir/Disable Breezy Wayland.desktop"
local desktop_enable="$desktop_dir/Enable Breezy Wayland.desktop"
local desktop_disable="$desktop_dir/Disable Breezy Wayland.desktop"
mkdir -p "$applications_dir" "$desktop_dir"
cat > "$enable_script" <<'EOF'
#!/usr/bin/env bash
set -e
MESSAGE="IMPORTANT - You will be unable to return to Game Mode until you use the Disable Breezy Wayland script."
if command -v kdialog >/dev/null 2>&1; then
if ! kdialog --warningyesno "$MESSAGE" --title "Enable Breezy Wayland" --yes-label "Enable" --no-label "Cancel"; then
exit 0
fi
elif command -v zenity >/dev/null 2>&1; then
if ! zenity --question --title="Enable Breezy Wayland" --text="$MESSAGE" --ok-label="Enable" --cancel-label="Cancel" --no-wrap; then
exit 0
fi
else
echo "$MESSAGE"
read -r -p "Type 'enable' to continue: " confirmation
if [[ "$confirmation" != "enable" ]]; then
exit 0
fi
fi
exec steamos-session-select plasma-wayland-persistent
EOF
cat > "$disable_script" <<'EOF'
#!/usr/bin/env bash
set -e
exec steamos-session-select
EOF
chmod +x "$enable_script" "$disable_script"
cat > "$enable_desktop" <<EOF
[Desktop Entry]
Type=Application
Name=Enable Breezy Wayland
Comment=Enable Wayland for Breezy Desktop virtual displays
Exec=$enable_script
Icon=com.xronlinux.BreezyDesktop
Categories=Utility;
Terminal=false
StartupNotify=false
EOF
cat > "$disable_desktop" <<EOF
[Desktop Entry]
Type=Application
Name=Disable Breezy Wayland
Comment=Disable Wayland, allow return to Game Mode
Exec=$disable_script
Icon=com.xronlinux.BreezyDesktop
Categories=Utility;
Terminal=false
StartupNotify=false
EOF
chmod 644 "$enable_desktop" "$disable_desktop"
command cp "$enable_desktop" "$desktop_enable"
command cp "$disable_desktop" "$desktop_disable"
chmod 755 "$desktop_enable" "$desktop_disable"
echo "Installed SteamOS desktop shortcuts in $applications_dir and on $desktop_dir"
}
USER_HOME=$(realpath ~)
if [ -z "$XDG_DATA_HOME" ]; then
XDG_DATA_HOME="$USER_HOME/.local/share"
fi
fix_xr_gaming_plugin() {
# Allows the plugin and Breezy Desktop to coexist without fighting over the driver version
local breezy_manifest="$XDG_DATA_HOME/breezy_vulkan/manifest"
if [[ ! -f "$breezy_manifest" ]]; then
return 0
fi
local decky_xr_gaming_settings="$USER_HOME/homebrew/settings/decky-XRGaming/settings.json"
if [[ ! -f "$decky_xr_gaming_settings" ]]; then
return 0
fi
local xr_driver_manifest="$XDG_DATA_HOME/xr_driver/manifest"
if [[ ! -f "$xr_driver_manifest" ]]; then
return 0
fi
local XR_DRIVER_MANIFEST_LINE
XR_DRIVER_MANIFEST_LINE=$(sha256sum "$xr_driver_manifest")
local xr_driver_manifest_hash
xr_driver_manifest_hash="${XR_DRIVER_MANIFEST_LINE%% *}"
if [[ -z "$xr_driver_manifest_hash" ]]; then
return 0
fi
echo "Fixing XR Gaming plugin installation"
local tmp_manifest
tmp_manifest=$(mktemp)
sed '/xr_driver\/manifest$/d' "$breezy_manifest" > "$tmp_manifest"
printf '%s xr_driver/manifest\n' "$xr_driver_manifest_hash" >> "$tmp_manifest"
chmod --reference="$breezy_manifest" "$tmp_manifest" 2>/dev/null || true
mv "$tmp_manifest" "$breezy_manifest"
local breezy_manifest_hash
breezy_manifest_hash="$(sha256sum "$breezy_manifest" | awk '{print $1}')"
if [[ -z "$breezy_manifest_hash" ]]; then
return 0
fi
local settings_dir
settings_dir="$(dirname "$decky_xr_gaming_settings")"
local tmp_settings
tmp_settings="$(mktemp -p "$settings_dir" settings.XXXXXX)"
sed -E 's/("manifest_checksum"[[:space:]]*:[[:space:]]*")[^"]*(")/\1'"$breezy_manifest_hash"'\2/' "$decky_xr_gaming_settings" > "$tmp_settings"
chmod --reference="$decky_xr_gaming_settings" "$tmp_settings" 2>/dev/null || true
mv "$tmp_settings" "$decky_xr_gaming_settings"
}
if [ -z "$XDG_BIN_HOME" ]; then
XDG_BIN_HOME="$USER_HOME/.local/bin"
fi
if [ -d "$XDG_BIN_HOME" ]; then
# check ownership and permissions before doing chown and chmod
XDG_BIN_USER=$(stat -c %U $XDG_BIN_HOME)
XDG_BIN_GROUP=$(stat -c %G $XDG_BIN_HOME)
USER=$(whoami)
GROUP=$(id -gn)
if [ "$XDG_BIN_USER" != "$USER" ] || [ "$XDG_BIN_GROUP" != "$GROUP" ]; then
echo "Fixing ownership and permissions of $XDG_BIN_HOME"
sudo chown -R $USER:$GROUP $XDG_BIN_HOME
sudo chmod -R 700 $XDG_BIN_HOME
fi
fi
UA_EVENT_NAME="breezy_kwin_install"
if [ -e "$XDG_BIN_HOME/breezy_kwin_uninstall" ]; then
echo "Cleaning up the previous installation"
# ` || true` will ensure that this can't cause a failure, even with `set -e`
$XDG_BIN_HOME/breezy_kwin_uninstall --for-install || true
UA_EVENT_NAME="breezy_kwin_update"
fi
UA_CLIENT_ID="BreezyKWin"
UA_EVENT_VERSION="$1"
#INJECT_UA_CALL
tar -xf $(pwd)/breezyKWinPlugin.tar.gz
pushd breezy_desktop/usr > /dev/null
echo "Copying KWin plugin files to $USER_HOME/.local/{lib,share}"
# locate the lib path that ends with qt6/plugins (handles multiarch dirs)
QT_PLUGIN_DIR_RELATIVE=$(find lib* -type d -path '*/qt6/plugins' -print -quit 2>/dev/null || true)
if [ -z "$QT_PLUGIN_DIR_RELATIVE" ]; then
QT_PLUGIN_DIR_RELATIVE="lib/qt6/plugins"
fi
# directory structure matches XDG, so just recursive copy
chmod -R 755 .
cp -r . "$USER_HOME/.local/"
popd > /dev/null
mkdir -p $XDG_BIN_HOME
cp bin/breezy_kwin_uninstall $XDG_BIN_HOME
cp bin/breezy_kwin_logs $XDG_BIN_HOME
install_steamos_shortcuts
# Install QT_PLUGIN_PATH snippet into ~/.bash_profile if not present
BASH_PROFILE="$HOME/.bash_profile"
QT_PLUGIN_DIR="$HOME/.local/$QT_PLUGIN_DIR_RELATIVE"
QT_PLUGIN_EXPORT="export QT_PLUGIN_PATH=\"$QT_PLUGIN_DIR:\$QT_PLUGIN_PATH\""
if [[ ! -f "$BASH_PROFILE" ]] || ! grep -Fq "$QT_PLUGIN_EXPORT" "$BASH_PROFILE" 2>/dev/null; then
echo "Adding QT_PLUGIN_PATH to $BASH_PROFILE"
mkdir -p "$(dirname "$BASH_PROFILE")"
cat >> "$BASH_PROFILE" <<EOF
# Added by Breezy Desktop installer: QT plugin path setup
$QT_PLUGIN_EXPORT
EOF
fi
PLASMA_ENV_SCRIPT="$HOME/.config/plasma-workspace/env/breezy_desktop.sh"
if [[ ! -f "$PLASMA_ENV_SCRIPT" ]]; then
echo "Adding QT_PLUGIN_PATH to $PLASMA_ENV_SCRIPT"
mkdir -p "$(dirname "$PLASMA_ENV_SCRIPT")"
cat >> "$PLASMA_ENV_SCRIPT" <<EOF
# Added by Breezy Desktop installer: QT plugin path setup
$QT_PLUGIN_EXPORT
EOF
fi
# set up the XR driver using the local binary
echo "Installing xrDriver (requires sudo)"
echo "BEGIN - xr_driver_setup"
if [ -z "$1" ]
then
sudo --preserve-env=SKIP_SYSTEMD bin/xr_driver_setup $(pwd)
else
sudo --preserve-env=SKIP_SYSTEMD bin/xr_driver_setup -v $1 $(pwd)
fi
echo "END - xr_driver_setup"
fix_xr_gaming_plugin
echo "Setting up productivity features"
printf "request_features=productivity,productivity_pro\n" >> /dev/shm/xr_driver_control 2>/dev/null || true
printf "\n\033[1;33m!!! IMPORTANT !!!\033[0m You must log out and back in, then enable Breezy Desktop from the Desktop Effects in System Settings\n\n"

View File

@ -1,15 +0,0 @@
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Force path to set CMAKE_INSTALL_PREFIX" FORCE)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE)
endif()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DQT_NO_DEBUG_OUTPUT")
set(QT_MIN_VERSION "6.4.0")
set(QT_MAJOR_VERSION 6)
set(KF_MIN_VERSION 6)

View File

@ -1,20 +0,0 @@
set(KWIN_EFFECT_INCLUDE_FILE "/usr/include/kwin/effect/effect.h")
execute_process(
COMMAND sh -c "grep '#define KWIN_EFFECT_API_VERSION_MINOR' ${KWIN_EFFECT_INCLUDE_FILE} | awk '{print \$NF}'"
OUTPUT_VARIABLE KWIN_EFFECT_API_VERSION_MINOR OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "Found KWinEffect API Version: ${KWIN_EFFECT_API_VERSION_MINOR}")
#below is a very useful way of finding variables and contains:
#get_cmake_property(_variableNames VARIABLES)
#list (SORT _variableNames)
#foreach (_variableName ${_variableNames})
# string(TOLOWER "${_variableName}" KEY)
# string(TOLOWER "${${_variableName}}" VALUE)
# string(FIND "${KEY}" "kwin" INDEX1)
# string(FIND "${VALUE}" "kwin" INDEX2)
# if (${INDEX1} GREATER -1 OR ${INDEX2} GREATER -1)
# message(STATUS "VARIABLE ${_variableName}=${${_variableName}}")
# endif ()
#endforeach()

View File

@ -1,18 +0,0 @@
# these are cache variables, so they could be overwritten with -D,
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME} CACHE STRING ${CMAKE_PROJECT_NAME})
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION "${CMAKE_PROJECT_VERSION}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Breezy Desktop - KWin Plugin")
set(CPACK_PACKAGE_CONTACT "wayne@xronlinux.com")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Wayne Heaney")
set(CPACK_DEBIAN_PACKAGE_SECTION "kde")
# autogenerate dependency information
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY "=")
include(CPack)
# To generate deb files, install 'dpkg-dev' package and then run 'cpack -G DEB'

View File

@ -1,2 +0,0 @@
add_test (NAME KWinEffectSupport COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/tools/isSupported.sh)
set_property (TEST KWinEffectSupport PROPERTY PASS_REGULAR_EXPRESSION "true")

View File

@ -1,37 +0,0 @@
# To run the build from the package root:
# docker buildx build --platform linux/amd64,linux/arm64 -f ./docker-build/Dockerfile.steamos-3.7 -t "breezy-kwin-steamos-3.7" .
# docker run --rm -t -v ./:/source -v --platform linux/amd64 "breezy-kwin-steamos-3.7:amd64"
FROM --platform=$TARGETPLATFORM ghcr.io/wheaney/holo-base:3.7.20@sha256:1478200c51b8b287e294de6e98a1ab0fb79333503a5cc5681b58dfd209f17851
ARG TARGETPLATFORM
ENV STEAMOS=3.7
RUN echo "SteamOS 3.7 build - target platform: $TARGETPLATFORM"
RUN pacman -Sy --noconfirm --needed \
ca-certificates \
base-devel \
cmake \
pkgconf \
git \
curl \
wget \
extra-cmake-modules \
qt6-base \
qt6-declarative \
qt6-quick3d \
qt6-tools \
kconfig \
kconfigwidgets \
kcoreaddons \
kglobalaccel \
ki18n \
kcmutils \
kxmlgui \
kwindowsystem \
kwin \
&& pacman -Scc --noconfirm
WORKDIR /source
CMD bin/package_kwin_plugin

View File

@ -1,37 +0,0 @@
# To run the build from the package root:
# docker buildx build --platform linux/amd64,linux/arm64 -f ./docker-build/Dockerfile.steamos-3.8 -t "breezy-kwin-steamos" .
# docker run --rm -t -v ./:/source -v --platform linux/amd64 "breezy-kwin-steamos-3.8:amd64"
FROM --platform=$TARGETPLATFORM ghcr.io/wheaney/holo-base:preview-3.8@sha256:a38cdf4ac0e9022ab55c2078381761b444362cfde63e61d988830b0aafb84850
ARG TARGETPLATFORM
ENV STEAMOS=3.8
RUN echo "SteamOS 3.8 build - target platform: $TARGETPLATFORM"
RUN pacman -Sy --noconfirm --needed \
ca-certificates \
base-devel \
cmake \
pkgconf \
git \
curl \
wget \
extra-cmake-modules \
qt6-base \
qt6-declarative \
qt6-quick3d \
qt6-tools \
kconfig \
kconfigwidgets \
kcoreaddons \
kglobalaccel \
ki18n \
kcmutils \
kxmlgui \
kwindowsystem \
kwin \
&& pacman -Scc --noconfirm
WORKDIR /source
CMD bin/package_kwin_plugin

View File

@ -1,37 +0,0 @@
# To run the build from the package root:
# docker buildx build --platform linux/amd64,linux/arm64 -f ./docker-build/Dockerfile.steamos-3.9 -t "breezy-kwin-steamos" .
# docker run --rm -t -v ./:/source -v --platform linux/amd64 "breezy-kwin-steamos-3.9:amd64"
FROM --platform=$TARGETPLATFORM ghcr.io/wheaney/holo-base:main-3.9@sha256:a9e2c59fb1274cf31d544229134e6bc653f050661dd9b64b05795b964468fcbf
ARG TARGETPLATFORM
ENV STEAMOS=3.9
RUN echo "SteamOS 3.9 build - target platform: $TARGETPLATFORM"
RUN pacman -Sy --noconfirm --needed \
ca-certificates \
base-devel \
cmake \
pkgconf \
git \
curl \
wget \
extra-cmake-modules \
qt6-base \
qt6-declarative \
qt6-quick3d \
qt6-tools \
kconfig \
kconfigwidgets \
kcoreaddons \
kglobalaccel \
ki18n \
kcmutils \
kxmlgui \
kwindowsystem \
kwin \
&& pacman -Scc --noconfirm
WORKDIR /source
CMD bin/package_kwin_plugin

View File

@ -1,23 +0,0 @@
#!/bin/bash
# might be needed on a fresh docker setup:
# install qemu and qemu-user-static packages
# sudo docker context rm default
docker run --privileged --rm tonistiigi/binfmt --install all
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
if [[ "$1" == "--init" || ! $(docker buildx inspect breezykwinbuilder &>/dev/null; echo $?) -eq 0 ]]; then
# start fresh
echo "Creating new docker builder instance"
docker buildx rm breezykwinbuilder 2>/dev/null || true
docker buildx create --use --name breezykwinbuilder --driver docker-container --driver-opt image=moby/buildkit:latest
else
echo "Using existing docker builder instance"
docker buildx use breezykwinbuilder
fi
echo "Building docker image"
docker buildx build --platform linux/amd64 -f ./docker-build/Dockerfile.steamos-3.7 -t "breezy-kwin-steamos-3.7:amd64" --load .
docker buildx build --platform linux/amd64 -f ./docker-build/Dockerfile.steamos-3.8 -t "breezy-kwin-steamos-3.8:amd64" --load .
docker buildx build --platform linux/amd64 -f ./docker-build/Dockerfile.steamos-3.9 -t "breezy-kwin-steamos-3.9:amd64" --load .

View File

@ -1,16 +0,0 @@
#!/bin/bash
set -e
USER=${SUDO_USER:-$USER}
GROUP=$(id -gn $USER)
# only SteamOS is pre-built
if [[ "$1" == steamos-* || -z "$1" ]]; then
sudo rm -rf build/
docker run --rm -t -v ./:/source --platform linux/amd64 "breezy-kwin-$1:amd64"
sudo chown -R $USER:$GROUP out/
fi
# build directory structure is all owned by root because of docker, delete it all now
sudo chown -R $USER:$GROUP build/

View File

@ -1,70 +0,0 @@
add_subdirectory(xrdriveripc)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/../VERSION" BREEZY_DESKTOP_VERSION_RAW)
if(NOT BREEZY_DESKTOP_VERSION_RAW)
set(BREEZY_DESKTOP_VERSION_RAW "dev")
endif()
string(STRIP "${BREEZY_DESKTOP_VERSION_RAW}" BREEZY_DESKTOP_VERSION)
add_subdirectory(kcm)
kcoreaddons_add_plugin(breezy_desktop INSTALL_NAMESPACE "kwin/effects/plugins/")
target_sources(breezy_desktop PRIVATE
breezydesktopeffect.cpp
main.cpp
)
kconfig_add_kcfg_files(breezy_desktop breezydesktopconfig.kcfgc)
# Split KWin version into numeric components (major, minor, patch)
string(REGEX MATCHALL "[0-9]+" KWIN_VERSION_COMPONENTS "${KWin_VERSION}")
# defaults
set(KWIN_VERSION_MAJOR 0)
set(KWIN_VERSION_MINOR 0)
set(KWIN_VERSION_PATCH 0)
list(LENGTH KWIN_VERSION_COMPONENTS _kwin_version_len)
if(_kwin_version_len GREATER 0)
list(GET KWIN_VERSION_COMPONENTS 0 KWIN_VERSION_MAJOR)
endif()
if(_kwin_version_len GREATER 1)
list(GET KWIN_VERSION_COMPONENTS 1 KWIN_VERSION_MINOR)
endif()
if(_kwin_version_len GREATER 2)
list(GET KWIN_VERSION_COMPONENTS 2 KWIN_VERSION_PATCH)
endif()
# optional: a single encoded integer (major*10000 + minor*100 + patch)
math(EXPR KWIN_VERSION_ENCODED "${KWIN_VERSION_MAJOR} * 10000 + ${KWIN_VERSION_MINOR} * 100 + ${KWIN_VERSION_PATCH}")
# Export as compile definitions. Keep the original string macro as well.
target_compile_definitions(breezy_desktop PRIVATE
KWIN_VERSION_STR=\"${KWin_VERSION}\"
KWIN_VERSION_MAJOR=${KWIN_VERSION_MAJOR}
KWIN_VERSION_MINOR=${KWIN_VERSION_MINOR}
KWIN_VERSION_PATCH=${KWIN_VERSION_PATCH}
KWIN_VERSION_ENCODED=${KWIN_VERSION_ENCODED}
BREEZY_DESKTOP_VERSION_STR=\"${BREEZY_DESKTOP_VERSION}\"
)
target_include_directories(breezy_desktop PRIVATE /usr/include/kwin)
target_include_directories(breezy_desktop PRIVATE xrdriveripc)
target_link_libraries(breezy_desktop
Qt6::Core
Qt6::Gui
Qt6::Quick
Qt6::DBus
KF6::ConfigCore
KF6::ConfigGui
KF6::CoreAddons
KF6::GlobalAccel
KF6::I18n
KF6::WindowSystem
KWin::kwin
xr_driver_ipc
)
install(DIRECTORY qml DESTINATION ${KDE_INSTALL_DATADIR}/kwin/effects/breezy_desktop)

View File

@ -1,111 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<group name="Effect-breezy_desktop">
<entry name="FocusedDisplayDistance" type="Int">
<default>22</default>
<min>10</min>
<max>250</max>
<label>Focused Display Distance</label>
</entry>
<entry name="AllDisplaysDistance" type="Int">
<default>25</default>
<min>10</min>
<max>250</max>
<label>All Displays Distance</label>
</entry>
<entry name="measurement_units" type="String">
<default>cm</default>
<label>Measurement units</label>
<description>Units for displaying distances in the KCM UI. Valid values: "cm" or "in".</description>
</entry>
<entry name="ZoomOnFocusEnabled" type="Bool">
<default>false</default>
<label>Zoom on Focus Enabled</label>
<description>Enable zooming in on the focused display.</description>
</entry>
<entry name="DisplaySpacing" type="Int">
<default>0</default>
<min>0</min>
<max>100</max>
<label>Display Spacing</label>
<description>How far apart the displays are visually (not logically)</description>
</entry>
<entry name="DisplaySize" type="Int">
<default>97</default>
<min>10</min>
<max>250</max>
<label>Display Size</label>
<description>Scale the displays in XR (percentage)</description>
</entry>
<entry name="DisplayHorizontalOffset" type="Int">
<default>0</default>
<min>-250</min>
<max>250</max>
<label>Display Horizontal Offset</label>
<description>Horizontal offset as a percent of the viewport width (-2.50 to 2.50)</description>
</entry>
<entry name="DisplayVerticalOffset" type="Int">
<default>0</default>
<min>-250</min>
<max>250</max>
<label>Display Vertical Offset</label>
<description>Vertical offset as a percent of the viewport height (-2.50 to 2.50)</description>
</entry>
<entry name="DisplayWrappingScheme" type="Int">
<default>0</default>
<min>0</min>
<max>3</max>
<label>Display Wrapping Scheme</label>
<description>How to arrange monitors: 0=Auto, 1=Horizontal, 2=Vertical, 3=Flat</description>
</entry>
<entry name="AntialiasingQuality" type="Int">
<default>3</default>
<min>0</min>
<max>3</max>
<label>Antialiasing Quality</label>
<description>0=None, 1=Medium, 2=High, 3=Very High</description>
</entry>
<entry name="MirrorPhysicalDisplays" type="Bool">
<default>false</default>
<label>Mirror Physical Displays</label>
<description>Whether to mirror the physical monitors in XR</description>
</entry>
<entry name="RemoveVirtualDisplaysOnDisable" type="Bool">
<default>true</default>
<label>Remove virtual displays on disable</label>
<description>Whether to remove any virtual displays when the effect is disabled</description>
</entry>
<entry name="SmoothFollowThreshold" type="Int">
<default>1</default>
<min>1</min>
<max>45</max>
<label>Follow threshold (degrees)</label>
<description>How closely the display follows</description>
</entry>
<entry name="LookAheadOverride" type="Int">
<default>-1</default>
<min>-1</min>
<max>40</max>
<label>Movement look-ahead (ms)</label>
<description>Override the default look ahead time in milliseconds (-1 to use default)</description>
</entry>
<entry name="AllDisplaysFollowMode" type="Bool">
<default>false</default>
<label>All displays follow mode</label>
<description>Apply follow mode to all displays instead of only the focused display</description>
</entry>
<entry name="CurvedDisplay" type="Bool">
<default>false</default>
<label>Curved display</label>
<description>Curve the displays around you</description>
</entry>
<entry name="DeveloperMode" type="Bool">
<default>false</default>
</entry>
</group>
</kcfg>

View File

@ -1,5 +0,0 @@
File=breezydesktopconfig.kcfg
ClassName=BreezyDesktopConfig
Singleton=true
Mutators=true
Notifiers=true

File diff suppressed because it is too large Load Diff

View File

@ -1,244 +0,0 @@
#pragma once
#include "kcm/shortcuts.h"
#include <effect/quickeffect.h>
#include <QAction>
#include <QFileSystemWatcher>
#include <QImage>
#include <QKeySequence>
#include <QQuaternion>
#include <QVariant>
#include <QVariantList>
#include <QHash>
#include <QRect>
#include <atomic>
class QTimer;
namespace KWin
{
class BackendOutput;
class LogicalOutput;
class Output;
#if defined(KWIN_VERSION_ENCODED) && KWIN_VERSION_ENCODED >= 60590
using ScreenOutput = LogicalOutput;
using VirtualOutputHandle = BackendOutput;
#else
using ScreenOutput = Output;
using VirtualOutputHandle = ScreenOutput;
#endif
class BreezyDesktopEffect : public QuickSceneEffect
{
Q_OBJECT
Q_PROPERTY(bool isEnabled READ isEnabled NOTIFY enabledStateChanged)
Q_PROPERTY(int effectTargetScreenIndex READ effectTargetScreenIndex WRITE setEffectTargetScreenIndex)
Q_PROPERTY(bool zoomOnFocusEnabled READ isZoomOnFocusEnabled WRITE setZoomOnFocusEnabled NOTIFY zoomOnFocusChanged)
Q_PROPERTY(int lookingAtScreenIndex READ lookingAtScreenIndex WRITE setLookingAtScreenIndex)
Q_PROPERTY(bool poseResetState READ poseResetState NOTIFY poseResetStateChanged)
Q_PROPERTY(bool poseHasPosition READ poseHasPosition NOTIFY poseResetStateChanged)
Q_PROPERTY(QList<QQuaternion> poseOrientations READ poseOrientations)
Q_PROPERTY(QVector3D posePosition READ posePosition)
Q_PROPERTY(quint32 poseTimeElapsedMs READ poseTimeElapsedMs)
Q_PROPERTY(quint64 poseTimestamp READ poseTimestamp)
Q_PROPERTY(QString cursorImageSource READ cursorImageSource NOTIFY cursorImageSourceChanged)
Q_PROPERTY(QSize cursorImageSize READ cursorImageSize NOTIFY cursorImageSourceChanged)
Q_PROPERTY(QPointF cursorPos READ cursorPos NOTIFY cursorPosChanged)
Q_PROPERTY(QList<qreal> lookAheadConfig READ lookAheadConfig NOTIFY devicePropertiesChanged)
Q_PROPERTY(qreal lookAheadOverride READ lookAheadOverride WRITE setLookAheadOverride NOTIFY devicePropertiesChanged)
Q_PROPERTY(QList<quint32> displayResolution READ displayResolution NOTIFY devicePropertiesChanged)
Q_PROPERTY(qreal focusedDisplayDistance READ focusedDisplayDistance NOTIFY focusedDisplayDistanceChanged)
Q_PROPERTY(qreal allDisplaysDistance READ allDisplaysDistance NOTIFY allDisplaysDistanceChanged)
Q_PROPERTY(qreal displaySpacing READ displaySpacing NOTIFY displaySpacingChanged)
Q_PROPERTY(qreal displaySize READ displaySize NOTIFY displaySizeChanged)
Q_PROPERTY(qreal displayHorizontalOffset READ displayHorizontalOffset NOTIFY displayOffsetChanged)
Q_PROPERTY(qreal displayVerticalOffset READ displayVerticalOffset NOTIFY displayOffsetChanged)
Q_PROPERTY(int displayWrappingScheme READ displayWrappingScheme NOTIFY displayWrappingSchemeChanged)
Q_PROPERTY(qreal diagonalFOV READ diagonalFOV NOTIFY devicePropertiesChanged)
Q_PROPERTY(qreal lensDistanceRatio READ lensDistanceRatio NOTIFY devicePropertiesChanged)
Q_PROPERTY(bool sbsEnabled READ sbsEnabled NOTIFY sbsEnabledChanged)
Q_PROPERTY(bool smoothFollowEnabled READ smoothFollowEnabled NOTIFY smoothFollowEnabledChanged)
Q_PROPERTY(QList<QQuaternion> smoothFollowOrigin READ smoothFollowOrigin)
Q_PROPERTY(bool customBannerEnabled READ customBannerEnabled NOTIFY devicePropertiesChanged)
Q_PROPERTY(int antialiasingQuality READ antialiasingQuality NOTIFY antialiasingQualityChanged)
Q_PROPERTY(bool removeVirtualDisplaysOnDisable READ removeVirtualDisplaysOnDisable NOTIFY removeVirtualDisplaysOnDisableChanged)
Q_PROPERTY(bool mirrorPhysicalDisplays READ mirrorPhysicalDisplays NOTIFY mirrorPhysicalDisplaysChanged)
Q_PROPERTY(bool curvedDisplay READ curvedDisplay NOTIFY curvedDisplayChanged)
Q_PROPERTY(bool curvedDisplaySupported READ curvedDisplaySupported WRITE setCurvedDisplaySupported NOTIFY curvedDisplaySupportedChanged)
Q_PROPERTY(bool developerMode READ developerMode NOTIFY developerModeChanged)
public:
BreezyDesktopEffect();
~BreezyDesktopEffect() override;
void reconfigure(ReconfigureFlags) override;
int requestedEffectChainPosition() const override;
QString cursorImageSource() const;
QSize cursorImageSize() const;
QPointF cursorPos() const;
bool isEnabled() const;
int effectTargetScreenIndex() const { return m_effectTargetScreenIndex; }
void setEffectTargetScreenIndex(int index);
bool isZoomOnFocusEnabled() const;
void setZoomOnFocusEnabled(bool enabled);
int lookingAtScreenIndex() const { return m_lookingAtScreenIndex; }
void setLookingAtScreenIndex(int index);
QList<QQuaternion> poseOrientations() const;
QVector3D posePosition() const;
quint32 poseTimeElapsedMs() const;
quint64 poseTimestamp() const;
bool poseResetState() const;
bool poseHasPosition() const;
QList<qreal> lookAheadConfig() const;
qreal lookAheadOverride() const;
void setLookAheadOverride(qreal override);
QList<quint32> displayResolution() const;
qreal focusedDisplayDistance() const;
void setFocusedDisplayDistance(qreal distance);
qreal allDisplaysDistance() const;
void setAllDisplaysDistance(qreal distance);
qreal displaySpacing() const;
void setDisplaySpacing(qreal spacing);
qreal displaySize() const;
void setDisplaySize(qreal size);
qreal displayHorizontalOffset() const;
qreal displayVerticalOffset() const;
int displayWrappingScheme() const;
qreal diagonalFOV() const;
qreal lensDistanceRatio() const;
bool sbsEnabled() const;
bool smoothFollowEnabled() const;
QList<QQuaternion> smoothFollowOrigin() const;
bool customBannerEnabled() const;
int antialiasingQuality() const;
bool removeVirtualDisplaysOnDisable() const;
bool mirrorPhysicalDisplays() const;
bool curvedDisplay() const;
bool developerMode() const;
void setCurvedDisplaySupported(bool supported);
void showCursor();
void hideCursor();
public Q_SLOTS:
void activate();
void deactivate();
void enableDriver();
void disableDriver();
void toggle();
void addVirtualDisplay(QSize size);
void updatePose();
void updateCursorImage();
void updateCursorPos();
QVariantList listVirtualDisplays() const;
bool removeVirtualDisplay(const QString &id);
void moveCursorToFocusedDisplay();
bool curvedDisplaySupported() const;
Q_SIGNALS:
void lookAheadOverrideChanged();
void focusedDisplayDistanceChanged();
void allDisplaysDistanceChanged();
void displaySpacingChanged();
void displaySizeChanged();
void displayOffsetChanged();
void displayWrappingSchemeChanged();
void enabledStateChanged();
void zoomOnFocusChanged();
void poseResetStateChanged();
void poseHasPositionChanged();
void sbsEnabledChanged();
void smoothFollowEnabledChanged();
void devicePropertiesChanged();
void antialiasingQualityChanged();
void removeVirtualDisplaysOnDisableChanged();
void mirrorPhysicalDisplaysChanged();
void curvedDisplayChanged();
void curvedDisplaySupportedChanged();
void developerModeChanged();
void cursorImageSourceChanged();
void cursorPosChanged();
protected:
QVariantMap initialProperties(ScreenOutput *screen) override;
private:
void teardown();
bool checkParityByte(const char* data);
void setupGlobalShortcut(const BreezyShortcuts::Shortcut &shortcut,
std::function<void()> triggeredFunc);
void recenter();
void toggleSmoothFollow();
void setSmoothFollowThreshold(float threshold);
void updateDriverSmoothFollowSettings();
void warpPointerToOutputCenter(ScreenOutput *output);
void evaluateCursorOnScreenState(const QPointF &prevPos, const QPointF &newPos);
void invalidateEffectOnScreenGeometryCache();
bool updateEffectOnScreenGeometryCache();
QString m_cursorImageSource;
QSize m_cursorImageSize;
bool m_enabled = false;
bool m_zoomOnFocusEnabled = false;
int m_lookingAtScreenIndex = -1;
int m_effectTargetScreenIndex = -1;
bool m_poseResetState = false;
bool m_poseHasPosition = false;
QList<QQuaternion> m_poseOrientations;
QVector3D m_posePosition;
quint32 m_poseTimeElapsedMs = 0;
quint64 m_poseTimestamp = 0;
QList<qreal> m_lookAheadConfig;
qreal m_lookAheadOverride = -1.0; // -1 = use device default
QList<quint32> m_displayResolution;
qreal m_diagonalFOV = 0.0;
qreal m_lensDistanceRatio = 0.0;
bool m_sbsEnabled = false;
bool m_smoothFollowEnabled = false;
QList<QQuaternion> m_smoothFollowOrigin;
bool m_customBannerEnabled = false;
QFileSystemWatcher *m_shmFileWatcher = nullptr;
QFileSystemWatcher *m_shmDirectoryWatcher = nullptr;
bool m_cursorHidden = false;
QPointF m_cursorPos;
QTimer *m_cursorUpdateTimer = nullptr;
QTimer *m_watchdogTimer = nullptr;
std::atomic<bool> m_poseUpdateInProgress{false};
bool m_sessionClassBlocked = false;
qreal m_focusedDisplayDistance = 0.85;
qreal m_allDisplaysDistance = 1.05;
qreal m_displaySpacing = 0.0;
qreal m_displaySize = 1.0;
qreal m_displayHorizontalOffset = 0.0;
qreal m_displayVerticalOffset = 0.0;
int m_displayWrappingScheme = 0; // 0=auto,1=horizontal,2=vertical,3=flat
int m_antialiasingQuality = 3; // 0=None, 1=Medium, 2=High, 3=VeryHigh
bool m_removeVirtualDisplaysOnDisable = true;
bool m_mirrorPhysicalDisplays = false;
bool m_curvedDisplay = false;
bool m_curvedDisplaySupported = false;
bool m_developerMode = false;
float m_smoothFollowThreshold = 1.0f;
bool m_allDisplaysFollowMode = false;
bool m_focusedSmoothFollowEnabled = false;
// Cached geometry for on-screen cursor evaluation
QRect m_effectOnScreenExpandedGeometry;
bool m_effectOnScreenGeometryValid = false;
struct VirtualOutputInfo {
VirtualOutputHandle *output = nullptr;
QString id;
QSize size;
};
QHash<QString, VirtualOutputInfo> m_virtualDisplays;
};
} // namespace KWin

View File

@ -1,45 +0,0 @@
set(breezy_desktop_config_SOURCES
breezydesktopeffectkcm.cpp
labeledslider.cpp
customresolutiondialog.cpp
virtualdisplayrow.cpp
)
ki18n_wrap_ui(breezy_desktop_config_SOURCES
breezydesktopeffectkcm.ui
customresolutiondialog.ui
virtualdisplayrow.ui
)
qt_add_dbus_interface(breezy_desktop_config_SOURCES ${KWIN_EFFECTS_INTERFACE} kwineffects_interface)
kcoreaddons_add_plugin(breezy_desktop_config INSTALL_NAMESPACE "plasma/kcms" SOURCES ${breezy_desktop_config_SOURCES})
kconfig_add_kcfg_files(breezy_desktop_config ../breezydesktopconfig.kcfgc)
target_link_libraries(breezy_desktop_config
Qt6::DBus
Qt6::Network
KF6::ConfigCore
KF6::ConfigGui
KF6::ConfigWidgets
KF6::CoreAddons
KF6::GlobalAccel
KF6::I18n
KF6::KCMUtils
KF6::XmlGui
xr_driver_ipc
)
# Ensure the version macro is available to the KCM as well (defined in parent CMakeLists)
if(BREEZY_DESKTOP_VERSION)
target_compile_definitions(breezy_desktop_config PRIVATE BREEZY_DESKTOP_VERSION_STR=\"${BREEZY_DESKTOP_VERSION}\")
endif()
set(KCMSHELL "kcmshell6")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/breezy_desktop.desktop.in
${CMAKE_CURRENT_BINARY_DIR}/breezy_desktop.desktop
@ONLY
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/breezy_desktop.desktop
DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/com.xronlinux.BreezyDesktop.svg
DESTINATION ${KDE_INSTALL_ICONDIR}/hicolor/scalable/apps)

View File

@ -1,11 +0,0 @@
[Desktop Entry]
Type=Application
Name=Breezy Desktop
GenericName=KWin Effect Settings
Comment=Configure Breezy Desktop
Exec=@KCMSHELL@ breezy_desktop_config
Icon=com.xronlinux.BreezyDesktop
Categories=Utility;Qt;KDE;
Keywords=Breezy;XR;Desktop;Effect;
Terminal=false
X-KDE-AuthorizeAction=org.kde.kcontrol.kcmkwinrules.save

File diff suppressed because it is too large Load Diff

View File

@ -1,91 +0,0 @@
#pragma once
#include <KCModule>
#include <KConfigWatcher>
#include <memory>
#include <QNetworkAccessManager>
#include <QTimer>
#include <QVariant>
#include <QVariantList>
#include <QString>
#include "ui_breezydesktopeffectkcm.h"
class KConfigWatcher;
class KConfigGroup;
class BreezyDesktopEffectConfig : public KCModule
{
Q_OBJECT
public:
BreezyDesktopEffectConfig(QObject *parent, const KPluginMetaData &data);
~BreezyDesktopEffectConfig() override;
public Q_SLOTS:
void load() override;
void save() override;
void defaults() override;
private:
QString measurementUnitsFromUi() const;
void applyDistanceLabelFormatters();
void updateDriverEnabled();
void updateMultitapEnabled();
void updateSmoothFollowEnabled();
void updateSmoothFollowTrackYaw();
void updateSmoothFollowTrackPitch();
void updateSmoothFollowTrackRoll();
void updateNeckSaverHorizontal();
void updateNeckSaverVertical();
void updateDeadZoneThresholdDeg();
void updateUiFromConfig();
void updateUiFromDefaultConfig();
void updateConfigFromUi();
void updateUnmanagedState();
bool driverEnabled(std::optional<QJsonObject> configJsonOpt);
bool multitapEnabled(std::optional<QJsonObject> configJsonOpt);
bool smoothFollowEnabled(std::optional<QJsonObject> stateJsonOpt);
bool smoothFollowTrackYawEnabled(std::optional<QJsonObject> configJsonOpt);
bool smoothFollowTrackPitchEnabled(std::optional<QJsonObject> configJsonOpt);
bool smoothFollowTrackRollEnabled(std::optional<QJsonObject> configJsonOpt);
double neckSaverHorizontalMultiplier(std::optional<QJsonObject> configJsonOpt);
double neckSaverVerticalMultiplier(std::optional<QJsonObject> configJsonOpt);
double deadZoneThresholdDeg(std::optional<QJsonObject> configJsonOpt);
void pollDriverState();
void refreshLicenseUi(const QJsonObject &rootObj);
void checkEffectLoaded();
void checkForUpdates();
void showStatus(QLabel *label, bool success, const QString &message);
void setRequestInProgress(std::initializer_list<QObject*> widgets, bool inProgress);
bool eventFilter(QObject *watched, QEvent *event) override;
// Virtual display DBus helpers and UI rendering
QVariantList dbusListVirtualDisplays() const;
QVariantList dbusAddVirtualDisplay(int w, int h) const;
QVariantList dbusRemoveVirtualDisplay(const QString &id) const;
void renderVirtualDisplays(const QVariantList &rows);
bool dbusCurvedDisplaySupported() const;
::Ui::BreezyDesktopEffectConfig ui;
KConfigWatcher::Ptr m_configWatcher;
QNetworkAccessManager *m_networkManager = nullptr;
bool m_updatingFromConfig = false;
bool m_driverStateInitialized = false;
bool m_deviceConnected = false;
bool m_smoothFollowEnabled = false;
int m_smoothFollowThreshold = 1;
QString m_connectedDeviceBrand;
QString m_connectedDeviceModel;
float m_connectedDeviceFullDistanceCm = 0.0;
float m_connectedDeviceFullSizeCm = 0.0;
bool m_connectedDevicePoseHasPosition = false;
QTimer m_statePollTimer; // periodic driver state polling
QTimer m_virtualDisplayPollTimer; // periodic virtual display list polling
bool m_licenseLoading = false;
bool m_curvedDisplaySupported = true;
};

View File

@ -1,960 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BreezyDesktopEffectConfig</class>
<widget class="QWidget" name="BreezyDesktopEffectConfig">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="labelDeviceConnectionStatus">
<property name="text">
<string>Loading, please wait...</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignVCenter</set>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelGlobalWarning">
<property name="text">
<string/>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignVCenter</set>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(200,0,0); font-weight: bold;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelPoseProWarning">
<property name="text">
<string/>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignVCenter</set>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(200,0,0); font-weight: bold;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelUpdateAvailable">
<property name="text">
<string/>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignVCenter</set>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0,100,200); font-weight: bold;</string>
</property>
</widget>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
<enum>QTabWidget::North</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<widget class="QWidget" name="tabGeneral">
<attribute name="title">
<string>&amp;General</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0" colspan="2">
<widget class="QWidget" name="widgetGeneralCheckboxes" native="true">
<layout class="QGridLayout" name="gridLayoutGeneralCheckboxes" columnstretch="1,1">
<property name="leftMargin"><number>0</number></property>
<property name="topMargin"><number>0</number></property>
<property name="rightMargin"><number>0</number></property>
<property name="bottomMargin"><number>0</number></property>
<property name="horizontalSpacing"><number>12</number></property>
<property name="verticalSpacing"><number>6</number></property>
<item row="0" column="0">
<widget class="QCheckBox" name="EffectEnabled">
<property name="text">
<string>XR Effect enabled</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="kcfg_ZoomOnFocusEnabled">
<property name="text">
<string>Zoom on Focus</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="kcfg_CurvedDisplay">
<property name="text">
<string>Curved display</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="SmoothFollowEnabled">
<property name="text">
<string>Follow mode</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelFocusedDisplayDistance">
<property name="text">
<string>Focused Display Distance:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="LabeledSlider" name="kcfg_FocusedDisplayDistance">
<property name="decimalShift">
<double>2</double>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickStartOffset">
<double>15</double>
</property>
<property name="tickInterval">
<double>50</double>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tracking">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelAllDisplaysDistance">
<property name="text">
<string>All Displays Distance:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="LabeledSlider" name="kcfg_AllDisplaysDistance">
<property name="decimalShift">
<double>2</double>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickStartOffset">
<double>15</double>
</property>
<property name="tickInterval">
<double>50</double>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tracking">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelDisplaySize">
<property name="text">
<string>Display Size:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="LabeledSlider" name="kcfg_DisplaySize">
<property name="decimalShift">
<double>2</double>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickStartOffset">
<double>15</double>
</property>
<property name="tickInterval">
<double>50</double>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tracking">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelDisplaySpacing">
<property name="text">
<string>Display Spacing:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSlider" name="kcfg_DisplaySpacing">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tracking">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelDisplayHorizontalOffset">
<property name="text">
<string>Display Horizontal Offset:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="LabeledSlider" name="kcfg_DisplayHorizontalOffset">
<property name="decimalShift">
<double>2</double>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickStartOffset">
<double>50</double>
</property>
<property name="tickInterval">
<double>100</double>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tracking">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="labelDisplayVerticalOffset">
<property name="text">
<string>Display Vertical Offset:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="LabeledSlider" name="kcfg_DisplayVerticalOffset">
<property name="decimalShift">
<double>2</double>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickStartOffset">
<double>50</double>
</property>
<property name="tickInterval">
<double>100</double>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tracking">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="labelFollowThreshold">
<property name="text">
<string>Follow threshold:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="LabeledSlider" name="kcfg_SmoothFollowThreshold">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tracking">
<bool>false</bool>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickStartOffset">
<double>9</double>
</property>
<property name="tickInterval">
<double>10</double>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="labelVirtualDisplays">
<property name="text">
<string>Add Virtual Display:</string>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QWidget" name="widgetVirtualDisplayButtons">
<property name="visible">
<bool>false</bool>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="layoutVirtualDisplayButtons">
<item>
<widget class="QComboBox" name="comboAddVirtualDisplay">
<item>
<property name="text">
<string>1080p</string>
</property>
</item>
<item>
<property name="text">
<string>1440p</string>
</property>
</item>
<item>
<property name="text">
<string>Add custom…</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonRemoveCustomResolution">
<property name="toolTip">
<string>Remove custom resolution</string>
</property>
<property name="icon">
<iconset theme="list-remove-symbolic"/>
</property>
<property name="flat"><bool>true</bool></property>
<property name="visible">
<bool>false</bool>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonAddVirtualDisplay">
<property name="icon">
<iconset theme="list-add-symbolic"/>
</property>
<property name="flat"><bool>true</bool></property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonOpenDisplaysSettings">
<property name="text">
<string>Rearrange displays</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="9" column="0" colspan="2">
<widget class="QWidget" name="widgetVirtualDisplayList">
<property name="visible"><bool>false</bool></property>
<property name="enabled"><bool>false</bool></property>
<layout class="QVBoxLayout" name="layoutVirtualDisplayList">
<property name="spacing"><number>6</number></property>
<property name="leftMargin"><number>0</number></property>
<property name="topMargin"><number>0</number></property>
<property name="rightMargin"><number>0</number></property>
<property name="bottomMargin"><number>0</number></property>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabShortcuts">
<attribute name="title">
<string>&amp;Shortcuts</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayoutShortcuts">
<item>
<widget class="KShortcutsEditor" name="shortcutsEditor" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabAdvanced">
<attribute name="title">
<string>&amp;Advanced</string>
</attribute>
<layout class="QFormLayout" name="formAdvanced">
<item row="0" column="0">
<widget class="QLabel" name="labelDisplayWrappingScheme">
<property name="text">
<string>Display Wrapping Scheme:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="kcfg_DisplayWrappingScheme">
<item>
<property name="text">
<string>Auto</string>
</property>
</item>
<item>
<property name="text">
<string>Horizontal</string>
</property>
</item>
<item>
<property name="text">
<string>Vertical</string>
</property>
</item>
<item>
<property name="text">
<string>Flat</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelAntialiasingQuality">
<property name="text">
<string>Anti-aliasing quality:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="kcfg_AntialiasingQuality">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Medium</string>
</property>
</item>
<item>
<property name="text">
<string>High</string>
</property>
</item>
<item>
<property name="text">
<string>Very High</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelSmoothFollowTracking">
<property name="text">
<string>Follow mode movement tracking:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QWidget" name="widgetSmoothFollowTracking">
<layout class="QHBoxLayout" name="layoutSmoothFollowTracking">
<property name="leftMargin"><number>0</number></property>
<property name="topMargin"><number>0</number></property>
<property name="rightMargin"><number>0</number></property>
<property name="bottomMargin"><number>0</number></property>
<item>
<widget class="QCheckBox" name="SmoothFollowTrackYaw">
<property name="text">
<string>Yaw</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="SmoothFollowTrackPitch">
<property name="text">
<string>Pitch</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="SmoothFollowTrackRoll">
<property name="text">
<string>Roll</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_AllDisplaysFollowMode">
<property name="text">
<string>All displays follow mode</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_RemoveVirtualDisplaysOnDisable">
<property name="visible">
<bool>false</bool>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remove virtual displays on disable</string>
</property>
<property name="checked"><bool>true</bool></property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_MirrorPhysicalDisplays">
<property name="text">
<string>Mirror physical displays (may impact performance)</string>
</property>
<property name="checked"><bool>false</bool></property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="EnableMultitap">
<property name="text">
<string>Enable multi-tap detection</string>
</property>
<property name="checked"><bool>false</bool></property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="labelLookAheadOverride">
<property name="text">
<string>Movement look-ahead (ms):</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="LabeledSlider" name="kcfg_LookAheadOverride">
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickStartOffset">
<double>1</double>
</property>
<property name="tickInterval">
<double>5</double>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tracking">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="labelNeckSaverHorizontal">
<property name="text">
<string>Neck-saver horizontal:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="LabeledSlider" name="NeckSaverHorizontalMultiplier">
<property name="decimalShift">
<double>2</double>
</property>
<property name="minimum">
<number>100</number>
</property>
<property name="maximum">
<number>250</number>
</property>
<property name="tickStartOffset">
<double>25</double>
</property>
<property name="tickInterval">
<double>50</double>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tracking">
<bool>false</bool>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="labelNeckSaverVertical">
<property name="text">
<string>Neck-saver vertical:</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="LabeledSlider" name="NeckSaverVerticalMultiplier">
<property name="decimalShift">
<double>2</double>
</property>
<property name="minimum">
<number>100</number>
</property>
<property name="maximum">
<number>250</number>
</property>
<property name="tickStartOffset">
<double>25</double>
</property>
<property name="tickInterval">
<double>50</double>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tracking">
<bool>false</bool>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="labelDeadZoneThresholdDeg">
<property name="text">
<string>Dead-zone threshold (deg):</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="LabeledSlider" name="DeadZoneThresholdDeg">
<property name="decimalShift">
<double>1</double>
</property>
<property name="minimum">
<number>-5</number>
</property>
<property name="maximum">
<number>55</number>
</property>
<property name="tickStartOffset">
<double>5</double>
</property>
<property name="tickInterval">
<double>10</double>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tracking">
<bool>false</bool>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="labelMeasurementUnits">
<property name="text">
<string>Measurement units:</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QComboBox" name="comboMeasurementUnits"/>
</item>
<item row="12" column="0">
<widget class="QLabel" name="labelResetDriver">
<property name="text">
<string>Reset driver:</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QPushButton" name="buttonResetDriver">
<property name="text">
<string>Force reset driver</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLabel" name="labelResetDriverStatus">
<property name="text">
<string/>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabLicenseDetails">
<attribute name="title">
<string>&amp;License Details</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayoutLicense">
<item>
<widget class="QLabel" name="labelLicenseSummary">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="visible">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelDonateLink">
<property name="text">
<string>&lt;a href=&quot;https://ko-fi.com/wheaney&quot;&gt;Renew or support on Kofi&lt;/a&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignVCenter</set>
</property>
<property name="visible">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxEmail">
<property name="title">
<string>Request a token</string>
</property>
<layout class="QGridLayout" name="gridLayoutEmail">
<item row="0" column="0">
<widget class="QLineEdit" name="lineEditLicenseEmail">
<property name="placeholderText">
<string>you@example.com</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="buttonSubmitEmail">
<property name="text">
<string>Submit</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="labelEmailStatus">
<property name="text">
<string/>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxToken">
<property name="title">
<string>Verify token</string>
</property>
<layout class="QGridLayout" name="gridLayoutToken">
<item row="0" column="0">
<widget class="QLineEdit" name="lineEditLicenseToken"/>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="buttonSubmitToken">
<property name="text">
<string>Verify</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="labelTokenStatus">
<property name="text">
<string/>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacerLicense">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabAbout">
<attribute name="title">
<string>&amp;About</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayoutAbout">
<item>
<widget class="QLabel" name="labelAppNameVersion">
<property name="text">
<string>Breezy Desktop Effect - v0.0.0</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignVCenter</set>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
</widget>
</item>
<item>
<widget class="QLabel">
<property name="text">
<string>Author: Wayne Heaney &lt;wayne@xronlinux.com&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel">
<property name="text">
<string>License: GPL-3.0</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacerAbout">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KShortcutsEditor</class>
<extends>QWidget</extends>
<header>kshortcutseditor.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
</connections>
</ui>

View File

@ -1,20 +0,0 @@
#include "customresolutiondialog.h"
#include "ui_customresolutiondialog.h"
CustomResolutionDialog::CustomResolutionDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::CustomResolutionDialog)
{
ui->setupUi(this);
}
CustomResolutionDialog::~CustomResolutionDialog() {
delete ui;
}
int CustomResolutionDialog::widthValue() const {
return ui->sliderWidth->value();
}
int CustomResolutionDialog::heightValue() const {
return ui->sliderHeight->value();
}

View File

@ -1,18 +0,0 @@
#pragma once
#include <QDialog>
namespace Ui { class CustomResolutionDialog; }
class CustomResolutionDialog : public QDialog {
Q_OBJECT
public:
explicit CustomResolutionDialog(QWidget *parent = nullptr);
~CustomResolutionDialog() override;
int widthValue() const;
int heightValue() const;
private:
Ui::CustomResolutionDialog *ui;
};

View File

@ -1,209 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CustomResolutionDialog</class>
<widget class="QDialog" name="CustomResolutionDialog">
<property name="windowTitle">
<string>Add custom resolution</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelWidth">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QWidget" name="widthRow" native="true">
<layout class="QHBoxLayout" name="horizontalLayoutWidth">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QSlider" name="sliderWidth">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="minimum">
<number>640</number>
</property>
<property name="maximum">
<number>3840</number>
</property>
<property name="singleStep">
<number>2</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="value">
<number>1920</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelWidthValue">
<property name="minimumWidth">
<number>50</number>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignVCenter</set>
</property>
<property name="text">
<string>1920</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelHeight">
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QWidget" name="heightRow" native="true">
<layout class="QHBoxLayout" name="horizontalLayoutHeight">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QSlider" name="sliderHeight">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="minimum">
<number>480</number>
</property>
<property name="maximum">
<number>2160</number>
</property>
<property name="singleStep">
<number>2</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="value">
<number>1080</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelHeightValue">
<property name="minimumWidth">
<number>50</number>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignVCenter</set>
</property>
<property name="text">
<string>1080</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>sliderWidth</sender>
<signal>valueChanged(int)</signal>
<receiver>labelWidthValue</receiver>
<slot>setNum(int)</slot>
<hints>
<hint type="sourcelabel">
<x>264</x>
<y>50</y>
</hint>
<hint type="destinationlabel">
<x>475</x>
<y>50</y>
</hint>
</hints>
</connection>
<connection>
<sender>sliderHeight</sender>
<signal>valueChanged(int)</signal>
<receiver>labelHeightValue</receiver>
<slot>setNum(int)</slot>
<hints>
<hint type="sourcelabel">
<x>264</x>
<y>100</y>
</hint>
<hint type="destinationlabel">
<x>475</x>
<y>100</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>CustomResolutionDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>185</y>
</hint>
<hint type="destinationlabel">
<x>179</x>
<y>93</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>CustomResolutionDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>421</x>
<y>185</y>
</hint>
<hint type="destinationlabel">
<x>244</x>
<y>93</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -1,8 +0,0 @@
{
"KPlugin": {
"Name": "Breezy Desktop",
"Description": "Configure Breezy Desktop",
"Category": "Tools",
"License": "GPL"
}
}

View File

@ -1 +0,0 @@
#include "labeledslider.h"

View File

@ -1,284 +0,0 @@
#pragma once
#include <QSlider>
#include <QPainter>
#include <QPainterPath>
#include <QStyleOptionSlider>
#include <algorithm> // for std::max
#include <functional>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QStringList>
/*
* LabeledSlider
* Horizontal QSlider that draws numeric labels at tick intervals and (optionally) a value bubble.
* Usage:
* auto *s = new LabeledSlider(parent);
* s->setMinimum(20);
* s->setMaximum(250);
* s->setTickInterval(20);
* s->setTickStartOffset(10); // ticks start at 10, then increment by 20
* s->setTickPosition(QSlider::TicksBelow);
* s->setShowValueBubble(true);
*/
class LabeledSlider : public QSlider {
Q_OBJECT
Q_PROPERTY(bool showValueBubble READ showValueBubble WRITE setShowValueBubble)
// decimalShift: number of places to shift the decimal point left for display ONLY.
// Example: raw value 250 with decimalShift=2 displays as 2.50. Underlying slider value
// (signals, stored config) remains 250.
Q_PROPERTY(int decimalShift READ decimalShift WRITE setDecimalShift)
// tickStartOffset: starting offset for label positions relative to minimum().
// Example: minimum=0, tickInterval=20, tickStartOffset=10 -> labels at 10,30,50,...
Q_PROPERTY(int tickStartOffset READ tickStartOffset WRITE setTickStartOffset)
// Optional units suffix shown ONLY in the floating value bubble.
// Tick labels never include units.
Q_PROPERTY(QString valueUnitsSuffix READ valueUnitsSuffix WRITE setValueUnitsSuffix)
public:
using ValueToDisplayStringFn = std::function<QString(int)>;
explicit LabeledSlider(QWidget *parent = nullptr)
: QSlider(Qt::Horizontal, parent)
{
setTickPosition(QSlider::TicksBelow);
}
bool showValueBubble() const { return m_showValueBubble; }
void setShowValueBubble(bool on) {
if (m_showValueBubble == on) return;
m_showValueBubble = on;
update();
}
// Custom text for specific integer values
void setValueText(int value, const QString &text) {
// If the same text already set, ignore; allow empty string as valid label
auto it = m_valueTexts.constFind(value);
if (it != m_valueTexts.constEnd() && *it == text)
return;
m_valueTexts.insert(value, text);
update();
}
void removeValueText(int value) {
if (m_valueTexts.remove(value) > 0) update();
}
void clearValueTexts() {
if (m_valueTexts.isEmpty()) return;
m_valueTexts.clear();
update();
}
void setValueTexts(const QMap<int, QString> &map) {
if (m_valueTexts == map) return;
m_valueTexts = map;
update();
}
QMap<int, QString> valueTexts() const { return m_valueTexts; }
QString valueUnitsSuffix() const { return m_valueUnitsSuffix; }
void setValueUnitsSuffix(const QString &suffix) {
if (m_valueUnitsSuffix == suffix) return;
m_valueUnitsSuffix = suffix;
updateGeometry();
update();
}
// Optional custom formatter for displayed values.
// If set, it is consulted for values without an explicit setValueText() override.
// Returning a null QString (QString()) falls back to the built-in formatting.
void setValueToDisplayStringFn(ValueToDisplayStringFn fn) {
m_valueToDisplayStringFn = std::move(fn);
updateGeometry();
update();
}
void clearValueToDisplayStringFn() {
if (!m_valueToDisplayStringFn) return;
m_valueToDisplayStringFn = nullptr;
updateGeometry();
update();
}
bool hasValueToDisplayStringFn() const { return static_cast<bool>(m_valueToDisplayStringFn); }
int decimalShift() const { return m_decimalShift; }
void setDecimalShift(int shift) {
// clamp to sensible range
if (shift < 0) shift = 0;
if (shift > 6) shift = 6; // avoid large power-of-10 overflow
if (m_decimalShift == shift) return;
m_decimalShift = shift;
updateGeometry();
update();
}
int tickStartOffset() const { return m_tickStartOffset; }
void setTickStartOffset(int offset) {
if (m_tickStartOffset == offset) return;
m_tickStartOffset = offset;
update();
}
QSize sizeHint() const override {
QSize sz = QSlider::sizeHint();
int extraH = 0;
if (labelInterval() > 0) {
// Reserve space for bottom labels
QFontMetrics fm(font());
extraH += fm.height() + 4;
}
if (m_showValueBubble) {
QFontMetrics fm(font());
extraH = std::max(extraH, fm.height() + 8); // bubble might be above
}
sz.setHeight(sz.height() + extraH);
return sz;
}
protected:
void paintEvent(QPaintEvent *e) override {
QSlider::paintEvent(e);
QStyleOptionSlider opt;
initStyleOption(&opt);
QPainter p(this);
p.setRenderHint(QPainter::Antialiasing, true);
const int minV = minimum();
const int maxV = maximum();
// Draw labels below ticks
if (labelInterval() > 0) {
QFontMetrics fm(font());
const int baselineY = height() - fm.descent() - 1;
int interval = labelInterval();
// Determine first labeled value based on tickStartOffset
int startOffset = 0;
if (interval > 0) {
startOffset = m_tickStartOffset % interval;
if (startOffset < 0) startOffset += interval;
}
int first = minV + startOffset;
if (first < minV) first = minV; // safety
for (int v = first; v <= maxV; v += interval) {
// Use style geometry for handle at this position to match tick placement.
QStyleOptionSlider optPos = opt;
optPos.sliderPosition = v;
optPos.sliderValue = v;
QRect handleAtVal = style()->subControlRect(QStyle::CC_Slider, &optPos, QStyle::SC_SliderHandle, this);
int x = handleAtVal.center().x();
QString text = valueToDisplayString(v, /*forValueBubble=*/false);
int halfW = fm.horizontalAdvance(text) / 2;
QRect r(x - halfW, baselineY - fm.ascent(), fm.horizontalAdvance(text), fm.height());
p.drawText(r, Qt::AlignCenter, text);
}
}
// Draw floating value bubble over handle
if (m_showValueBubble) {
// Handle rect
const QRect handle = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
QString valText = valueToDisplayString(value(), /*forValueBubble=*/true);
QFontMetrics fm(font());
QRect textRect = fm.boundingRect(valText);
textRect.adjust(-6, -4, 6, 4);
// Position bubble above the handle; add extra lift
const int extraLift = 10; // requested additional pixels
const int gap = 4; // minimal gap between handle top and bubble
int topY = handle.top() - gap - extraLift - textRect.height();
if (topY < 0) topY = 0; // clamp to widget
textRect.moveTop(topY);
// Center horizontally over handle
textRect.moveLeft(handle.center().x() - textRect.width()/2);
// Clamp horizontally so we don't paint outside and get clipped
if (textRect.left() < 0) {
textRect.moveLeft(0);
}
if (textRect.right() > width()) {
textRect.moveLeft(width() - textRect.width());
}
// Bubble shape
QPainterPath path;
path.addRoundedRect(textRect, 6, 6);
p.setPen(Qt::NoPen);
p.setBrush(palette().toolTipBase());
p.drawPath(path);
p.setPen(palette().toolTipText().color());
p.drawText(textRect, Qt::AlignCenter, valText);
}
}
private:
QString valueToDisplayString(int raw, bool forValueBubble) const {
// Use custom text if provided for this exact integer value
auto it = m_valueTexts.constFind(raw);
if (it != m_valueTexts.constEnd()) {
return *it;
}
auto decimalShiftString = [this](int r) -> QString {
if (m_decimalShift == 0) {
return QString::number(r);
}
int divisor = 1;
for (int i = 0; i < m_decimalShift; ++i) divisor *= 10;
int whole = r / divisor;
int frac = std::abs(r % divisor);
QString fracStr = QString::number(frac).rightJustified(m_decimalShift, QLatin1Char('0'));
QString result = QString::number(std::abs(whole)) + QLatin1Char('.') + fracStr;
if (r < 0) result.prepend(QLatin1Char('-'));
return result;
};
QString base;
if (m_valueToDisplayStringFn) {
base = m_valueToDisplayStringFn(raw);
}
if (base.isNull()) {
base = decimalShiftString(raw);
}
if (!forValueBubble) {
return base;
}
const QString suffix = m_valueUnitsSuffix.trimmed();
if (suffix.isEmpty() || base.isEmpty()) {
return base;
}
// Avoid double-appending if caller included units in the formatter.
const QString baseTrimmed = base.trimmed();
if (baseTrimmed.endsWith(suffix) || baseTrimmed.endsWith(QLatin1Char(' ') + suffix)) {
return base;
}
return baseTrimmed + QLatin1Char(' ') + suffix;
}
bool m_showValueBubble = true;
int m_decimalShift = 0; // display-only decimal shift
int m_tickStartOffset = 0; // label positions start offset relative to minimum
QMap<int, QString> m_valueTexts; // optional text overrides for specific values
ValueToDisplayStringFn m_valueToDisplayStringFn; // optional custom formatter
QString m_valueUnitsSuffix; // shown only in the value bubble
private:
int labelInterval() const {
int ti = tickInterval();
if (ti > 0) return ti;
// Heuristic fallback: divide range into ~10 segments.
int range = maximum() - minimum();
if (range <= 0) return 0;
int approx = range / 10;
if (approx <= 0) approx = range; // single label at ends
return approx;
}
};

View File

@ -1,43 +0,0 @@
#pragma once
#include <QKeySequence>
#include <Qt>
#include <QString>
namespace BreezyShortcuts {
struct Shortcut {
QKeySequence shortcut;
QString actionName;
QString actionText;
};
const Shortcut TOGGLE = {
Qt::CTRL | Qt::META | Qt::Key_Backslash,
QStringLiteral("Toggle XR Effect"),
QStringLiteral("Toggle XR Effect")
};
const Shortcut RECENTER = {
Qt::CTRL | Qt::META | Qt::Key_Space,
QStringLiteral("Recenter"),
QStringLiteral("Recenter")
};
const Shortcut TOGGLE_ZOOM_ON_FOCUS = {
Qt::CTRL | Qt::META | Qt::Key_0,
QStringLiteral("Toggle Zoom on Focus"),
QStringLiteral("Toggle Zoom on Focus")
};
const Shortcut TOGGLE_FOLLOW_MODE = {
Qt::CTRL | Qt::META | Qt::Key_Return,
QStringLiteral("Toggle Follow Mode"),
QStringLiteral("Toggle Follow Mode")
};
const Shortcut CURSOR_TO_FOCUSED_DISPLAY = {
Qt::CTRL | Qt::META | Qt::Key_Period,
QStringLiteral("Move Cursor to Focused Display"),
QStringLiteral("Move Cursor to Focused Display")
};
}

View File

@ -1,27 +0,0 @@
#include "virtualdisplayrow.h"
#include "ui_virtualdisplayrow.h"
#include <QIcon>
VirtualDisplayRow::VirtualDisplayRow(QWidget *parent)
: QWidget(parent), ui(new Ui::VirtualDisplayRow)
{
ui->setupUi(this);
// Set themed icons at runtime to honor system theme
ui->icon->setPixmap(QIcon::fromTheme(QStringLiteral("video-display-symbolic")).pixmap(16, 16));
ui->buttonRemove->setIcon(QIcon::fromTheme(QStringLiteral("user-trash-symbolic")));
connect(ui->buttonRemove, &QPushButton::clicked, this, [this]() {
Q_EMIT removeRequested(m_id);
});
}
VirtualDisplayRow::~VirtualDisplayRow() {
delete ui;
}
void VirtualDisplayRow::setInfo(const QString &id, int w, int h) {
m_id = id;
ui->labelId->setText(id);
ui->labelRes->setText(QStringLiteral("%1x%2").arg(w).arg(h));
}

View File

@ -1,21 +0,0 @@
#pragma once
#include <QWidget>
namespace Ui { class VirtualDisplayRow; }
class VirtualDisplayRow : public QWidget {
Q_OBJECT
public:
explicit VirtualDisplayRow(QWidget *parent = nullptr);
~VirtualDisplayRow() override;
void setInfo(const QString &id, int w, int h);
Q_SIGNALS:
void removeRequested(const QString &id);
private:
Ui::VirtualDisplayRow *ui;
QString m_id;
};

View File

@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VirtualDisplayRow</class>
<widget class="QWidget" name="VirtualDisplayRow">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="spacer" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="icon"/>
</item>
<item>
<widget class="QLabel" name="labelId">
<property name="text">
<string>ID</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelRes">
<property name="text">
<string>WxH</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonRemove">
<property name="toolTip">
<string>Remove virtual display</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,10 +0,0 @@
#include "breezydesktopeffect.h"
namespace KWin
{
KWIN_EFFECT_FACTORY(BreezyDesktopEffect, "metadata.json")
} // namespace KWin
#include "main.moc"

View File

@ -1,16 +0,0 @@
{
"KPackageStructure": "KWin/Effect",
"KPlugin": {
"Authors": [
{
"Email": "wayne@xronlinux.com",
"Name": "Wayne Heaney"
}
],
"Category": "Tools",
"Description": "Breezy Desktop XR Effect",
"EnabledByDefault": true,
"License": "GPL",
"Name": "Breezy Desktop"
}
}

View File

@ -1,340 +0,0 @@
import QtQuick
import QtQuick3D
Node {
id: breezyDesktop
property var viewportResolution: effect.displayResolution
property bool smoothFollowEnabled: effect.smoothFollowEnabled
required property var screens
required property var sizeAdjustedScreens
required property var fovDetails
required property var monitorPlacements
property int focusedMonitorIndex: -1
property int lookingAtMonitorIndex: -1
property var smoothFollowFocusedDisplay
Displays {
id: displays
}
function displayAtIndex(index) {
if (index < 0 || index >= screens.length) {
return null;
}
return breezyDesktopDisplays.objectAt(index);
}
function updateFocus(smoothFollowEnabledChanged = false) {
const orientations = smoothFollowEnabled ? effect.smoothFollowOrigin : effect.poseOrientations;
if (orientations && orientations.length > 0) {
const posePosition = effect.posePosition.times(breezyDesktop.fovDetails.fullScreenDistancePixels);
let focusedIndex = -1;
const lookingAtIndex = displays.findFocusedMonitor(
displays.eusToNwuQuat(orientations[0]),
displays.eusToNwuVector(posePosition),
breezyDesktop.monitorPlacements.map(monitorVectors => monitorVectors.centerLook),
breezyDesktop.focusedMonitorIndex,
smoothFollowEnabled,
breezyDesktop.fovDetails,
breezyDesktop.sizeAdjustedScreens.map(screen => screen.geometry)
);
if (breezyDesktop.lookingAtMonitorIndex !== lookingAtIndex) {
breezyDesktop.lookingAtMonitorIndex = lookingAtIndex;
effect.lookingAtScreenIndex = lookingAtIndex;
}
if (effect.zoomOnFocusEnabled || smoothFollowEnabled) {
focusedIndex = lookingAtIndex;
}
let focusedDisplay;
let unfocusedDisplay;
let startSmoothFollowFocusAnimation = false;
if (smoothFollowEnabledChanged) {
let targetDisplay;
let targetProgress;
if (smoothFollowEnabled && focusedIndex !== -1) {
focusedDisplay = breezyDesktop.displayAtIndex(focusedIndex);
if (focusedDisplay) {
targetDisplay = focusedDisplay;
targetProgress = 1.0;
startSmoothFollowFocusAnimation = true;
}
} else if (!smoothFollowEnabled && breezyDesktop.focusedMonitorIndex !== -1) {
unfocusedDisplay = breezyDesktop.displayAtIndex(breezyDesktop.focusedMonitorIndex);
if (unfocusedDisplay) {
targetDisplay = unfocusedDisplay;
targetProgress = 0.0;
}
}
if (targetDisplay) {
smoothFollowTransitionAnimation.stop();
smoothFollowTransitionAnimation.target = targetDisplay;
smoothFollowTransitionAnimation.from = targetDisplay.smoothFollowTransitionProgress;
smoothFollowTransitionAnimation.to = targetProgress;
smoothFollowTransitionAnimation.start();
}
}
if (focusedIndex !== breezyDesktop.focusedMonitorIndex) {
const unfocusedIndex = breezyDesktop.focusedMonitorIndex;
if (!focusedDisplay) focusedDisplay = focusedIndex !== -1 ? breezyDesktop.displayAtIndex(focusedIndex) : null;
if (!focusedDisplay) {
if (!unfocusedDisplay) unfocusedDisplay = breezyDesktop.displayAtIndex(unfocusedIndex);
if (unfocusedDisplay) {
zoomOutAnimation.target = unfocusedDisplay;
zoomOutAnimation.target.targetDistance = effect.allDisplaysDistance;
zoomOutAnimation.start();
}
} else {
if (!unfocusedDisplay) unfocusedDisplay = unfocusedIndex !== -1 ? breezyDesktop.displayAtIndex(unfocusedIndex) : null;
if (!unfocusedDisplay) {
zoomInAnimation.target = focusedDisplay;
focusedDisplay.targetDistance = effect.focusedDisplayDistance;
zoomInAnimation.start();
} else {
zoomInSeqAnimation.target = focusedDisplay;
focusedDisplay.targetDistance = effect.focusedDisplayDistance;
zoomOutSeqAnimation.target = unfocusedDisplay;
unfocusedDisplay.targetDistance = effect.allDisplaysDistance;
zoomOnFocusSequence.start();
}
}
breezyDesktop.focusedMonitorIndex = focusedIndex;
}
if (startSmoothFollowFocusAnimation) smoothFollowFocusedAnimation.restart();
}
}
function displayRotationVector(display) {
const displayNwu =
display.monitorPlacement.centerNoRotate
.times(display.monitorDistance / effect.allDisplaysDistance);
const eusVector = displays.nwuToEusVector(displayNwu)
return display.rotationMatrix.times(eusVector);
}
// smoothFollowOrigin is the rotation away from the original placement of the displays
// poseOrientations is the smooth follow rotation relative to the camera (very near an identity quat)
// subtract the latter from the former to get the complete rotation
function smoothFollowQuat() {
return effect.smoothFollowOrigin[0].times(effect.poseOrientations[0].conjugated());
}
function displaySmoothFollowVector(display, smoothFollowRotation) {
// for smooth follow, place the display centered directly in front of the camera
const displayDistanceNorth =
display.monitorPlacement.monitorCenterNorth *
display.monitorDistance / effect.allDisplaysDistance;
const eusVector = Qt.vector3d(0, 0, -displayDistanceNorth);
return smoothFollowRotation.times(eusVector);
}
// don't call this from the delegate to avoid binding the position property to the effect properties
// used for smooth follow
function displayPosition(display, smoothFollowRotation) {
// short circuit to avoid slerping if not needed
if (display.smoothFollowTransitionProgress === 1.0) {
return displaySmoothFollowVector(display, smoothFollowRotation);
}
const finalPosition = displays.slerpVector(
displayRotationVector(display),
displaySmoothFollowVector(display, smoothFollowRotation),
display.smoothFollowTransitionProgress
);
return finalPosition
}
Repeater3D {
id: breezyDesktopDisplays
model: breezyDesktop.screens.length
delegate: BreezyDesktopDisplay {
screen: breezyDesktop.screens[index]
sizeAdjustedScreen: breezyDesktop.sizeAdjustedScreens[index]
monitorPlacement: breezyDesktop.monitorPlacements[index]
fovDetails: breezyDesktop.fovDetails
property real smoothFollowTransitionProgress: 0.0
property real monitorDistance: effect.allDisplaysDistance
property real targetDistance: effect.allDisplaysDistance
property real screenRotationY: displays.radianToDegree(monitorPlacement?.rotationAngleRadians.y ?? 0)
property real screenRotationX: displays.radianToDegree(monitorPlacement?.rotationAngleRadians.x ?? 0)
property matrix4x4 rotationMatrix: {
const matrix = Qt.matrix4x4();
matrix.rotate(screenRotationY, Qt.vector3d(0, 1, 0));
matrix.rotate(screenRotationX, Qt.vector3d(1, 0, 0));
return matrix;
}
// only for the Rectangle geometry fallback
property vector3d rectangleFallbackScale: {
if (!sizeAdjustedScreen) return Qt.vector3d(1, 1, 1);
const geometry = sizeAdjustedScreen.geometry;
// default geometry unit size is 100x100, so we scale it up to the screen size
return Qt.vector3d(geometry.width / 100, geometry.height / 100, 1);
}
scale: effect.curvedDisplaySupported ? Qt.vector3d(1, 1, 1) : rectangleFallbackScale
eulerRotation.y: screenRotationY
eulerRotation.x: screenRotationX
position: {
if (!monitorPlacement) return Qt.vector3d(0, 0, 0);
return displayRotationVector(this);
}
}
}
// smoothFollowEnabled gets cleared before the orientation begins slerping back to the origin so we can't just
// switch off smooth follow logic based on this flag. Instead, we have to rely on
// smoothFollowTransitionProgress to determine how much of the orientations to apply.
onSmoothFollowEnabledChanged: {
updateFocus(true);
}
FrameAnimation {
id: smoothFollowFocusedAnimation
running: false
onTriggered: {
if (!breezyDesktop.smoothFollowFocusedDisplay && breezyDesktop.focusedMonitorIndex !== -1) {
breezyDesktop.smoothFollowFocusedDisplay = breezyDesktopDisplays.objectAt(breezyDesktop.focusedMonitorIndex)
}
let continueRunning = false;
const focusedDisplay = breezyDesktop.smoothFollowFocusedDisplay;
if (focusedDisplay) {
continueRunning = focusedDisplay.smoothFollowTransitionProgress > 0.0;
if (continueRunning) {
const smoothFollowRotation = smoothFollowQuat();
focusedDisplay.eulerRotation = Qt.vector3d(0, 0, 0);
focusedDisplay.rotation = smoothFollowRotation;
// When smooth follow is running, we're updating the position of the display manually
// on every frame (avoid binding to a function that uses non-notify effect properties
// poseOrientations and smoothFollowOrigin).
focusedDisplay.position = displayPosition(focusedDisplay, smoothFollowRotation);
} else {
focusedDisplay.rotation = Qt.quaternion(1, 0, 0, 0);
focusedDisplay.eulerRotation.x = Qt.binding(function() { return focusedDisplay.screenRotationX; });
focusedDisplay.eulerRotation.y = Qt.binding(function() { return focusedDisplay.screenRotationY; });
focusedDisplay.eulerRotation.z = 0.0;
// When smooth follow is done, this frame animation will no longer run so we need to
// rebind a safe function to the position property that will automatically update the
// position when delegate properties change. display properties don't often change,
// but zoomOnFocus does change monitorDistance, so we need the binding to pick that up.
focusedDisplay.position = Qt.binding(function() {
return displayRotationVector(this);
}.bind(focusedDisplay));
}
}
if (!continueRunning) {
smoothFollowFocusedAnimation.stop();
breezyDesktop.smoothFollowFocusedDisplay = null;
}
}
}
NumberAnimation {
id: smoothFollowTransitionAnimation
duration: 150
property: "smoothFollowTransitionProgress"
running: false
}
Timer {
interval: 500 // 500ms - 2x per second to avoid running this check too frequently
repeat: true
running: true
onTriggered: {
updateFocus();
}
}
// release references to displays and stale indexes
onScreensChanged: {
breezyDesktop.focusedMonitorIndex = -1;
zoomOutAnimation.stop();
zoomInAnimation.stop();
zoomOnFocusSequence.stop();
smoothFollowTransitionAnimation.stop();
smoothFollowFocusedAnimation.stop();
zoomOutAnimation.target = null;
zoomInAnimation.target = null;
zoomOutSeqAnimation.target = null;
zoomInSeqAnimation.target = null;
smoothFollowTransitionAnimation.target = null;
}
NumberAnimation {
id: zoomOutAnimation
property: "monitorDistance"
to: effect.allDisplaysDistance
duration: 150
running: false
onFinished: {
const unfocusedDisplay = zoomOutAnimation.target;
if (unfocusedDisplay) {
unfocusedDisplay.monitorDistance = Qt.binding(function() { return effect.allDisplaysDistance; });
}
}
}
NumberAnimation {
id: zoomInAnimation
property: "monitorDistance"
to: effect.focusedDisplayDistance
duration: 300
running: false
onFinished: {
const focusedDisplay = zoomInAnimation.target;
if (focusedDisplay) {
focusedDisplay.monitorDistance = Qt.binding(function() { return effect.focusedDisplayDistance; });
}
}
}
SequentialAnimation {
id: zoomOnFocusSequence
running: false
onFinished: {
const focusedDisplay = zoomInSeqAnimation.target;
if (focusedDisplay) {
focusedDisplay.monitorDistance = Qt.binding(function() { return effect.focusedDisplayDistance; });
}
const unfocusedDisplay = zoomOutSeqAnimation.target;
if (unfocusedDisplay) {
unfocusedDisplay.monitorDistance = Qt.binding(function() { return effect.allDisplaysDistance; });
}
}
NumberAnimation {
id: zoomOutSeqAnimation
property: "monitorDistance"
to: effect.allDisplaysDistance
duration: 150
}
PauseAnimation { duration: 50 }
NumberAnimation {
id: zoomInSeqAnimation
property: "monitorDistance"
to: effect.focusedDisplayDistance
duration: 300
}
}
}

View File

@ -1,85 +0,0 @@
import QtQuick
import QtQuick3D
Model {
id: display
required property var screen
required property var sizeAdjustedScreen
required property var monitorPlacement
required property int index
required property var fovDetails
property string cursorImageSource: effect.cursorImageSource
property size cursorImageSize: effect.cursorImageSize
property point cursorPos: effect.cursorPos
Displays {
id: displays
}
// Default to simple rectangle source so we work on older Qt6
// We'll attempt to dynamically load CurvableDisplayMesh.qml in onCompleted
source: "#Rectangle"
Component.onCompleted: {
try {
const component = Qt.createComponent(Qt.resolvedUrl("CurvableDisplayMesh.qml"), Component.PreferSynchronous);
if (component.status === Component.Ready) {
const mesh = component.createObject(display, {
fovDetails: Qt.binding(() => display.fovDetails),
monitorGeometry: Qt.binding(() => display.sizeAdjustedScreen ? display.sizeAdjustedScreen.geometry : null),
fovConversionFns: Qt.binding(() => displays.fovConversionFns)
});
if (mesh) {
display.source = "";
display.geometry = mesh;
effect.curvedDisplaySupported = true;
}
} else {
console.error("Breezy - CurvableDisplayMesh not available:", component.errorString());
effect.curvedDisplaySupported = false;
}
} catch (e) {
console.error("Breezy - CurvableDisplayMesh loading error:", e);
effect.curvedDisplaySupported = false;
}
}
materials: [
CustomMaterial {
id: customMat
depthDrawMode: CustomMaterial.AlwaysDepthDraw
shadingMode: CustomMaterial.Unshaded
property real screenWidth: display.screen.geometry.width
property real screenHeight: display.screen.geometry.height
property real cursorX: display.cursorPos.x - display.screen.geometry.x
property real cursorY: display.cursorPos.y - display.screen.geometry.y
property real cursorW: display.cursorImageSize.width
property real cursorH: display.cursorImageSize.height
property bool showCursor: cursorX >= 0 && cursorX < screenWidth && cursorY >= 0 && cursorY < screenHeight
property TextureInput desktopTex: TextureInput {
texture: Texture {
sourceItem: DesktopView {
screen: display.screen
width: display.screen.geometry.width
height: display.screen.geometry.height
}
}
}
property TextureInput cursorTex: TextureInput {
texture: Texture {
sourceItem: Image {
source: effect.cursorImageSource
width: effect.cursorImageSize.width
height: effect.cursorImageSize.height
}
}
}
fragmentShader: "cursorOverlay.frag"
vertexShader: "cursorOverlay.vert"
}
]
}

View File

@ -1,182 +0,0 @@
import QtQuick
import QtQuick3D
Item {
id: cameraController
required property Camera camera
required property var fovDetails
Displays {
id: displays
}
property real aspectRatio: effect.displayResolution[0] / effect.displayResolution[1]
property real lensDistanceRatio: effect.lensDistanceRatio
property bool sbsEnabled: effect.sbsEnabled
property bool customBannerEnabled: effect.customBannerEnabled
property bool smoothFollowEnabled: effect.smoothFollowEnabled
property real lookAheadScanlineMs: effect.lookAheadConfig[2]
property var fovLengths: displays.diagonalToCrossFOVs(
displays.degreeToRadian(effect.diagonalFOV),
aspectRatio
);
property real fovHalfVerticalTangent: fovLengths.heightUnitDistance / 2.0;
property real fovHalfHorizontalTangent: fovLengths.widthUnitDistance / 2.0;
// if true, then smoothFollowEnabled just cleared and the orientation data is slerping back,
// continue to use the origin data for the duration of the Timer
property bool smoothFollowDisabling: false
property real clipNear: 10.0
property real clipFar: 10000.0
function ratesOfChange(orientations) {
const e0 = orientations[0].toEulerAngles();
const e1 = orientations[1].toEulerAngles();
const dt = effect.poseTimeElapsedMs;
const yawDegrees = (e0.y - e1.y) / dt;
const pitchDegrees = (e0.x - e1.x) / dt;
const rollDegrees = (e0.z - e1.z) / dt;
return {
eulerEnd: e0,
eulerStart: e1,
yawDegrees: yawDegrees,
yaw: displays.degreeToRadian(yawDegrees),
pitchDegrees: pitchDegrees,
pitch: displays.degreeToRadian(pitchDegrees),
rollDegrees: rollDegrees,
roll: displays.degreeToRadian(rollDegrees)
};
}
function updateCamera(orientations, position, rates) {
camera.eulerRotation = applyLookAhead(
rates,
lookAheadMS(
effect.poseTimestamp,
effect.lookAheadConfig,
effect.lookAheadOverride
)
);
let lensVector = Qt.vector3d(0, 0, -fovDetails.lensDistancePixels);
// if we only have 3DoF, account for a bit of positional change based on orientation,
// don't do this for 6DoF to prevent doubling the positional movement due to rotation
if (!effect.poseHasPosition) lensVector = orientations[0].times(lensVector);
camera.position = position.times(fovDetails.fullScreenDistancePixels).plus(lensVector);
}
// how far to look ahead is how old the pose data is plus a constant that is either the default for this device or an override
function lookAheadMS(poseDateMs, lookAheadConfig, override) {
// how stale the pose data is
const dataAge = Date.now() - poseDateMs;
const lookAheadConstant = lookAheadConfig[0];
const lookAheadMultiplier = lookAheadConfig[1];
return (override === -1 ? lookAheadConstant : override) + dataAge;
}
function applyLookAhead(rates, lookAheadMs) {
return Qt.vector3d(
rates.eulerEnd.x + rates.pitchDegrees * lookAheadMs,
rates.eulerEnd.y + rates.yawDegrees * lookAheadMs,
rates.eulerEnd.z + rates.rollDegrees * lookAheadMs,
);
}
function updateProjection() {
camera.projection = buildPerspectiveMatrix();
}
function buildPerspectiveMatrix() {
const f = 1.0 / fovHalfVerticalTangent;
const nf = 1.0 / (clipNear - clipFar);
const m00 = f / aspectRatio;
const m11 = f;
const m22 = (clipFar + clipNear) * nf;
const m23 = (2.0 * clipFar * clipNear) * nf;
// Standard OpenGL-style projection matrix
return Qt.matrix4x4(
m00, 0, 0, 0,
0, m11, 0, 0,
0, 0, m22, m23,
0, 0, -1, 0
);
}
function applyRollingShutterShear(rates) {
// Convert to maximum shift at bottom of frame
const maxDxNdc = (rates.yaw * lookAheadScanlineMs) / fovHalfHorizontalTangent;
const maxDyNdc = -(rates.pitch * lookAheadScanlineMs) / fovHalfVerticalTangent;
let shx = maxDxNdc / 2.0;
let shy = maxDyNdc / 2.0;
const f = 1.0 / fovHalfVerticalTangent;
const nf = 1.0 / (clipNear - clipFar);
const m00 = f / aspectRatio;
const m11 = f;
const m22 = (clipFar + clipNear) * nf;
const m23 = (2.0 * clipFar * clipNear) * nf;
const r0c0 = m00;
const r0c1 = -(shx * m11) / 2.0;
const r0c2 = -(shx) / 2.0;
const r0c3 = 0.0;
const r1c0 = 0.0;
const r1c1 = m11 * (1.0 - shy / 2.0);
const r1c2 = -(shy) / 2.0;
const r1c3 = 0.0;
const r2c0 = 0.0;
const r2c1 = 0.0;
const r2c2 = m22;
const r2c3 = m23;
const r3c0 = 0.0;
const r3c1 = 0.0;
const r3c2 = -1.0;
const r3c3 = 0.0;
camera.projection = Qt.matrix4x4(
r0c0, r0c1, r0c2, r0c3,
r1c0, r1c1, r1c2, r1c3,
r2c0, r2c1, r2c2, r2c3,
r3c0, r3c1, r3c2, r3c3
);
}
Component.onCompleted: updateProjection();
FrameAnimation {
running: true
onTriggered: {
const orientations = (effect.smoothFollowEnabled || smoothFollowDisabling) ? effect.smoothFollowOrigin : effect.poseOrientations;
if (orientations && orientations.length > 0) {
const rates = ratesOfChange(orientations);
updateCamera(orientations, effect.posePosition, rates);
applyRollingShutterShear(rates);
}
}
}
Timer {
id: smoothFollowDisablingTimer
interval: 750
repeat: false
onTriggered: {
cameraController.smoothFollowDisabling = false;
}
}
onSmoothFollowEnabledChanged: {
smoothFollowDisablingTimer.stop();
smoothFollowDisabling = !smoothFollowEnabled;
if (smoothFollowDisabling) smoothFollowDisablingTimer.start();
}
}

View File

@ -1,102 +0,0 @@
import QtQuick
import QtQuick3D
import QtQuick3D.Helpers
ProceduralMesh {
id: mesh
property var fovDetails
property var monitorGeometry
property var fovConversionFns
property var _meshArrays: generateMesh()
positions: _meshArrays.positions
uv0s: _meshArrays.uvs
indexes: _meshArrays.indices
primitiveMode: ProceduralMesh.TriangleStrip
onFovDetailsChanged: _meshArrays = generateMesh()
onMonitorGeometryChanged: _meshArrays = generateMesh()
onFovConversionFnsChanged: _meshArrays = generateMesh()
function generateMesh() {
if (!mesh.fovDetails || !mesh.monitorGeometry || !mesh.fovConversionFns)
return { positions: [], uvs: [], indices: [] };
const fov = mesh.fovDetails;
const monitor = mesh.monitorGeometry;
const horizontalWrap = fov.monitorWrappingScheme === 'horizontal';
const horizontalConversions = horizontalWrap && fov.curvedDisplay ? fovConversionFns.curved : fovConversionFns.flat;
const sideEdgeDistancePixels = horizontalConversions.centerToFovEdgeDistance(
fov.completeScreenDistancePixels, fov.sizeAdjustedWidthPixels);
const horizontalRadians = horizontalConversions.lengthToRadians(
fov.defaultDistanceHorizontalRadians,
fov.widthPixels,
sideEdgeDistancePixels,
monitor.width
);
const verticalWrap = fov.monitorWrappingScheme === 'vertical';
const verticalConversions = verticalWrap && fov.curvedDisplay ? fovConversionFns.curved : fovConversionFns.flat;
const topEdgeDistancePixels = verticalConversions.centerToFovEdgeDistance(
fov.completeScreenDistancePixels, fov.sizeAdjustedHeightPixels);
const verticalRadians = verticalConversions.lengthToRadians(
fov.defaultDistanceVerticalRadians,
fov.heightPixels,
topEdgeDistancePixels,
monitor.height
);
const positions = [];
const uvs = [];
const indices = [];
const radius = fov.completeScreenDistancePixels;
function vertexFor(s, t) {
let z = 0;
const xOffset = s - 0.5;
let x = xOffset * monitor.width;
if (fov.curvedDisplay && horizontalWrap) {
const xOffsetRadians = xOffset * horizontalRadians;
x = Math.sin(xOffsetRadians) * radius;
z = radius - Math.cos(xOffsetRadians) * radius;
}
const yOffset = t - 0.5;
let y = yOffset * monitor.height;
if (fov.curvedDisplay && verticalWrap) {
const yOffsetRadians = yOffset * verticalRadians;
y = Math.sin(yOffsetRadians) * radius;
z = radius - Math.cos(yOffsetRadians) * radius;
}
return { pos: Qt.vector3d(x, y, z), uv: Qt.vector2d(s, t) };
}
let segments = 1;
if (horizontalWrap) segments = horizontalConversions.radiansToSegments(horizontalRadians);
if (verticalWrap) segments = verticalConversions.radiansToSegments(verticalRadians);
for (let i = 0; i <= segments; i++) {
const texFraction = i / segments;
// !verticalWrap also covers "flat" wrap scheme
const texX0 = !verticalWrap ? texFraction : 0;
const texX1 = !verticalWrap ? texFraction : 1;
const texY0 = verticalWrap ? texFraction : 1;
const texY1 = verticalWrap ? texFraction : 0;
let vtxB = vertexFor(texX0, texY0);
let vtxT = vertexFor(texX1, texY1);
positions.push(vtxB.pos);
positions.push(vtxT.pos);
uvs.push(vtxB.uv);
uvs.push(vtxT.uv);
}
return { positions: positions, uvs: uvs, indices: [] };
}
}

View File

@ -1,43 +0,0 @@
import QtQuick
import org.kde.kwin as KWinComponents
Item {
id: desktopView
required property var screen
function overlapsScreen(win, screenGeom) {
if (!win) return false
const winLeft = win.x
const winTop = win.y
const winRight = winLeft + win.width
const winBottom = winTop + win.height
const scrLeft = screenGeom.x
const scrTop = screenGeom.y
const scrRight = scrLeft + screenGeom.width
const scrBottom = scrTop + screenGeom.height
return winLeft < scrRight &&
winRight > scrLeft &&
winTop < scrBottom &&
winBottom > scrTop
}
Repeater {
model: KWinComponents.WindowModel {}
KWinComponents.WindowThumbnail {
// Only show if window overlaps this screen (any amount) and not minimized.
readonly property bool onThisActivity: model.window.activities.length === 0 || model.window.activities.includes(KWinComponents.Workspace.currentActivity)
readonly property bool onThisDesktop: onThisActivity && (model.window.onAllDesktops || model.window.desktops.includes(KWinComponents.Workspace.currentDesktop))
readonly property bool onThisScreen: onThisDesktop && desktopView.overlapsScreen(model.window, desktopView.screen.geometry)
wId: model.window.internalId
x: model.window.x - desktopView.screen.geometry.x
y: model.window.y - desktopView.screen.geometry.y
z: model.window.stackingOrder
visible: onThisScreen && !model.window.minimized
}
}
}

View File

@ -1,477 +0,0 @@
import QtQuick
QtObject {
readonly property real focusThreshold: 0.95 / 2.0
readonly property real unfocusThreshold: 1.1 / 2.0
// Converts degrees to radians
function degreeToRadian(degree) {
return degree * Math.PI / 180;
}
function radianToDegree(radian) {
return radian * 180 / Math.PI;
}
function nwuToEusVector(vector) {
// Converts NWU vector to EUS vector
return Qt.vector3d(-vector.y, vector.z, -vector.x);
}
function eusToNwuVector(vector) {
// Converts EUS vector to NWU vector
return Qt.vector3d(-vector.z, -vector.x, vector.y);
}
function eusToNwuQuat(quaternion) {
// Converts EUS quaternion to NWU quaternion
return Qt.quaternion(quaternion.scalar, -quaternion.z, -quaternion.x, quaternion.y);
}
// Converts diagonal FOV in radians and aspect ratio to horizontal and vertical FOV measurements
function diagonalToCrossFOVs(diagonalFOVRadians, aspectRatio) {
// first convert from a spherical FOV to a diagonal FOV on a flat plane at a unit distance of 1.0
const diagonalLengthUnitDistance = 2 * Math.tan(diagonalFOVRadians / 2);
// then convert to flat plane horizontal and vertical FOVs
const heightUnitDistance = diagonalLengthUnitDistance / Math.sqrt(1 + aspectRatio * aspectRatio);
const widthUnitDistance = heightUnitDistance * aspectRatio;
return {
// then convert back to spherical FOV
diagonalRadians: diagonalFOVRadians,
horizontalRadians: 2 * Math.atan(widthUnitDistance / 2),
verticalRadians: 2 * Math.atan(heightUnitDistance / 2),
// flat values are relative to a unit distance of 1.0
diagonalLengthUnitDistance,
widthUnitDistance,
heightUnitDistance
}
}
function actualWrapScheme(screens, viewportWidth, viewportHeight) {
const minX = Math.min(...screens.map(screen => screen.geometry.x));
const maxX = Math.max(...screens.map(screen => screen.geometry.x + screen.geometry.width));
const minY = Math.min(...screens.map(screen => screen.geometry.y));
const maxY = Math.max(...screens.map(screen => screen.geometry.y + screen.geometry.height));
if ((maxX - minX) / viewportWidth >= (maxY - minY) / viewportHeight) {
return 'horizontal';
} else {
return 'vertical';
}
}
function buildFovDetails(screens, viewportWidth, viewportHeight, viewportDiagonalFOV, lensDistanceRatio, defaultDisplayDistance, wrappingChoice, distanceAdjustedSize) {
const aspect = viewportWidth / viewportHeight;
const fovLengths = diagonalToCrossFOVs(degreeToRadian(viewportDiagonalFOV), aspect);
let monitorWrappingScheme = actualWrapScheme(screens, viewportWidth, viewportHeight);
if (wrappingChoice === 1) monitorWrappingScheme = 'horizontal';
else if (wrappingChoice === 2) monitorWrappingScheme = 'vertical';
else if (wrappingChoice === 3) monitorWrappingScheme = 'flat';
const lensDistanceComplement = 1.0 - lensDistanceRatio;
const lensDistanceFactor = (1.0 / lensDistanceComplement) - 1.0;
const horizontalConversions = effect.curvedDisplay && monitorWrappingScheme === 'horizontal' ? fovConversionFns.curved : fovConversionFns.flat;
const verticalConversions = effect.curvedDisplay && monitorWrappingScheme === 'vertical' ? fovConversionFns.curved : fovConversionFns.flat;
const defaultDistanceVerticalRadians = verticalConversions.fovRadiansAtDistance(
fovLengths.verticalRadians,
fovLengths.heightUnitDistance,
defaultDisplayDistance
);
const defaultDistanceHorizontalRadians = horizontalConversions.fovRadiansAtDistance(
fovLengths.horizontalRadians,
fovLengths.widthUnitDistance,
defaultDisplayDistance
);
// distance needed for the FOV-sized monitor to fill up the screen, as measured from the lenses
const lensToUnitDistancePixels = viewportWidth / fovLengths.widthUnitDistance;
// distance from pivot point to lens
const lensDistancePixels = lensToUnitDistancePixels * lensDistanceFactor;
// distance from pivot point to full screen (monitor at unit distance from lens)
const fullScreenDistancePixels = lensToUnitDistancePixels + lensDistancePixels;
// distance of a display at the default (most zoomed out) distance from the pivot point
const completeScreenDistancePixels = fullScreenDistancePixels * defaultDisplayDistance;
return {
widthPixels: viewportWidth,
distanceAdjustedSize,
sizeAdjustedWidthPixels: viewportWidth * distanceAdjustedSize,
heightPixels: viewportHeight,
sizeAdjustedHeightPixels: viewportHeight * distanceAdjustedSize,
defaultDistanceVerticalRadians,
defaultDistanceHorizontalRadians,
lensDistancePixels,
fullScreenDistancePixels,
completeScreenDistancePixels,
monitorWrappingScheme,
curvedDisplay: effect.curvedDisplay
};
}
// Utility constant
readonly property real segmentsPerRadian: 20.0 / degreeToRadian(90.0)
// FOV conversion functions for flat and curved displays
property var fovConversionFns: ({
flat: {
centerToFovEdgeDistance: function(centerDistance, fovLength) {
return Math.sqrt(Math.pow(fovLength / 2, 2) + Math.pow(centerDistance, 2));
},
fovEdgeToScreenCenterDistance: function(edgeDistance, screenLength) {
return Math.sqrt(Math.pow(edgeDistance, 2) - Math.pow(screenLength / 2, 2));
},
lengthToRadians: function(fovRadians, fovLength, screenEdgeDistance, toLength) {
return Math.asin(toLength / 2 / screenEdgeDistance) * 2;
},
angleToLength: function(fovRadians, fovLength, screenDistance, toAngleOpposite, toAngleAdjacent) {
return toAngleOpposite / toAngleAdjacent * screenDistance;
},
fovRadiansAtDistance: function(fovRadians, unitLength, newScreenDistance) {
return 2 * Math.atan(unitLength / 2 / newScreenDistance);
},
radiansToSegments: function(screenRadians) { return 1; }
},
curved: {
centerToFovEdgeDistance: function(centerDistance, fovLength) {
return centerDistance;
},
fovEdgeToScreenCenterDistance: function(edgeDistance, screenLength) {
return edgeDistance;
},
lengthToRadians: function(fovRadians, fovLength, screenEdgeDistance, toLength) {
return fovRadians / fovLength * toLength;
},
angleToLength: function(fovRadians, fovLength, screenDistance, toAngleOpposite, toAngleAdjacent) {
return fovLength / fovRadians * Math.atan2(toAngleOpposite, toAngleAdjacent);
},
fovRadiansAtDistance: function(fovRadians, unitLength, newScreenDistance) {
return fovRadians / newScreenDistance;
},
radiansToSegments: function(screenRadians) {
return Math.ceil(screenRadians * segmentsPerRadian);
}
}
})
function monitorWrap(cachedMonitorRadians, monitorSpacingPixels, monitorBeginPixel, monitorLengthPixels, lengthToRadianFn) {
var closestWrapPixel = monitorBeginPixel;
var closestWrap = cachedMonitorRadians[monitorBeginPixel];
if (closestWrap === undefined) {
var keys = Object.keys(cachedMonitorRadians);
closestWrapPixel = keys.reduce(function(previousPixel, currentPixel) {
if (previousPixel === undefined) return currentPixel;
var currentDelta = currentPixel - monitorBeginPixel;
var previousDelta = previousPixel - monitorBeginPixel;
if (previousDelta % monitorLengthPixels !== 0) {
if (currentDelta % monitorLengthPixels === 0) return currentPixel;
if (previousDelta < 0 && currentDelta > 0) return currentPixel;
if (Math.abs(currentDelta) < Math.abs(previousDelta)) return currentPixel;
}
return previousPixel;
}, undefined);
closestWrap = cachedMonitorRadians[closestWrapPixel];
}
var spacingRadians = lengthToRadianFn(monitorSpacingPixels);
if (closestWrapPixel !== monitorBeginPixel) {
var gapPixels = monitorBeginPixel - closestWrapPixel;
var gapRadians = lengthToRadianFn(gapPixels);
var appliedSpacingRadians = Math.floor(gapPixels / monitorLengthPixels) * spacingRadians;
closestWrap = closestWrap + gapRadians + appliedSpacingRadians;
closestWrapPixel = monitorBeginPixel;
cachedMonitorRadians[closestWrapPixel] = closestWrap;
}
var monitorRadians = lengthToRadianFn(monitorLengthPixels);
var centerRadians = closestWrap + monitorRadians / 2;
var endRadians = closestWrap + monitorRadians;
var nextMonitorPixel = monitorBeginPixel + monitorLengthPixels;
if (cachedMonitorRadians[nextMonitorPixel] === undefined)
cachedMonitorRadians[nextMonitorPixel] = endRadians + spacingRadians;
return {
begin: closestWrap,
center: centerRadians,
end: endRadians
}
}
function horizontalMonitorSort(monitors) {
return monitors.map(function(monitor, index) {
return { originalIndex: index, monitorDetails: monitor };
}).sort(function(a, b) {
var aMon = a.monitorDetails;
var bMon = b.monitorDetails;
if (aMon.y !== bMon.y) return aMon.y - bMon.y;
return aMon.x - bMon.x;
});
}
function verticalMonitorSort(monitors) {
return monitors.map(function(monitor, index) {
return { originalIndex: index, monitorDetails: monitor };
}).sort(function(a, b) {
var aMon = a.monitorDetails;
var bMon = b.monitorDetails;
if (aMon.x !== bMon.x) return aMon.x - bMon.x;
return aMon.y - bMon.y;
});
}
// fovDetails: { widthPixels, heightPixels, defaultDistanceHorizontalRadians, defaultDistanceVerticalRadians, completeScreenDistancePixels, monitorWrappingScheme, curvedDisplay }
// monitorDetailsList: [{x, y, width, height}, ...]
// monitorSpacing: number (percentage, e.g. 0.05 for 5%)
function monitorsToPlacements(fovDetails, monitorDetailsList, monitorSpacing) {
var monitorPlacements = [];
var cachedMonitorRadians = {};
var conversionFns = fovDetails.curvedDisplay ? fovConversionFns.curved : fovConversionFns.flat;
if (fovDetails.monitorWrappingScheme === 'horizontal') {
// monitors wrap around us horizontally
var sideEdgeRadius = conversionFns.centerToFovEdgeDistance(fovDetails.completeScreenDistancePixels, fovDetails.sizeAdjustedWidthPixels);
var monitorSpacingPixels = monitorSpacing * fovDetails.sizeAdjustedWidthPixels;
// targetWidth is assumed to aleady be size adjusted
var lengthToRadianFn = function(targetWidth) {
return conversionFns.lengthToRadians(
fovDetails.defaultDistanceHorizontalRadians,
fovDetails.widthPixels,
sideEdgeRadius,
targetWidth
);
};
cachedMonitorRadians[0] = -lengthToRadianFn(fovDetails.sizeAdjustedWidthPixels) / 2;
horizontalMonitorSort(monitorDetailsList).forEach(function(obj) {
var monitorDetails = obj.monitorDetails;
var originalIndex = obj.originalIndex;
var monitorWrapDetails = monitorWrap(cachedMonitorRadians, monitorSpacingPixels, monitorDetails.x, monitorDetails.width, lengthToRadianFn);
var monitorCenterRadius = conversionFns.fovEdgeToScreenCenterDistance(sideEdgeRadius, monitorDetails.width);
var upTopPixels = -monitorDetails.y - (monitorDetails.y / fovDetails.sizeAdjustedHeightPixels) * monitorSpacingPixels;
var upCenterOffsetPixels = (monitorDetails.height - fovDetails.sizeAdjustedHeightPixels) / 2;
var upCenterPixels = upTopPixels - upCenterOffsetPixels;
monitorPlacements.push({
originalIndex: originalIndex,
monitorCenterNorth: monitorCenterRadius,
centerNoRotate: Qt.vector3d(
monitorCenterRadius,
0,
upCenterPixels
),
centerLook: Qt.vector3d(
monitorCenterRadius * Math.cos(monitorWrapDetails.center),
-monitorCenterRadius * Math.sin(monitorWrapDetails.center),
upCenterPixels
),
rotationAngleRadians: {
x: 0,
y: -monitorWrapDetails.center
}
});
});
} else if (fovDetails.monitorWrappingScheme === 'vertical') {
var topEdgeRadius = conversionFns.centerToFovEdgeDistance(fovDetails.completeScreenDistancePixels, fovDetails.sizeAdjustedHeightPixels);
var monitorSpacingPixels = monitorSpacing * fovDetails.sizeAdjustedHeightPixels;
var lengthToRadianFn = function(targetHeight) {
return conversionFns.lengthToRadians(
fovDetails.defaultDistanceVerticalRadians,
fovDetails.heightPixels,
topEdgeRadius,
targetHeight
);
};
cachedMonitorRadians[0] = -lengthToRadianFn(fovDetails.sizeAdjustedHeightPixels) / 2;
verticalMonitorSort(monitorDetailsList).forEach(function(obj) {
var monitorDetails = obj.monitorDetails;
var originalIndex = obj.originalIndex;
var monitorWrapDetails = monitorWrap(cachedMonitorRadians, monitorSpacingPixels, monitorDetails.y, monitorDetails.height, lengthToRadianFn);
var monitorCenterRadius = conversionFns.fovEdgeToScreenCenterDistance(topEdgeRadius, monitorDetails.height);
var westLeftPixels = -monitorDetails.x - (monitorDetails.x / fovDetails.sizeAdjustedWidthPixels) * monitorSpacingPixels;
var westCenterOffsetPixels = (monitorDetails.width - fovDetails.sizeAdjustedWidthPixels) / 2;
var westCenterPixels = westLeftPixels - westCenterOffsetPixels;
monitorPlacements.push({
originalIndex: originalIndex,
monitorCenterNorth: monitorCenterRadius,
centerNoRotate: Qt.vector3d(
monitorCenterRadius,
westCenterPixels,
0
),
centerLook: Qt.vector3d(
monitorCenterRadius * Math.cos(monitorWrapDetails.center),
westCenterPixels,
-monitorCenterRadius * Math.sin(monitorWrapDetails.center)
),
rotationAngleRadians: {
x: -monitorWrapDetails.center,
y: 0
}
});
});
} else {
var monitorSpacingPixels = monitorSpacing * fovDetails.sizeAdjustedWidthPixels;
monitorDetailsList.forEach(function(monitorDetails, index) {
var upTopPixels = -monitorDetails.y - (monitorDetails.y / fovDetails.sizeAdjustedHeightPixels) * monitorSpacingPixels;
var westLeftPixels = -monitorDetails.x - (monitorDetails.x / fovDetails.sizeAdjustedWidthPixels) * monitorSpacingPixels;
var westCenterOffsetPixels = (monitorDetails.width - fovDetails.sizeAdjustedWidthPixels) / 2;
var upCenterOffsetPixels = (monitorDetails.height - fovDetails.sizeAdjustedHeightPixels) / 2;
var westCenterPixels = westLeftPixels - westCenterOffsetPixels;
var upCenterPixels = upTopPixels - upCenterOffsetPixels;
monitorPlacements.push({
originalIndex: index,
monitorCenterNorth: fovDetails.completeScreenDistancePixels,
centerNoRotate: Qt.vector3d(
fovDetails.completeScreenDistancePixels,
westCenterPixels,
upCenterPixels
),
centerLook: Qt.vector3d(
fovDetails.completeScreenDistancePixels,
westCenterPixels,
upCenterPixels
),
rotationAngleRadians: {
x: 0,
y: 0
}
});
});
}
// put them back in the original monitor order before returning
monitorPlacements.sort(function(a, b) { return a.originalIndex - b.originalIndex; });
return monitorPlacements;
}
// returns how far the look vector is from the center of the monitor, as a percentage of the monitor's dimensions
function getMonitorDistance(fovDetails, lookUpPixels, lookWestPixels, monitorVector, monitorDetails, upAngleToLength, westAngleToLength) {
// since the monitor vector has been modified to be relative to the lens position, we need to calculate its distance from the lens
// we need to adjust all angle-based lengths based on new vector distance
const monitorDistance = monitorVector.length();
const distanceAdjustment = monitorDistance / fovDetails.completeScreenDistancePixels;
var vectorUpPixels = upAngleToLength(
fovDetails.defaultDistanceVerticalRadians,
fovDetails.heightPixels,
monitorDistance,
monitorVector.z,
monitorVector.x
) * distanceAdjustment;
var upPercentage = Math.abs(lookUpPixels * distanceAdjustment - vectorUpPixels) / monitorDetails.height;
var vectorWestPixels = westAngleToLength(
fovDetails.defaultDistanceHorizontalRadians,
fovDetails.widthPixels,
monitorDistance,
monitorVector.y,
monitorVector.x
) * distanceAdjustment;
var westPercentage = Math.abs(lookWestPixels * distanceAdjustment - vectorWestPixels) / monitorDetails.width;
// how close we are to any edge is the largest of the two percentages
return Math.max(upPercentage, westPercentage);
}
function findFocusedMonitor(quaternion, position, monitorVectors, currentFocusedIndex, smoothFollowEnabled, fovDetails, monitorsDetails) {
if (currentFocusedIndex !== -1 && smoothFollowEnabled) return currentFocusedIndex;
var lookVector = Qt.vector3d(1.0, 0.0, 0.0); // NWU vector pointing to the center of the screen
var rotatedLookVector = quaternion.times(lookVector);
// TODO - right now we're using the curved functions to figure out distances even for flat monitors
// because it will account for the monitors facing towards us, but this will lose some accuracy
var upConversionFns = fovDetails.monitorWrappingScheme === "vertical" ? fovConversionFns.curved : fovConversionFns.flat;
var lookUpPixels = upConversionFns.angleToLength(
fovDetails.defaultDistanceVerticalRadians,
fovDetails.heightPixels,
fovDetails.completeScreenDistancePixels,
rotatedLookVector.z,
rotatedLookVector.x
);
var westConversionFns = fovDetails.monitorWrappingScheme === "horizontal" ? fovConversionFns.curved : fovConversionFns.flat;
var lookWestPixels = westConversionFns.angleToLength(
fovDetails.defaultDistanceHorizontalRadians,
fovDetails.widthPixels,
fovDetails.completeScreenDistancePixels,
rotatedLookVector.y,
rotatedLookVector.x
);
function vectorRelativeToPosition(vector) {
return vector.minus(position);
}
// Check current focused monitor first
if (currentFocusedIndex !== -1) {
var focusedDistance = getMonitorDistance(
fovDetails,
lookUpPixels,
lookWestPixels,
vectorRelativeToPosition(monitorVectors[currentFocusedIndex]),
monitorsDetails[currentFocusedIndex],
upConversionFns.angleToLength,
westConversionFns.angleToLength
) * effect.focusedDisplayDistance / effect.allDisplaysDistance;
if (focusedDistance < unfocusThreshold) return currentFocusedIndex;
}
var closestIndex = -1;
var closestDistance = Number.POSITIVE_INFINITY;
// Find the closest monitor
for (var i = 0; i < monitorVectors.length; ++i) {
if (i === currentFocusedIndex)
continue;
var distance = getMonitorDistance(
fovDetails,
lookUpPixels,
lookWestPixels,
vectorRelativeToPosition(monitorVectors[i]),
monitorsDetails[i],
upConversionFns.angleToLength,
westConversionFns.angleToLength
);
if (distance < closestDistance) {
closestIndex = i;
closestDistance = distance;
}
}
if (smoothFollowEnabled || closestDistance < focusThreshold)
return closestIndex;
// Unfocus all displays
return -1;
}
function slerpVector(from, to, progress) {
const inverseProgress = 1.0 - progress;
const finalVector = Qt.vector3d(
from.x * inverseProgress + to.x * progress,
from.y * inverseProgress + to.y * progress,
from.z * inverseProgress + to.z * progress
);
return finalVector;
}
}

View File

@ -1,21 +0,0 @@
import QtQuick
Item {
id: singleDesktopView
property bool supportsXR: false
property bool showCalibratingBanner: false
DesktopView {
id: desktopViewComponent
screen: targetScreen
width: targetScreen.geometry.width
height: targetScreen.geometry.height
}
Image {
source: effect.customBannerEnabled ? "custom_banner.png" : "calibrating.png"
visible: supportsXR && showCalibratingBanner
anchors.horizontalCenter: desktopViewComponent.horizontalCenter
anchors.bottom: desktopViewComponent.bottom
}
}

View File

@ -1,18 +0,0 @@
VARYING vec3 pos;
VARYING vec2 texcoord;
void MAIN() {
vec2 tex = vec2(texcoord.x, 1.0 - texcoord.y);
vec4 color = texture(desktopTex, tex);
if (showCursor) {
vec2 fragCoord = tex * vec2(screenWidth, screenHeight);
vec2 cursorTopLeft = vec2(cursorX, cursorY);
vec2 cursorBottomRight = cursorTopLeft + vec2(cursorW, cursorH);
if (fragCoord.x >= cursorTopLeft.x && fragCoord.x < cursorBottomRight.x && fragCoord.y >= cursorTopLeft.y && fragCoord.y < cursorBottomRight.y) {
vec2 rel = (fragCoord - cursorTopLeft) / vec2(cursorW, cursorH);
vec4 cursorCol = texture(cursorTex, rel);
color = mix(color, cursorCol, cursorCol.a);
}
}
FRAGCOLOR = color;
}

View File

@ -1,10 +0,0 @@
VARYING vec3 pos;
VARYING vec2 texcoord;
// this is a no-op vertex shader, CustomMaterial required one
void MAIN()
{
pos = VERTEX;
texcoord = UV0;
POSITION = MODELVIEWPROJECTION_MATRIX * vec4(pos, 1.0);
}

View File

@ -1,191 +0,0 @@
import QtQuick
import QtQuick3D
import org.kde.kwin as KWinComponents
import org.kde.kwin.effect.breezy_desktop
Item {
id: root
antialiasing: true
focus: false
readonly property var supportedModels: [
"VITURE",
"nreal air",
"Air",
"Air 2",
"Air 2 Pro",
"Air 2 Ultra",
"One",
"One Pro",
"XREAL One",
"XREAL One Pro",
"XREAL 1S",
"SmartGlasses", // TCL/RayNeo
"Rokid Max",
"Rokid Max 2",
"Rokid Air"
]
required property QtObject effect
required property QtObject targetScreen
property real viewportDiagonalFOVDegrees: effect.diagonalFOV
property var viewportResolution: effect.displayResolution
property bool mirrorPhysicalDisplays: effect.mirrorPhysicalDisplays
property bool developerMode: effect.developerMode
property var screens: KWinComponents.Workspace.screens.filter(function(screen) {
return developerMode || mirrorPhysicalDisplays || screen.name.includes("BreezyDesktop") || supportedModels.some(model => screen.model.includes(model));
})
property real distanceAdjustedSize: (effect.allDisplaysDistance - effect.lensDistanceRatio) * effect.displaySize
property var sizeAdjustedScreens: screens.map(function(screen) {
const sizeComplement = (1.0 - distanceAdjustedSize) / 2.0;
const sizeViewportOffsetX = sizeComplement * viewportResolution[0];
const sizeViewportOffsetY = sizeComplement * viewportResolution[1];
return {
geometry: {
x: screen.geometry.x * distanceAdjustedSize + sizeViewportOffsetX,
y: screen.geometry.y * distanceAdjustedSize + sizeViewportOffsetY,
width: screen.geometry.width * distanceAdjustedSize,
height: screen.geometry.height * distanceAdjustedSize
},
name: screen.name,
model: screen.model
};
})
property var sizeAdjustedViewport: {
return {
width: viewportResolution[0] * distanceAdjustedSize,
height: viewportResolution[1] * distanceAdjustedSize
};
}
// x value for placing the viewport in the middle of all screens
property real screensXMid: {
let xMin = Number.MAX_VALUE;
let xMax = Number.MIN_VALUE;
for (let i = 0; i < sizeAdjustedScreens.length; i++) {
const geometry = sizeAdjustedScreens[i].geometry;
xMin = Math.min(xMin, geometry.x);
xMax = Math.max(xMax, geometry.x + geometry.width);
}
return (xMin + xMax) / 2 - (sizeAdjustedViewport.width / 2);
}
// y value for placing the viewport in the middle of all screens
property real screensYMid: {
let yMin = Number.MAX_VALUE;
let yMax = Number.MIN_VALUE;
for (let i = 0; i < sizeAdjustedScreens.length; i++) {
const geometry = sizeAdjustedScreens[i].geometry;
yMin = Math.min(yMin, geometry.y);
yMax = Math.max(yMax, geometry.y + geometry.height);
}
return (yMin + yMax) / 2 - (sizeAdjustedViewport.height / 2);
}
Displays {
id: displays
}
property var fovDetails: displays.buildFovDetails(
sizeAdjustedScreens,
viewportResolution[0],
viewportResolution[1],
viewportDiagonalFOVDegrees,
effect.lensDistanceRatio,
effect.allDisplaysDistance,
effect.displayWrappingScheme,
distanceAdjustedSize
)
property var monitorPlacements: {
const dx = effect.displayHorizontalOffset * sizeAdjustedViewport.width;
const dy = effect.displayVerticalOffset * sizeAdjustedViewport.height;
const adjustedGeometries = sizeAdjustedScreens.map(screen => {
const g = screen.geometry;
return {
x: g.x - screensXMid + dx,
y: g.y - screensYMid + dy,
width: g.width,
height: g.height
};
});
return displays.monitorsToPlacements(fovDetails, adjustedGeometries, effect.displaySpacing);
}
property bool targetScreenSupported: developerMode || supportedModels.some(model => root.targetScreen.model.includes(model))
property bool targetScreenIsVirtual: targetScreen.name.includes("BreezyDesktop")
property bool poseResetState: effect.poseResetState
property bool isEnabled: effect.isEnabled
Component {
id: desktopViewComponent
SingleDesktopView {
supportsXR: targetScreenSupported
showCalibratingBanner: isEnabled && poseResetState
}
}
Component {
id: view3DComponent
View3D {
anchors.fill: parent
environment: SceneEnvironment {
antialiasingMode: root.effect.antialiasingQuality === 0 ? SceneEnvironment.NoAA : SceneEnvironment.SSAA
antialiasingQuality: root.effect.antialiasingQuality === 0 ? SceneEnvironment.Medium : (
root.effect.antialiasingQuality === 1 ? SceneEnvironment.Medium : (
root.effect.antialiasingQuality === 2 ? SceneEnvironment.High : SceneEnvironment.VeryHigh))
}
CustomCamera {
id: camera
}
BreezyDesktop {
id: breezyDesktop
screens: root.screens
sizeAdjustedScreens: root.sizeAdjustedScreens
fovDetails: root.fovDetails
monitorPlacements: root.monitorPlacements
}
CameraController {
id: cameraController
anchors.fill: parent
camera: camera
fovDetails: root.fovDetails
}
}
}
Loader {
id: viewLoader
anchors.fill: parent
}
function checkLoadedComponent() {
console.log(`Breezy - checking screen ${targetScreen.model}: ${targetScreenSupported} ${targetScreenIsVirtual} ${isEnabled} ${poseResetState}`);
const show3DView = targetScreenSupported && isEnabled && !poseResetState;
if (!targetScreenIsVirtual) viewLoader.sourceComponent = show3DView ? view3DComponent : desktopViewComponent;
if (targetScreenSupported) effect.effectTargetScreenIndex = KWinComponents.Workspace.screens.indexOf(targetScreen);
}
onScreensChanged: {
checkLoadedComponent();
}
onPoseResetStateChanged: {
checkLoadedComponent();
}
onIsEnabledChanged: {
checkLoadedComponent();
}
Component.onCompleted: {
checkLoadedComponent();
}
}

View File

@ -1,26 +0,0 @@
add_library(xr_driver_ipc STATIC
xrdriveripc.cpp
)
# Ensure position independent code so the static archive can link into the KWin effect plugin (a shared module)
set_target_properties(xr_driver_ipc PROPERTIES POSITION_INDEPENDENT_CODE ON)
# Generate an export header so symbols can be visible outside the shared lib
include(GenerateExportHeader)
generate_export_header(xr_driver_ipc EXPORT_FILE_NAME xr_driver_ipc_export.h)
target_include_directories(xr_driver_ipc
PUBLIC
${CMAKE_CURRENT_BINARY_DIR} # for generated export header
)
target_compile_options(xr_driver_ipc PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/EHsc>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-fexceptions>
)
target_link_libraries(xr_driver_ipc
PRIVATE Qt6::Core
)
install(FILES xrdriveripc.py xrdriveripc_runner.py DESTINATION ${KDE_INSTALL_DATADIR}/kwin/effects/breezy_desktop)

View File

@ -1,117 +0,0 @@
// New implementation using QProcess to call python
#include "xrdriveripc.h"
#include <iostream>
#include <cmath>
#include <QFileInfo>
#include <QProcess>
#include <QProcessEnvironment>
#include <QStandardPaths>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonValue>
XRDriverIPC &XRDriverIPC::instance() {
static XRDriverIPC inst;
if (!inst.m_initialized) {
QString installedFile = QStandardPaths::locate(
QStandardPaths::GenericDataLocation,
QStringLiteral("kwin/effects/breezy_desktop/xrdriveripc.py"),
QStandardPaths::LocateFile);
if (installedFile.isEmpty()) {
throw std::runtime_error("Cannot locate kwin/effects/breezy_desktop/xrdriveripc.py");
}
inst.m_pythonDir = QFileInfo(installedFile).path();
inst.m_initialized = true;
}
return inst;
}
std::string XRDriverIPC::configHome() const {
QString configHome = QString::fromUtf8(qgetenv("XDG_CONFIG_HOME"));
if (configHome.isEmpty()) {
QString homeDir = QString::fromUtf8(qgetenv("HOME"));
configHome = homeDir + QStringLiteral("/.config");
}
return configHome.toStdString();
}
QByteArray XRDriverIPC::invokePython(const QString &method,
const QByteArray &payloadJson,
const QString &singleArg) const {
QProcess proc;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert(QStringLiteral("BREEZY_METHOD"), method);
env.insert(QStringLiteral("BREEZY_CONFIG_HOME"), QString::fromStdString(configHome()));
if (!singleArg.isEmpty()) env.insert(QStringLiteral("BREEZY_ARG"), singleArg);
if (!payloadJson.isEmpty()) env.insert(QStringLiteral("BREEZY_PAYLOAD"), QString::fromUtf8(payloadJson));
proc.setProcessEnvironment(env);
// Expect xrdriveripc_runner.py to reside in the same directory as xrdriveripc.py (m_pythonDir)
QString wrapperPath = m_pythonDir + QStringLiteral("/xrdriveripc_runner.py");
proc.start(QStringLiteral("python3"), QStringList() << wrapperPath);
if (!proc.waitForStarted(5000)) {
std::cerr << "Failed to start python process" << std::endl;
return {};
}
proc.closeWriteChannel();
if (!proc.waitForFinished(15000)) {
proc.kill();
std::cerr << "Python process timeout" << std::endl;
return {};
}
if (proc.exitStatus() != QProcess::NormalExit || proc.exitCode() != 0) {
std::cerr << "Python process failed (" << proc.exitCode() << "):\n"
<< proc.readAllStandardError().toStdString() << std::endl;
return {};
}
return proc.readAllStandardOutput().trimmed();
}
std::optional<QJsonObject> XRDriverIPC::retrieveConfig() {
QByteArray out = invokePython(QStringLiteral("retrieve_config"), {}, QStringLiteral("0"));
if (out.isEmpty()) return std::nullopt;
QJsonParseError err; auto doc = QJsonDocument::fromJson(out, &err);
if (err.error != QJsonParseError::NoError || !doc.isObject()) return std::nullopt;
return doc.object();
}
std::optional<QJsonObject> XRDriverIPC::retrieveDriverState() {
QByteArray out = invokePython(QStringLiteral("retrieve_driver_state"), {}, {});
if (out.isEmpty()) return std::nullopt;
QJsonParseError err; auto doc = QJsonDocument::fromJson(out, &err);
if (err.error != QJsonParseError::NoError || !doc.isObject()) return std::nullopt;
return doc.object();
}
bool XRDriverIPC::writeConfig(const QJsonObject &configUpdate) {
QByteArray payload = QJsonDocument(configUpdate).toJson(QJsonDocument::Compact);
QByteArray out = invokePython(QStringLiteral("write_config"), payload, {});
return !out.isEmpty();
}
bool XRDriverIPC::writeControlFlags(const QJsonObject &flags) {
QByteArray payload = QJsonDocument(flags).toJson(QJsonDocument::Compact);
QByteArray out = invokePython(QStringLiteral("write_control_flags"), payload, {});
return !out.isEmpty();
}
bool XRDriverIPC::requestToken(const std::string &email) {
QByteArray out = invokePython(QStringLiteral("request_token"), {}, QString::fromStdString(email));
if (out.isEmpty()) return false;
QString result = QString::fromUtf8(out).trimmed().toLower();
return result == QStringLiteral("true");
}
bool XRDriverIPC::verifyToken(const std::string &token) {
QByteArray out = invokePython(QStringLiteral("verify_token"), {}, QString::fromStdString(token));
if (out.isEmpty()) return false;
QString result = QString::fromUtf8(out).trimmed().toLower();
return result == QStringLiteral("true");
}
bool XRDriverIPC::resetDriver() {
QByteArray out = invokePython(QStringLiteral("reset_driver"), {}, {});
if (out.isEmpty()) return false;
QString result = QString::fromUtf8(out).trimmed().toLower();
return result == QStringLiteral("true");
}

View File

@ -1,104 +0,0 @@
// C++ bridge now invoking xrdriveripc via external python process
#pragma once
#include <QString>
#include <QByteArray>
#include <QJsonObject>
#include <optional>
// Export header generated by CMake (GenerateExportHeader)
#ifdef __has_include
# if __has_include("xr_driver_ipc_export.h")
# include "xr_driver_ipc_export.h"
# endif
#endif
#ifndef XR_DRIVER_IPC_EXPORT
# define XR_DRIVER_IPC_EXPORT __attribute__((visibility("default")))
#endif
namespace XRStateEntry {
inline constexpr const char *Heartbeat = "heartbeat";
inline constexpr const char *HardwareId = "hardware_id";
inline constexpr const char *ConnectedDeviceBrand = "connected_device_brand";
inline constexpr const char *ConnectedDeviceModel = "connected_device_model";
inline constexpr const char *MagnetSupported = "magnet_supported";
inline constexpr const char *MagnetCalibrationType = "magnet_calibration_type";
inline constexpr const char *UsingMagnet = "using_magnet";
inline constexpr const char *MagnetStale = "magnet_stale";
inline constexpr const char *MagnetCalibrating = "magnet_calibrating";
inline constexpr const char *GyroCalibrating = "gyro_calibrating";
inline constexpr const char *AccelCalibrating = "accel_calibrating";
inline constexpr const char *SbsModeEnabled = "sbs_mode_enabled";
inline constexpr const char *SbsModeSupported = "sbs_mode_supported";
inline constexpr const char *FirmwareUpdateRecommended = "firmware_update_recommended";
inline constexpr const char *BreezyDesktopSmoothFollowEnabled = "breezy_desktop_smooth_follow_enabled";
inline constexpr const char *IsGamescopeReshadeIPCConnected = "is_gamescope_reshade_ipc_connected";
inline constexpr const char *UiView = "ui_view_enabled";
namespace UIView {
inline constexpr const char *DriverRunning = "driver_running";
namespace License {
inline constexpr const char *Tiers = "tiers";
inline constexpr const char *Features = "features";
inline constexpr const char *HardwareId = "hardware_id";
inline constexpr const char *ConfirmedToken = "confirmed_token";
inline constexpr const char *ActionNeeded = "action_needed";
inline constexpr const char *EnabledFeatures = "enabled_features";
}
}
}
namespace XRConfigEntry {
inline constexpr const char *Disabled = "disabled";
inline constexpr const char *GamescopeReshadeWaylandDisabled = "gamescope_reshade_wayland_disabled";
inline constexpr const char *OutputMode = "output_mode";
inline constexpr const char *ExternalMode = "external_mode";
inline constexpr const char *MouseSensitivity = "mouse_sensitivity";
inline constexpr const char *DisplayZoom = "display_zoom";
inline constexpr const char *LookAhead = "look_ahead";
inline constexpr const char *SbsDisplaySize = "sbs_display_size";
inline constexpr const char *SbsDisplayDistance = "sbs_display_distance";
inline constexpr const char *SbsContent = "sbs_content";
inline constexpr const char *SbsModeStretched = "sbs_mode_stretched";
inline constexpr const char *SideviewPosition = "sideview_position";
inline constexpr const char *SideviewDisplaySize = "sideview_display_size";
inline constexpr const char *VirtualDisplaySmoothFollowEnabled = "virtual_display_smooth_follow_enabled";
inline constexpr const char *SideviewSmoothFollowEnabled = "sideview_smooth_follow_enabled";
inline constexpr const char *SideviewFollowThreshold = "sideview_follow_threshold";
inline constexpr const char *CurvedDisplay = "curved_display";
inline constexpr const char *MultiTapEnabled = "multi_tap_enabled";
inline constexpr const char *SmoothFollowTrackRoll = "smooth_follow_track_roll";
inline constexpr const char *SmoothFollowTrackPitch = "smooth_follow_track_pitch";
inline constexpr const char *SmoothFollowTrackYaw = "smooth_follow_track_yaw";
inline constexpr const char *Debug = "debug";
}
class XR_DRIVER_IPC_EXPORT XRDriverIPC {
public:
static XRDriverIPC &instance();
std::optional<QJsonObject> retrieveConfig();
std::optional<QJsonObject> retrieveDriverState();
bool writeConfig(const QJsonObject &configUpdate);
bool writeControlFlags(const QJsonObject &flags);
bool requestToken(const std::string &email);
bool verifyToken(const std::string &token);
bool resetDriver();
private:
XRDriverIPC() = default;
~XRDriverIPC() = default;
XRDriverIPC(const XRDriverIPC&) = delete;
XRDriverIPC& operator=(const XRDriverIPC&) = delete;
std::string configHome() const;
QByteArray invokePython(const QString &method,
const QByteArray &payloadJson,
const QString &singleArg) const;
bool m_initialized = false;
QString m_pythonDir; // directory containing xrdriveripc.py
};

View File

@ -1,87 +0,0 @@
#!/usr/bin/env python3
"""Wrapper script invoked by xrdriveripc.cpp via QProcess.
It reads environment variables to determine which XRDriverIPC method to call
and prints the JSON-serialized result to stdout, mirroring the prior inline
python one-liner implementation.
"""
from __future__ import annotations
import logging
import json
import os
import sys
import traceback
from logging.handlers import TimedRotatingFileHandler
state_home = os.environ.get('XDG_STATE_HOME', '~/.local/state')
state_dir = os.path.expanduser(state_home)
breezy_state_dir = os.path.join(state_dir, 'breezy_kwin')
log_dir = os.path.join(breezy_state_dir, 'logs')
os.makedirs(log_dir, exist_ok=True)
logger = logging.getLogger('xrdriveripc')
logger.setLevel(logging.INFO)
logname = os.path.join(log_dir, "xrdriveripc.log")
handler = TimedRotatingFileHandler(logname, when="midnight", backupCount=30)
handler.suffix = "%Y%m%d"
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
class Logger:
def info(self, *args, **kwargs):
logger.info(*args, **kwargs)
def error(self, *args, **kwargs):
logger.error(*args, **kwargs)
def main() -> int:
# Ensure the current directory (where xrdriveripc.py lives) is in sys.path
script_dir = os.path.dirname(os.path.abspath(__file__))
if script_dir not in sys.path:
sys.path.insert(0, script_dir)
try:
import xrdriveripc # type: ignore
except Exception as e: # pragma: no cover - import failure path
print("Failed to import xrdriveripc: %s" % e, file=sys.stderr)
return 2
method = os.environ.get("BREEZY_METHOD")
if not method:
print("BREEZY_METHOD not set", file=sys.stderr)
return 2
config_home = os.environ.get("BREEZY_CONFIG_HOME")
inst = xrdriveripc.XRDriverIPC(logger=Logger(), config_home=config_home)
arg = os.environ.get("BREEZY_ARG")
payload_raw = os.environ.get("BREEZY_PAYLOAD")
# Dispatch replicating previous inline logic
try:
if method == "retrieve_config":
res = getattr(inst, method)(int(arg) if arg else 1)
elif method in ("write_config", "write_control_flags") and payload_raw:
res = getattr(inst, method)(json.loads(payload_raw))
elif method in ("request_token", "verify_token") and arg:
res = getattr(inst, method)(arg)
else:
res = getattr(inst, method)()
except Exception: # pragma: no cover - runtime failure path
traceback.print_exc()
return 3
try:
print(json.dumps(res))
except Exception: # pragma: no cover
traceback.print_exc()
return 3
return 0
if __name__ == "__main__": # pragma: no cover
sys.exit(main())

@ -1 +0,0 @@
Subproject commit 33f15b0e15b141e7664afcc4c09d2c19b62716c0

@ -1 +0,0 @@
Subproject commit e3da76189390d81fda70ced38976a2061a8711ea

@ -0,0 +1 @@
Subproject commit ab5f01035bdd3f2120fdea383c14a65fe93bf2b7

View File

@ -1,38 +0,0 @@
USER_HOME=$(realpath ~)
ARCH=$(uname -m)
# https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
if [ -z "$XDG_DATA_HOME" ]; then
XDG_DATA_HOME="$USER_HOME/.local/share"
fi
if [ -z "$XDG_BIN_HOME" ]; then
XDG_BIN_HOME="$USER_HOME/.local/bin"
fi
# create temp directory
tmp_dir=$(mktemp -d -t breezy-gnome-XXXXXXXXXX)
pushd $tmp_dir > /dev/null
echo "Created temp directory: ${tmp_dir}"
echo "Extracting to: ${tmp_dir}/breezy_ui"
tar -xf $SCRIPT_DIR/../../out/breezyUI-${ARCH}.tar.gz
echo "Installing the Breezy Desktop UI application"
cp -r breezy_ui/data/* $XDG_DATA_HOME
cp -r breezy_ui/bin/* $XDG_BIN_HOME
# update copied files to use the local XDG paths
ESCAPED_XDG_DATA_HOME=$(printf '%s\n' "$XDG_DATA_HOME" | sed -e 's/[\/&]/\\&/g')
sed -i -e "s/\/usr\/local\/share/$ESCAPED_XDG_DATA_HOME/g" $XDG_BIN_HOME/breezydesktop
sed -i "/Exec/c\Exec=$XDG_BIN_HOME/breezydesktop" $XDG_DATA_HOME/applications/com.xronlinux.BreezyDesktop.desktop
glib-compile-schemas $XDG_DATA_HOME/glib-2.0/schemas
update-desktop-database $XDG_DATA_HOME/applications
gtk-update-icon-cache
popd > /dev/null
rm -rf $tmp_dir

View File

@ -1,67 +0,0 @@
#!/usr/bin/env bash
# exit when any command fails
set -e
ARCH=${ARCH:-$(uname -m)}
echo "Building Breezy UI for $ARCH"
BUILD_PATH=build
UI_BUILD_PATH=$BUILD_PATH/ui
PACKAGE_DIR=$BUILD_PATH/breezy_ui
mkdir -p $UI_BUILD_PATH
mkdir -p $PACKAGE_DIR
meson setup $UI_BUILD_PATH
pushd $UI_BUILD_PATH
meson compile
popd
# mimick the XDG directory structure in our archive file so setup can just copy the directories and not individual files
PACKAGE_DATA_DIR=$PACKAGE_DIR/data
PACKAGE_BIN_DIR=$PACKAGE_DIR/bin
# these are all subdirectories of XDG_DATA_HOME
PACKAGE_BREEZY_DIR=$PACKAGE_DATA_DIR/breezydesktop
PACKAGE_BREEZY_SRC_DIR=$PACKAGE_BREEZY_DIR/breezydesktop
PACKAGE_ICONS_DIR=$PACKAGE_DATA_DIR/icons/hicolor
PACKAGE_LOCALE_DIR=$PACKAGE_DATA_DIR/locale
PACKAGE_APPS_DIR=$PACKAGE_DATA_DIR/applications
PACKAGE_SCHEMAS_DIR=$PACKAGE_DATA_DIR/glib-2.0/schemas
mkdir -p $PACKAGE_BIN_DIR
mkdir -p $PACKAGE_BREEZY_SRC_DIR
mkdir -p $PACKAGE_ICONS_DIR
mkdir -p $PACKAGE_LOCALE_DIR
mkdir -p $PACKAGE_APPS_DIR
mkdir -p $PACKAGE_SCHEMAS_DIR
cp src/*.py $PACKAGE_BREEZY_SRC_DIR
cp -r lib $PACKAGE_BREEZY_SRC_DIR
cp -L modules/PyXRLinuxDriverIPC/xrdriveripc.py $PACKAGE_BREEZY_SRC_DIR
cp $UI_BUILD_PATH/src/breezydesktop.gresource $PACKAGE_BREEZY_DIR
cp -r po/mo/* $PACKAGE_LOCALE_DIR
cp data/com.xronlinux.BreezyDesktop.gschema.xml $PACKAGE_SCHEMAS_DIR
cp $UI_BUILD_PATH/src/breezydesktop $PACKAGE_BIN_DIR
cp $UI_BUILD_PATH/src/virtualdisplay $PACKAGE_BIN_DIR
cp $UI_BUILD_PATH/data/com.xronlinux.BreezyDesktop.desktop $PACKAGE_APPS_DIR
mkdir -p $PACKAGE_ICONS_DIR/64x64/apps
mkdir -p $PACKAGE_ICONS_DIR/128x128/apps
mkdir -p $PACKAGE_ICONS_DIR/256x256/apps
mkdir -p $PACKAGE_ICONS_DIR/1024x1024/apps
rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 64 -h 64 -o $PACKAGE_ICONS_DIR/64x64/apps/com.xronlinux.BreezyDesktop.png
rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 128 -h 128 -o $PACKAGE_ICONS_DIR/128x128/apps/com.xronlinux.BreezyDesktop.png
rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 256 -h 256 -o $PACKAGE_ICONS_DIR/256x256/apps/com.xronlinux.BreezyDesktop.png
rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 1024 -h 1024 -o $PACKAGE_ICONS_DIR/1024x1024/apps/com.xronlinux.BreezyDesktop.png
pushd $BUILD_PATH
tar -zcvf breezyUI-$ARCH.tar.gz breezy_ui
popd
mkdir -p out
cp $BUILD_PATH/breezyUI-$ARCH.tar.gz out/
rm -rf $BUILD_PATH

View File

@ -1,21 +0,0 @@
#!/usr/bin/env bash
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
pushd $SCRIPT_DIR/..
xgettext --from-code=UTF-8 -k_ -kN_ -L Python -o po/breezydesktop.pot src/*.py
xgettext --from-code=UTF-8 -k_ -kN_ -j -L Glade -o po/breezydesktop.pot src/gtk/*.ui
for file in po/*.po; do
lang=${file##*/}
lang=${lang%.po}
msgmerge --no-fuzzy-matching --update "po/$lang.po" po/breezydesktop.pot
outdir="po/mo/$lang/LC_MESSAGES"
mkdir -p "$outdir"
msgfmt -o "$outdir/breezydesktop.mo" "$file"
done
popd

View File

@ -1,8 +0,0 @@
[Desktop Entry]
Name=Breezy Desktop
Exec=breezydesktop
Icon=com.xronlinux.BreezyDesktop
Terminal=false
Type=Application
Categories=GTK;
StartupNotify=true

View File

@ -1,293 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="breezydesktop">
<schema id="com.xronlinux.BreezyDesktop" path="/com/xronlinux/BreezyDesktop/">
<key name="toggle-xr-effect-shortcut" type="as">
<default>
<![CDATA[['<Control><Super>backslash']]]>
</default>
<summary>Toggle the XR Effect on or off</summary>
<description>
Shortcut to toggle the XR Effect.
</description>
</key>
<key name="recenter-display-shortcut" type="as">
<default>
<![CDATA[['<Control><Super>space']]]>
</default>
<summary>Re-center display</summary>
<description>
Shortcut to re-center the virtual display.
</description>
</key>
<key name="toggle-display-distance-shortcut" type="as">
<default>
<![CDATA[['<Control><Super>Return']]]>
</default>
<summary>Trigger change to display distance</summary>
<description>
Shortcut to change the display distance.
</description>
</key>
<key name="toggle-follow-shortcut" type="as">
<default>
<![CDATA[['<Control><Super>0']]]>
</default>
<summary>Toggle follow mode</summary>
<description>
Shortcut to toggle follow mode.
</description>
</key>
<key name="cursor-to-focused-display-shortcut" type="as">
<default>
<![CDATA[['<Control><Super>period']]]>
</default>
<summary>Move cursor to focused display</summary>
<description>
Shortcut to move the cursor to the focused display.
</description>
</key>
<key name="display-distance" type="d">
<default>
1.05
</default>
<summary>Display distance</summary>
<description>
How far away the display appears. Farther will look smaller, closer will look larger.
</description>
</key>
<key name="follow-threshold" type="d">
<default>
15
</default>
<summary>Follow threshold</summary>
<description>
When follow mode is enabled: the threshold, in degrees, at which the display will begin to follow
</description>
</key>
<key name="toggle-display-distance-start" type="d">
<default>
0.85
</default>
<summary>Display distance start</summary>
<description>
Start distance when using the "change distance" shortcut.
</description>
</key>
<key name="toggle-display-distance-end" type="d">
<default>
1.05
</default>
<summary>Display distance end</summary>
<description>
End distance when using the "toggle display distance" shortcut.
</description>
</key>
<key name="widescreen-mode" type="b">
<default>
false
</default>
<summary>Widescreen mode</summary>
<description>
Enable widescreen/SBS mode
</description>
</key>
<key name="display-size" type="d">
<default>
1.0
</default>
<summary>Display size</summary>
<description>
The size of the display
</description>
</key>
<key name="units" type="s">
<default>
"cm"
</default>
<summary>Measurement units</summary>
<description>
Units to display for physical measurements: "cm" or "in"
</description>
</key>
<key name="viewport-offset-x" type="d">
<default>
0.0
</default>
<summary>Viewport offset x</summary>
<description>
How far to offset the viewport from the target monitor in the x direction
</description>
</key>
<key name="viewport-offset-y" type="d">
<default>
0.0
</default>
<summary>Viewport offset y</summary>
<description>
How far to offset the viewport from the target monitor in the y direction
</description>
</key>
<key name="monitor-wrapping-scheme" type="s">
<default>
"automatic"
</default>
<summary>Monitor wrapping scheme</summary>
<description>
How the monitors are wrapped around the viewport
</description>
</key>
<key name="monitor-spacing" type="i">
<default>
0
</default>
<summary>Monitor spacing</summary>
<description>
How far apart the monitors are visually (not logically)
</description>
</key>
<key name="curved-display" type="b">
<default>
false
</default>
<summary>Curved display</summary>
<description>
Enable curved display mode
</description>
</key>
<key name="look-ahead-override" type="i">
<default>
-1
</default>
<summary>Look-ahead override</summary>
<description>
Manually override the look-ahead calculation
</description>
</key>
<key name="use-optimal-monitor-config" type="b">
<default>
true
</default>
<summary>Use optimal monitor configuration</summary>
<description>
Automatically set the optimal monitor configuration upon connection
</description>
</key>
<key name="headset-as-primary" type="b">
<default>
false
</default>
<summary>Headset as primary</summary>
<description>
Automatically set the headset as the primary display upon connection
</description>
</key>
<key name="headset-display-as-viewport-center" type="b">
<default>
false
</default>
<summary>Headset display as viewport center</summary>
<description>
Use the headset display as the reference point for the center of the viewport
</description>
</key>
<key name="use-highest-refresh-rate" type="b">
<default>
true
</default>
<summary>Use highest refresh rate</summary>
<description>
Automatically set the highest refresh rate upon connection
</description>
</key>
<key name="fast-sbs-mode-switching" type="b">
<default>
true
</default>
<summary>Fast SBS mode switching</summary>
<description>
Enable fast SBS mode switching
</description>
</key>
<key name="disable-anti-aliasing" type="b">
<default>
false
</default>
<summary>Disable anti-aliasing</summary>
<description>
Disable anti-aliasing
</description>
</key>
<key name="disable-physical-displays" type="b">
<default>
true
</default>
<summary>Disable physical displays</summary>
<description>
Disable physical displays when XR effect is enabled
</description>
</key>
<key name="remove-virtual-displays-on-disable" type="b">
<default>
true
</default>
<summary>Remove virtual displays on disable</summary>
<description>
Remove virtual displays when XR effect is disabled
</description>
</key>
<key name="legacy-follow-mode" type="b">
<default>
false
</default>
<summary>Legacy follow mode</summary>
<description>
Enable legacy follow mode
</description>
</key>
<key name="developer-mode" type="b">
<default>
false
</default>
<summary>Developer mode</summary>
<description>
Enable developer mode
</description>
</key>
<key name="debug" type="b">
<default>
false
</default>
<summary>Log debug messages</summary>
<description>
Log debug messages
</description>
</key>
<key name="debug-no-device" type="b">
<default>
false
</default>
<summary>Debug no device</summary>
<description>
Debug no device
</description>
</key>
<key name="custom-monitor-product" type="s">
<default>
""
</default>
<summary>Custom monitor product</summary>
<description>
Custom monitor product
</description>
</key>
<key name="framerate-cap" type="d">
<default>
0.0
</default>
<summary>Framerate cap</summary>
<description>
Framerate cap
</description>
</key>
</schema>
</schemalist>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>com.xronlinux.BreezyDesktop.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<name>Breezy Desktop</name>
<summary>XR Desktop Control Panel</summary>
<description>
<p>XR Desktop Control Panel</p>
</description>
<categories>
<category>Office</category>
<category>Development</category>
</categories>
</component>

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 611 KiB

Some files were not shown because too many files have changed in this diff Show More