Compare commits
439 Commits
breezy-gno
...
main
| Author | SHA1 | Date |
|---|---|---|
|
|
013690580c | |
|
|
595b614bb3 | |
|
|
f089404b14 | |
|
|
c914fe7d23 | |
|
|
0df496770c | |
|
|
01edb1ea58 | |
|
|
cf8f4422df | |
|
|
3ba62cfaf4 | |
|
|
3e9e6fed1e | |
|
|
18f44a7b25 | |
|
|
2f165981a9 | |
|
|
557f450782 | |
|
|
232c47781e | |
|
|
e228d8d47a | |
|
|
b3bd2ccddc | |
|
|
3e654f98c9 | |
|
|
71dd3d1026 | |
|
|
ec41f26a59 | |
|
|
0d53d10a43 | |
|
|
7d73625920 | |
|
|
afb2dd4f4a | |
|
|
cc33623aa7 | |
|
|
2f7aee30af | |
|
|
928a554493 | |
|
|
55ae81f7ff | |
|
|
4b381a1552 | |
|
|
8c30e876c1 | |
|
|
73b4d72140 | |
|
|
ce7a5c378d | |
|
|
749b7b22e1 | |
|
|
845d1c9a99 | |
|
|
743ce40f3c | |
|
|
e52b7f5bb0 | |
|
|
e5fded03ef | |
|
|
9bb523d211 | |
|
|
3801afaf72 | |
|
|
7e9ddd32ba | |
|
|
effc2435b8 | |
|
|
00df9e5953 | |
|
|
4633b62067 | |
|
|
478fd4d817 | |
|
|
6efc27c749 | |
|
|
933c8244b9 | |
|
|
95c847184f | |
|
|
ed5c8eeda0 | |
|
|
eb0ad035fc | |
|
|
beea5582d8 | |
|
|
7626b4b72e | |
|
|
d72d43a48f | |
|
|
4fd3b080c6 | |
|
|
b2791616b5 | |
|
|
564e51d5d8 | |
|
|
eb5d239271 | |
|
|
dde9431fd4 | |
|
|
3c13552198 | |
|
|
35da226988 | |
|
|
bd973a404f | |
|
|
3fc4dcefd9 | |
|
|
e96ccc4f0b | |
|
|
d1e36d02e1 | |
|
|
f4fecdc3e5 | |
|
|
a0388d074c | |
|
|
be2469ebb0 | |
|
|
8eeb2830cf | |
|
|
e463d01be7 | |
|
|
7cb50caade | |
|
|
044ee4784a | |
|
|
0bce9c9bd3 | |
|
|
50c13863e0 | |
|
|
054296da56 | |
|
|
d9445942c9 | |
|
|
bae0897b93 | |
|
|
394934bd22 | |
|
|
2bed5a2436 | |
|
|
13d5d6bf8e | |
|
|
e1e04b24d5 | |
|
|
6575e9e8a8 | |
|
|
7349858d45 | |
|
|
e3af8057c7 | |
|
|
cd3e3eaaa7 | |
|
|
091ffff822 | |
|
|
1a1cbc94c5 | |
|
|
90eb3aeb68 | |
|
|
fc6858d535 | |
|
|
4a756d63a5 | |
|
|
7cab3393e2 | |
|
|
fab7e2756c | |
|
|
40a8613aa1 | |
|
|
2bcc2e07e3 | |
|
|
19bacf2b92 | |
|
|
5ec52baa3f | |
|
|
645a38176e | |
|
|
c2dfefd395 | |
|
|
e395a0e2fc | |
|
|
2db93b6b15 | |
|
|
3388d5fc41 | |
|
|
6711cc1913 | |
|
|
994dd4e648 | |
|
|
6ec42f6fec | |
|
|
db2d865432 | |
|
|
ea01dd79bd | |
|
|
5623fe1126 | |
|
|
c270ff653e | |
|
|
703961a338 | |
|
|
db1faf706b | |
|
|
d6cdefc272 | |
|
|
85f9e9a9d6 | |
|
|
aa3d7d24c1 | |
|
|
e4d8e63a56 | |
|
|
46b0ef747f | |
|
|
40475736c1 | |
|
|
f27fd17b59 | |
|
|
e889857cd8 | |
|
|
a54782c4e3 | |
|
|
7b70aac358 | |
|
|
6be66ed8f9 | |
|
|
4e4281cf6f | |
|
|
f2b0913a4e | |
|
|
f7daccb2f8 | |
|
|
c2d36383b5 | |
|
|
35e2b2d71d | |
|
|
2d4c6a96e3 | |
|
|
343205f598 | |
|
|
713b9c7fc1 | |
|
|
8967c00666 | |
|
|
229ee9749a | |
|
|
f01c635138 | |
|
|
4682153ed3 | |
|
|
205c80445a | |
|
|
638105667e | |
|
|
ebcd10d548 | |
|
|
07e4542795 | |
|
|
4079d46de4 | |
|
|
2a0baaf1e2 | |
|
|
259d2f97f6 | |
|
|
7dbb235756 | |
|
|
2b85ba5e3a | |
|
|
78a6487a5c | |
|
|
d3af88ec35 | |
|
|
bc959c2f4c | |
|
|
6c5f08611e | |
|
|
7a810bb1bc | |
|
|
0a0ac74bc8 | |
|
|
dbb2196819 | |
|
|
b266a20949 | |
|
|
449fda2e9e | |
|
|
ecd75cb799 | |
|
|
6465007e37 | |
|
|
dde072f042 | |
|
|
aebbf2aaea | |
|
|
d9ae97a3b2 | |
|
|
1995d9a71e | |
|
|
6fb672288c | |
|
|
dbd1b88e18 | |
|
|
53afe9e71d | |
|
|
62eb3aa1d0 | |
|
|
39ba5f1358 | |
|
|
87122b0160 | |
|
|
262a6fa0e5 | |
|
|
bc2edc8d1c | |
|
|
0415a14ec8 | |
|
|
0b22925c2f | |
|
|
2a1c2d1be0 | |
|
|
4b9b78da51 | |
|
|
bb633fabd4 | |
|
|
1f9c8c2ee7 | |
|
|
89695eb205 | |
|
|
4732a0f49a | |
|
|
cc910349dd | |
|
|
94cd703db3 | |
|
|
537dca8357 | |
|
|
8cc5949851 | |
|
|
6fe70c6613 | |
|
|
516317c798 | |
|
|
fb38c89e41 | |
|
|
618dceaf10 | |
|
|
6cba049dc4 | |
|
|
ada60201f1 | |
|
|
b3f788f114 | |
|
|
a2eb0023dc | |
|
|
e63ba54c9b | |
|
|
e6e7602a29 | |
|
|
c342a35fb8 | |
|
|
3973994790 | |
|
|
ebcc3e72c2 | |
|
|
0c6b599264 | |
|
|
686cda141a | |
|
|
a8a2c35b25 | |
|
|
82f88b3121 | |
|
|
f7b91a13dd | |
|
|
ef98e91608 | |
|
|
caebcb8b22 | |
|
|
e4ee9cf0ba | |
|
|
f35313caf2 | |
|
|
d8ea8dcb1e | |
|
|
efcc5bea81 | |
|
|
b88e649964 | |
|
|
11ab3aad5c | |
|
|
30c1c87a3c | |
|
|
729139b78a | |
|
|
12664762b5 | |
|
|
cbe9b77107 | |
|
|
1bdaaf9145 | |
|
|
6f80299eb0 | |
|
|
427dbef704 | |
|
|
b5e07fd075 | |
|
|
8505ed91d2 | |
|
|
b599b2a6cc | |
|
|
1b45e00a9d | |
|
|
b96427914e | |
|
|
cd0f0eec75 | |
|
|
1b671c906e | |
|
|
7630a8b5c3 | |
|
|
076c94a8d0 | |
|
|
0b9ed6d4ee | |
|
|
ff3c03f142 | |
|
|
a3807f247a | |
|
|
352b78b923 | |
|
|
1be2e8a904 | |
|
|
b506de2037 | |
|
|
5ffe596f3e | |
|
|
8a2926890d | |
|
|
07bf239433 | |
|
|
53124e64dd | |
|
|
6ace405a64 | |
|
|
94bd5142d6 | |
|
|
c078ba57f4 | |
|
|
1a3c37f4aa | |
|
|
b73fbfb1c3 | |
|
|
4f6e5b296a | |
|
|
4fe690ffaf | |
|
|
5689af17d0 | |
|
|
4d8aadb213 | |
|
|
3e29947411 | |
|
|
6d5890da7f | |
|
|
ad8e30aa6b | |
|
|
183ace1db8 | |
|
|
1a2dc23573 | |
|
|
a302f7d29b | |
|
|
573cfe1916 | |
|
|
f7e09a53ca | |
|
|
699a925f19 | |
|
|
c2c5136ddc | |
|
|
779127b3e6 | |
|
|
5f52ea7caa | |
|
|
5c8c092d3c | |
|
|
584133017c | |
|
|
829c9da3c7 | |
|
|
36e723a45c | |
|
|
bc13c4ede7 | |
|
|
3256d58b07 | |
|
|
117fffbae1 | |
|
|
a2a6e083ba | |
|
|
230c9250d0 | |
|
|
b0e2b5cca3 | |
|
|
1c4fc94999 | |
|
|
94c24fdb49 | |
|
|
5e47386d23 | |
|
|
5a5c9ab2d6 | |
|
|
d4d3bd9ca0 | |
|
|
8fedb80f0a | |
|
|
05e4e36ddb | |
|
|
1e7957ef8a | |
|
|
723c6d2359 | |
|
|
d9855310e1 | |
|
|
1718986793 | |
|
|
be48cea8ec | |
|
|
3ac8d6c8fe | |
|
|
55ca39ea04 | |
|
|
19404c015c | |
|
|
874313d8b1 | |
|
|
5420d7fa5f | |
|
|
ae76037baf | |
|
|
0e02c59340 | |
|
|
529e40a91e | |
|
|
f69d935774 | |
|
|
b1d3815bec | |
|
|
ecbd855c1c | |
|
|
3a49e9b230 | |
|
|
b4727806aa | |
|
|
e24fc43bd0 | |
|
|
230f93466a | |
|
|
31693bdece | |
|
|
e4265c75d1 | |
|
|
1bd81c6228 | |
|
|
b60fb9edf4 | |
|
|
81ff0195be | |
|
|
0d81f664c2 | |
|
|
b7daefed82 | |
|
|
04e8bf2a6e | |
|
|
740c301092 | |
|
|
f5e77edf40 | |
|
|
79d818e36b | |
|
|
9e084ad7a4 | |
|
|
88ff0af4a9 | |
|
|
0af7dde118 | |
|
|
bd91e49a70 | |
|
|
57ced2168a | |
|
|
10a951fb50 | |
|
|
3c9e96a02f | |
|
|
36e849ca31 | |
|
|
df26de47d5 | |
|
|
bd0012db33 | |
|
|
8a0ee28dfb | |
|
|
0bc93c6e9e | |
|
|
1825e0dadb | |
|
|
9c7490a247 | |
|
|
65e1a688fe | |
|
|
091ced6af2 | |
|
|
c87c26937c | |
|
|
64de05ef93 | |
|
|
ddf26b699a | |
|
|
9a221b5bcb | |
|
|
ea7930ceaa | |
|
|
1e05f1fc7e | |
|
|
d5ab403e0b | |
|
|
1ef732c8a6 | |
|
|
e6ec19da4c | |
|
|
e331da34bf | |
|
|
9d7227ca9e | |
|
|
e4a10c55eb | |
|
|
b0e0b224cc | |
|
|
f924fdde3b | |
|
|
58cd31f129 | |
|
|
4879d31803 | |
|
|
a37152eb2b | |
|
|
8de4d394e8 | |
|
|
beb28e1ec0 | |
|
|
86d293d48e | |
|
|
e3532d71ea | |
|
|
de17367bd2 | |
|
|
a5887ce078 | |
|
|
40090d87bf | |
|
|
b2e46f7308 | |
|
|
f820d7a0a2 | |
|
|
9d334a75cc | |
|
|
52925f2288 | |
|
|
59fe828df9 | |
|
|
fbf76d4c53 | |
|
|
4b25f83a48 | |
|
|
47a1278f16 | |
|
|
d98aab8cd1 | |
|
|
8a77a1bf0d | |
|
|
c0d258594e | |
|
|
8ef0b04db4 | |
|
|
8ea7b49602 | |
|
|
333e06b929 | |
|
|
51d5eb5215 | |
|
|
f068ef9627 | |
|
|
a5e3498223 | |
|
|
3a7d5feb88 | |
|
|
416c92f220 | |
|
|
bf8598675b | |
|
|
da00d032e2 | |
|
|
fe1e2bcd56 | |
|
|
f72947c7f1 | |
|
|
8d97466ad1 | |
|
|
bf8fc51576 | |
|
|
21e1273bf4 | |
|
|
99091f77da | |
|
|
1b14468d86 | |
|
|
0238cd7790 | |
|
|
6ea84e275f | |
|
|
e9e5d3864a | |
|
|
cb3777e72a | |
|
|
d97069e18f | |
|
|
41240d93af | |
|
|
05c0a421ed | |
|
|
cbf9424d6f | |
|
|
f8886970f5 | |
|
|
d1c5e9fc4d | |
|
|
56a7d41ec6 | |
|
|
0b953c9cb9 | |
|
|
4d67fb5981 | |
|
|
6552f62244 | |
|
|
4c3f70eb17 | |
|
|
150f183aad | |
|
|
1b5ec1d822 | |
|
|
702692f386 | |
|
|
f28ba2639f | |
|
|
22ef564500 | |
|
|
cad0be9698 | |
|
|
fac8a15c97 | |
|
|
f75a5f3651 | |
|
|
71585d0328 | |
|
|
9365f18668 | |
|
|
aae2ef1b9a | |
|
|
fed16be20c | |
|
|
54a9422c66 | |
|
|
44b1ebe464 | |
|
|
182096bdf6 | |
|
|
3b512d0d8a | |
|
|
eb81b7af4a | |
|
|
04edf2eecc | |
|
|
7369cb0551 | |
|
|
c6c05d8715 | |
|
|
8f4a17c41e | |
|
|
9fb52bf4ec | |
|
|
2ad27d4d50 | |
|
|
baa7dd3bd0 | |
|
|
4ab2b59657 | |
|
|
7843d4d385 | |
|
|
e69d3cb97d | |
|
|
b70cf91b55 | |
|
|
cf66807f85 | |
|
|
c713c69e66 | |
|
|
ae48a62d7b | |
|
|
0ac3a73033 | |
|
|
0f9c2eb407 | |
|
|
c1ec13c2ef | |
|
|
0dd0b8384a | |
|
|
a2d2a01ec5 | |
|
|
ad6aa96000 | |
|
|
2aac5a6504 | |
|
|
f5256dfee1 | |
|
|
c25219353a | |
|
|
0d3f9ff757 | |
|
|
aef60af4a6 | |
|
|
40792a8c2b | |
|
|
7b80f999fa | |
|
|
396b031d28 | |
|
|
7b5f257b0b | |
|
|
5f2f57cb83 | |
|
|
9619acdc88 | |
|
|
a7dd9885e1 | |
|
|
b8e2310461 | |
|
|
3498910758 | |
|
|
5936230a57 | |
|
|
c689978e85 | |
|
|
e9b10838ba | |
|
|
02b9bbfb83 | |
|
|
c5c0bb4f33 | |
|
|
5a2b2a6486 | |
|
|
ae1d835f05 | |
|
|
b7f72d17cf | |
|
|
840351e14f | |
|
|
e94643de61 | |
|
|
f0fbde510c | |
|
|
37b66aa3e4 |
|
|
@ -0,0 +1,311 @@
|
|||
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
|
||||
|
|
@ -2,5 +2,11 @@ build/
|
|||
__pycache__
|
||||
*.zip
|
||||
gschemas.compiled
|
||||
.flatpak-builder/
|
||||
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
|
||||
|
|
|
|||
|
|
@ -2,9 +2,12 @@
|
|||
path = vulkan/modules/vkBasalt
|
||||
url = https://github.com/wheaney/vkBasalt.git
|
||||
branch = runtime_uniforms
|
||||
[submodule "vulkan/modules/sombrero"]
|
||||
path = vulkan/modules/sombrero
|
||||
url = https://github.com/wheaney/sombrero.git
|
||||
[submodule "modules/xrealAirLinuxDriver"]
|
||||
path = modules/xrealAirLinuxDriver
|
||||
[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
|
||||
|
|
|
|||
202
README.md
202
README.md
|
|
@ -4,11 +4,151 @@
|
|||
|
||||
[](https://discord.gg/azSBTXNXMt)
|
||||
|
||||

|
||||
|
||||
## What is this?
|
||||
|
||||
This repo will eventually contain a collection of tools to enable virtual desktop environments for gaming and productivity on Linux using supported XR glasses. This currently includes XREAL Air 1, 2, 2 Pro and VITURE One models.
|
||||
> [!TIP]
|
||||
> Interested in an XR desktop for **Windows**, **MacOS**, or **Android**? Star the work-in-progress [Breezy Box](https://github.com/wheaney/breezy-box) project ([watch the demo](https://youtu.be/AwEQXnabRxE)).
|
||||
|
||||
As of now, only a Vulkan implementation is available, primarily for gaming but could theoretically be used for anything that uses Vulkan rendering.
|
||||
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).
|
||||
|
||||
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 45 through 50). 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 50.
|
||||
|
||||
**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.
|
||||
|
||||
### 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.
|
||||
|
||||
## Breezy Vulkan
|
||||
|
||||
|
|
@ -16,49 +156,66 @@ As of now, only a Vulkan implementation is available, primarily for gaming but c
|
|||
|
||||
#### 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 "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.
|
||||
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.
|
||||
|
||||
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 (`~/bin/xreal_driver_config -e`) and then you can go into whichever output mode you'd like using (`~/bin/xreal_driver_config -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 (`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).
|
||||
|
||||
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 `~/bin/xreal_driver_config` 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.
|
||||
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.
|
||||
|
||||
#### 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).
|
||||
|
||||
### Troubleshooting
|
||||
### Supporter Tier
|
||||
|
||||
#### 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.
|
||||
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:
|
||||
|
||||
#### 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.
|
||||
| Payment period | Price | Upgrade window \* |
|
||||
| -------------- | ------------------ | ------------------------------------- |
|
||||
| Yearly | $10 USD, recurring | Within 90 days to upgrade to lifetime |
|
||||
| Lifetime | $25 USD, one-time | — |
|
||||
|
||||
#### Display size
|
||||
\* If you pay for a plan and decide to upgrade to a longer-term plan, you may pay the difference within this window.
|
||||
|
||||
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).
|
||||
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 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).
|
||||
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
|
||||
```
|
||||
|
||||
### Disabling
|
||||
|
||||
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).
|
||||
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).
|
||||
|
||||
### Updating
|
||||
|
||||
|
|
@ -66,7 +223,12 @@ Rerun the `breezy_vulkan_setup` script. No need to re-download this script, as i
|
|||
|
||||
### Uninstalling
|
||||
|
||||
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.
|
||||
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
|
||||
|
||||
|
|
@ -86,4 +248,4 @@ Hashing functions are a one-way process that serve to anonymize your personal da
|
|||
|
||||
For inquires about data privacy or any related concerns, please contact:
|
||||
|
||||
Wayne Heaney - **xr.on.linux@gmail.com**
|
||||
Wayne Heaney - **wayne@xronlinux.com**
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 938 KiB |
|
|
@ -6,12 +6,38 @@
|
|||
# exit when any command fails
|
||||
set -e
|
||||
|
||||
# Make sure only root can run our script
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo "This script must be run as root" 1>&2
|
||||
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
|
||||
|
|
@ -19,33 +45,69 @@ tmp_dir=$(mktemp -d -t breezy-gnome-XXXXXXXXXX)
|
|||
pushd $tmp_dir > /dev/null
|
||||
echo "Created temp directory: ${tmp_dir}"
|
||||
|
||||
# if the first argument is "-v" then the second argument is metrics version, and the third argument is binary path
|
||||
# otherwise, if the first argument is present, it's the binary path
|
||||
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"
|
||||
binary_path_arg="$3"
|
||||
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
|
||||
binary_path_arg="$1"
|
||||
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 latest driver
|
||||
echo "Downloading latest release to: ${tmp_dir}/breezyGNOME.tar.gz"
|
||||
curl -L -O https://github.com/wheaney/breezy-desktop/releases/latest/download/breezyGNOME.tar.gz
|
||||
# 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
|
||||
if [[ "$binary_path_arg" = /* ]]; then
|
||||
abs_path="$binary_path_arg"
|
||||
else
|
||||
# Convert relative path to absolute path
|
||||
abs_path=$(realpath "$start_dir/$binary_path_arg")
|
||||
fi
|
||||
cp $abs_path $tmp_dir
|
||||
cp "$binary_path_arg" "$tmp_dir"
|
||||
fi
|
||||
|
||||
echo "Extracting to: ${tmp_dir}/breezy_gnome"
|
||||
tar -xf breezyGNOME.tar.gz
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,211 @@
|
|||
#!/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
|
||||
|
|
@ -14,38 +14,79 @@ 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}"
|
||||
|
||||
# if the first argument is "-v" then the second argument is metrics version, and the third argument is binary path
|
||||
# otherwise, if the first argument is present, it's the binary path
|
||||
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" ]
|
||||
then
|
||||
metrics_version="$2"
|
||||
binary_path_arg="$3"
|
||||
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"
|
||||
else
|
||||
binary_path_arg="$1"
|
||||
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 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 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
|
||||
# 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
|
||||
if [[ "$binary_path_arg" = /* ]]; then
|
||||
abs_path="$binary_path_arg"
|
||||
else
|
||||
# Convert relative path to absolute path
|
||||
abs_path=$(realpath "$start_dir/$binary_path_arg")
|
||||
fi
|
||||
cp $abs_path $tmp_dir
|
||||
cp "$binary_path_arg" "$tmp_dir"
|
||||
fi
|
||||
|
||||
echo "Extracting to: ${tmp_dir}/breezy_vulkan"
|
||||
tar -xf breezyVulkan.tar.gz
|
||||
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/
|
||||
|
||||
pushd breezy_vulkan > /dev/null
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
#!/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 "$@"
|
||||
|
|
@ -1,33 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# needs:flatpak-builder, elfutils
|
||||
# flatpak-builder --force-clean /tmp/flatpak-builddir ui/com.xronlinux.BreezyDesktop.json
|
||||
# flatpak build-export /tmp/flatpak-export /tmp/flatpak-builddir
|
||||
# flatpak build-bundle /tmp/flatpak-export com.xronlinux.BreezyDesktop.flatpak com.xronlinux.BreezyDesktop --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
# 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
|
||||
GNOME_DIR=$ROOT_DIR/gnome
|
||||
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
|
||||
|
||||
rm -rf $GNOME_BUILD_DIR
|
||||
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
|
||||
|
||||
XREAL_DRIVER_DIR=$ROOT_DIR/modules/xrealAirLinuxDriver
|
||||
source $XREAL_DRIVER_DIR/bin/inject_ua
|
||||
|
||||
# check out submodules, recursively for nested ones
|
||||
git submodule update --init --recursive
|
||||
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
|
||||
|
|
@ -36,45 +53,69 @@ fi
|
|||
|
||||
# copy vulkan setup scripts and configs
|
||||
mkdir -p $PACKAGE_DIR/bin
|
||||
copy_and_inject_ua "$XREAL_DRIVER_DIR/bin/ua.sh" "$PACKAGE_DIR/bin" "$GNOME_DIR/bin/setup" "$GNOME_DIR/bin/breezy_gnome_verify" "$GNOME_DIR/bin/breezy_gnome_uninstall"
|
||||
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"
|
||||
|
||||
XREAL_BINARY=$XREAL_DRIVER_DIR/build/xrealAirLinuxDriver.tar.gz
|
||||
pushd $XREAL_DRIVER_DIR
|
||||
XR_DRIVER_BINARY_NAME=xrDriver-$ARCH.tar.gz
|
||||
XR_DRIVER_BINARY="$XR_DRIVER_DIR/out/$XR_DRIVER_BINARY_NAME"
|
||||
|
||||
if [ ! -e "$XREAL_BINARY" ] || [ "$1" != "--skip-module-builds" ]; then
|
||||
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 $XREAL_DRIVER_DIR
|
||||
cp $VULKAN_DIR/custom_banner_config.yml $XR_DRIVER_DIR
|
||||
fi
|
||||
|
||||
bin/package
|
||||
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
|
||||
|
||||
XREAL_MANIFEST_LINE=$(sha256sum build/driver_air_glasses/manifest)
|
||||
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 $XREAL_BINARY $PACKAGE_DIR
|
||||
cp $XREAL_DRIVER_DIR/bin/xreal_driver_setup $PACKAGE_DIR/bin
|
||||
cp $XR_DRIVER_BINARY $PACKAGE_DIR/$XR_DRIVER_BINARY_NAME
|
||||
cp $XR_DRIVER_DIR/bin/xr_driver_setup $PACKAGE_DIR/bin
|
||||
|
||||
gnome/bin/package_extension
|
||||
cp gnome/out/* $PACKAGE_DIR
|
||||
$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/src
|
||||
GNOME_MANIFEST_LINE=$(find -L . -type f -exec sha256sum {} \; | sort | sha256sum | sed 's/ .*//')
|
||||
pushd $GNOME_DIR/src
|
||||
GNOME_MANIFEST_LINE=$(find -L . -type f ! -name "*.compiled" -exec sha256sum {} \; | sort | sha256sum | sed 's/ .*//')
|
||||
popd
|
||||
|
||||
ui/bin/package
|
||||
cp ui/out/* $PACKAGE_DIR
|
||||
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 $XREAL_MANIFEST_LINE > manifest
|
||||
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 breezyGNOME.tar.gz breezy_gnome
|
||||
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
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
#!/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
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
#!/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
|
||||
|
|
@ -3,46 +3,32 @@
|
|||
# exit when any command fails
|
||||
set -e
|
||||
|
||||
XREAL_DRIVER_DIR=modules/xrealAirLinuxDriver
|
||||
source $XREAL_DRIVER_DIR/bin/inject_ua
|
||||
ARCH=${ARCH:-$(uname -m)}
|
||||
echo "Building Breezy Vulkan for $ARCH"
|
||||
|
||||
# check out submodules, recursively for nested ones
|
||||
git submodule update --init --recursive
|
||||
XR_DRIVER_DIR=modules/XRLinuxDriver
|
||||
source $XR_DRIVER_DIR/bin/inject_ua
|
||||
|
||||
VULKAN_DIR=vulkan
|
||||
VULKAN_BUILD=$VULKAN_DIR/build
|
||||
if [ ! -d "$VULKAN_BUILD" ]; then
|
||||
mkdir -p $VULKAN_BUILD
|
||||
VULKAN_BUILD_DIR=$VULKAN_DIR/build
|
||||
if [ ! -d "$VULKAN_BUILD_DIR" ]; then
|
||||
mkdir -p $VULKAN_BUILD_DIR
|
||||
else
|
||||
rm -rf $VULKAN_BUILD/*
|
||||
rm -rf $VULKAN_BUILD_DIR/*
|
||||
fi
|
||||
|
||||
VULKAN_MODULES=$VULKAN_DIR/modules
|
||||
PACKAGE_DIR=$VULKAN_BUILD/breezy_vulkan
|
||||
PACKAGE_DIR=$VULKAN_BUILD_DIR/breezy_vulkan
|
||||
if [ ! -d "$PACKAGE_DIR" ]; then
|
||||
mkdir -p $PACKAGE_DIR
|
||||
else
|
||||
rm -rf $PACKAGE_DIR/*
|
||||
fi
|
||||
BUILD_FILE_NAME=breezyVulkan-$ARCH.tar.gz
|
||||
|
||||
# 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
|
||||
|
||||
# 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/
|
||||
|
||||
# copy Sombrero FX, get ReShade headers
|
||||
cp $VULKAN_MODULES/sombrero/*.fx $PACKAGE_DIR
|
||||
cp $VULKAN_MODULES/sombrero/*.png $PACKAGE_DIR
|
||||
# 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
|
||||
|
||||
|
|
@ -53,35 +39,56 @@ fi
|
|||
|
||||
# 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/verify_installation" "$VULKAN_DIR/bin/breezy_vulkan_uninstall"
|
||||
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 xreal driver
|
||||
XREAL_BINARY=$XREAL_DRIVER_DIR/build/xrealAirLinuxDriver.tar.gz
|
||||
pushd $XREAL_DRIVER_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 "$XREAL_BINARY" ] || [ "$1" != "--skip-module-builds" ]; then
|
||||
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 $XREAL_DRIVER_DIR
|
||||
cp $VULKAN_DIR/custom_banner_config.yml $XR_DRIVER_DIR
|
||||
fi
|
||||
|
||||
bin/package
|
||||
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
|
||||
|
||||
XREAL_MANIFEST_LINE=$(sha256sum build/driver_air_glasses/manifest)
|
||||
popd
|
||||
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 xreal binary and setup script
|
||||
cp $XREAL_BINARY $PACKAGE_DIR
|
||||
cp $XREAL_DRIVER_DIR/bin/xreal_driver_setup $PACKAGE_DIR/bin
|
||||
XR_DRIVER_MANIFEST_LINE=$(sha256sum xr_driver/manifest)
|
||||
popd
|
||||
rm -rf $TMP_DIR
|
||||
|
||||
# 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
|
||||
|
||||
# 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 $XREAL_MANIFEST_LINE > manifest
|
||||
sha256sum bin/breezy_vulkan_uninstall vkBasalt.64/libvkbasalt.so vkBasalt.32/libvkbasalt.so *.fx* *.png >> manifest
|
||||
echo $XR_DRIVER_MANIFEST_LINE > manifest
|
||||
sha256sum bin/breezy_vulkan_uninstall bin/breezy_vulkan_logs *.frag *.fx* *.png >> manifest
|
||||
popd
|
||||
|
||||
# bundle everything up
|
||||
tar -zcvf $VULKAN_BUILD/breezyVulkan.tar.gz --directory $VULKAN_BUILD breezy_vulkan
|
||||
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
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
#!/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"
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
#!/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
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#!/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"
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
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
|
||||
|
|
@ -4,13 +4,6 @@ UUID="breezydesktop@xronlinux.com"
|
|||
|
||||
# fail on error
|
||||
set -e
|
||||
# log executed commands
|
||||
set -x
|
||||
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
echo "This script must NOT be run as root" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# https://stackoverflow.com/a/246128
|
||||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||
|
|
@ -46,6 +39,8 @@ copy_static_files() {
|
|||
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/
|
||||
}
|
||||
|
||||
|
|
@ -75,3 +70,5 @@ elif [ "$1" == "pack" ]; then
|
|||
elif [ "$1" == "copy_static" ]; then
|
||||
copy_static_files
|
||||
fi
|
||||
|
||||
rm -rf "$TMP_DIR"
|
||||
167
gnome/bin/setup
167
gnome/bin/setup
|
|
@ -2,20 +2,117 @@
|
|||
|
||||
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=${SUDO_USER:-$USER}
|
||||
USER_HOME=$(getent passwd $USER | cut -d: -f6)
|
||||
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 [ -z "$XDG_DATA_HOME" ]; then
|
||||
XDG_DATA_HOME="$USER_HOME/.local/share"
|
||||
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
|
||||
DATA_DIR="$XDG_DATA_HOME/breezy_gnome"
|
||||
|
||||
UA_EVENT_NAME="breezy_gnome_install"
|
||||
if [ -e "$XDG_BIN_HOME/breezy_gnome_uninstall" ]; then
|
||||
|
|
@ -31,39 +128,57 @@ 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
|
||||
chown -R $USER:$USER $XDG_BIN_HOME
|
||||
chmod -R 755 $XDG_BIN_HOME
|
||||
|
||||
echo "Copying the manifest file to ${DATA_DIR}"
|
||||
mkdir -p $DATA_DIR
|
||||
cp manifest $DATA_DIR
|
||||
chown -R $USER:$USER $DATA_DIR
|
||||
chmod -R 755 $DATA_DIR
|
||||
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 --quiet breezydesktop@xronlinux.com.shell-extension.zip > /dev/null 2>&1
|
||||
gnome-extensions install --force breezydesktop@xronlinux.com.shell-extension.zip
|
||||
|
||||
echo "Installing the Breezy Desktop UI Flatpak"
|
||||
flatpak install --noninteractive --reinstall com.xronlinux.BreezyDesktop.flatpak > /dev/null 2>&1
|
||||
echo "Installing the Breezy Desktop UI application"
|
||||
cp -r breezy_ui/data/* $XDG_DATA_HOME
|
||||
cp -r breezy_ui/bin/* $XDG_BIN_HOME
|
||||
|
||||
# set up the XREAL driver using the local binary
|
||||
echo "Installing xrealAirLinuxDriver"
|
||||
echo "BEGIN - xreal_driver_setup"
|
||||
# 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
|
||||
bin/xreal_driver_setup $(pwd)/xrealAirLinuxDriver.tar.gz
|
||||
sudo --preserve-env=SKIP_SYSTEMD bin/xr_driver_setup $(pwd)
|
||||
else
|
||||
bin/xreal_driver_setup -v $1 $(pwd)/xrealAirLinuxDriver.tar.gz
|
||||
sudo --preserve-env=SKIP_SYSTEMD bin/xr_driver_setup -v $1 $(pwd)
|
||||
fi
|
||||
|
||||
echo "END - xreal_driver_setup"
|
||||
echo "END - xr_driver_setup"
|
||||
|
||||
echo "Enabling the driver and setting it to Breezy Desktop mode"
|
||||
$USER_HOME/bin/xreal_driver_config -e
|
||||
$USER_HOME/bin/xreal_driver_config -vd
|
||||
|
||||
sed -i 's/virtual_display/breezy_desktop/g' $USER_HOME/.xreal_driver_config
|
||||
echo "Setting up productivity features"
|
||||
printf "request_features=productivity,productivity_pro\n" >> /dev/shm/xr_driver_control 2>/dev/null || true
|
||||
|
|
@ -1,176 +0,0 @@
|
|||
#version 330 core
|
||||
|
||||
uniform bool enabled;
|
||||
uniform bool show_banner;
|
||||
uniform sampler2D uDesktopTexture;
|
||||
uniform mat4 imu_quat_data;
|
||||
uniform vec4 look_ahead_cfg;
|
||||
uniform float look_ahead_ms;
|
||||
uniform float display_zoom;
|
||||
uniform float display_north_offset;
|
||||
uniform float lens_distance_ratio;
|
||||
uniform bool sbs_enabled;
|
||||
uniform bool sbs_content;
|
||||
uniform bool custom_banner_enabled;
|
||||
uniform float stage_aspect_ratio;
|
||||
uniform float display_aspect_ratio;
|
||||
uniform float trim_width_percent;
|
||||
uniform float trim_height_percent;
|
||||
uniform float half_fov_z_rads;
|
||||
uniform float half_fov_y_rads;
|
||||
uniform float screen_distance;
|
||||
|
||||
float look_ahead_ms_cap = 45.0;
|
||||
|
||||
vec4 quatMul(vec4 q1, vec4 q2) {
|
||||
vec3 u = vec3(q1.x, q1.y, q1.z);
|
||||
float s = q1.w;
|
||||
vec3 v = vec3(q2.x, q2.y, q2.z);
|
||||
float t = q2.w;
|
||||
return vec4(s * v + t * u + cross(u, v), s * t - dot(u, v));
|
||||
}
|
||||
|
||||
vec4 quatConj(vec4 q) {
|
||||
return vec4(-q.x, -q.y, -q.z, q.w);
|
||||
}
|
||||
|
||||
vec3 applyQuaternionToVector(vec4 q, vec3 v) {
|
||||
vec4 p = quatMul(quatMul(q, vec4(v, 0)), quatConj(q));
|
||||
return p.xyz;
|
||||
}
|
||||
|
||||
const int day_in_seconds = 24 * 60 * 60;
|
||||
|
||||
vec3 applyLookAhead(
|
||||
in vec3 position,
|
||||
in vec3 velocity,
|
||||
in vec3 accel,
|
||||
in float t,
|
||||
in float t_squared
|
||||
) {
|
||||
return position + velocity * t + 0.5 * accel * t_squared;
|
||||
}
|
||||
|
||||
vec3 rateOfChange(
|
||||
in vec3 v1,
|
||||
in vec3 v2,
|
||||
in float delta_time
|
||||
) {
|
||||
return (v1 - v2) / delta_time;
|
||||
}
|
||||
|
||||
void PS_IMU_Transform(vec4 pos, vec2 texcoord, out vec4 color) {
|
||||
float texcoord_x_min = 0.0;
|
||||
float texcoord_x_max = 1.0;
|
||||
float lens_y_offset = 0.0;
|
||||
float lens_z_offset = 0.0;
|
||||
float aspect_ratio = stage_aspect_ratio;
|
||||
|
||||
// if(enabled && sbs_enabled) {
|
||||
// bool right_display = texcoord.x > 0.5;
|
||||
// aspect_ratio /= 2;
|
||||
|
||||
// lens_y_offset = lens_distance_ratio / 3;
|
||||
// if(right_display)
|
||||
// lens_y_offset = -lens_y_offset;
|
||||
// if(sbs_content) {
|
||||
// // source video is SBS, left-half of the screen goes to the left lens, right-half to the right lens
|
||||
// if(right_display)
|
||||
// texcoord_x_min = 0.5;
|
||||
// else
|
||||
// texcoord_x_max = 0.5;
|
||||
// }
|
||||
// if(!sbs_mode_stretched) {
|
||||
// // if the content isn't stretched, assume it's centered in the middle 50% of the screen
|
||||
// texcoord_x_min = max(0.25, texcoord_x_min);
|
||||
// texcoord_x_max = min(0.75, texcoord_x_max);
|
||||
// }
|
||||
|
||||
// // translate the texcoord respresenting the current lens's half of the screen to a full-screen texcoord
|
||||
// texcoord.x = (texcoord.x - (right_display ? 0.5 : 0.0)) * 2;
|
||||
// }
|
||||
|
||||
if(!enabled || show_banner) {
|
||||
// vec2 banner_size = vec2(800.0 / ReShade::ScreenSize.x, 200.0 / ReShade::ScreenSize.y); // Assuming ScreenWidth and ScreenHeight are defined
|
||||
|
||||
// if (show_banner &&
|
||||
// texcoord.x >= banner_position.x - banner_size.x / 2 &&
|
||||
// texcoord.x <= banner_position.x + banner_size.x / 2 &&
|
||||
// texcoord.y >= banner_position.y - banner_size.y / 2 &&
|
||||
// texcoord.y <= banner_position.y + banner_size.y / 2)
|
||||
// {
|
||||
// vec2 banner_texcoord = (texcoord - (banner_position - banner_size / 2)) / banner_size;
|
||||
// if (custom_banner_enabled) {
|
||||
// color = tex2D(customBannerSampler, banner_texcoord);
|
||||
// } else {
|
||||
// color = tex2D(calibratingSampler, banner_texcoord);
|
||||
// }
|
||||
// } else {
|
||||
// adjust texcoord back to the range that describes where the content is displayed
|
||||
float texcoord_width = texcoord_x_max - texcoord_x_min;
|
||||
texcoord.x = texcoord.x * texcoord_width + texcoord_x_min;
|
||||
|
||||
color = texture2D(uDesktopTexture, texcoord);
|
||||
// }
|
||||
} else {
|
||||
float fov_y_half_width = tan(half_fov_y_rads);
|
||||
float fov_y_width = fov_y_half_width * 2;
|
||||
float fov_z_half_width = tan(half_fov_z_rads);
|
||||
float fov_z_width = fov_z_half_width * 2;
|
||||
|
||||
float vec_y = -texcoord.x * fov_y_width + fov_y_half_width;
|
||||
float vec_z = -texcoord.y * fov_z_width + fov_z_half_width;
|
||||
vec3 lens_vector = vec3(lens_distance_ratio, lens_y_offset, lens_z_offset);
|
||||
vec3 texcoord_vector = vec3(1.0, vec_y, vec_z);
|
||||
|
||||
// then rotate the vector using each of the snapshots provided
|
||||
vec3 rotated_vector_t0 = applyQuaternionToVector(imu_quat_data[0], texcoord_vector);
|
||||
vec3 rotated_vector_t1 = applyQuaternionToVector(imu_quat_data[1], texcoord_vector);
|
||||
vec3 rotated_vector_t2 = applyQuaternionToVector(imu_quat_data[2], texcoord_vector);
|
||||
vec3 rotated_lens_vector = applyQuaternionToVector(imu_quat_data[0], lens_vector);
|
||||
|
||||
// compute the two velocities (units/ms) as change in the 3 rotation snapshots
|
||||
float delta_time_t0 = imu_quat_data[3].x - imu_quat_data[3].y;
|
||||
vec3 velocity_t0 = rateOfChange(rotated_vector_t0, rotated_vector_t1, delta_time_t0);
|
||||
vec3 velocity_t1 = rateOfChange(rotated_vector_t1, rotated_vector_t2, imu_quat_data[3].y - imu_quat_data[3].z);
|
||||
|
||||
// and then the acceleration (units/ms^2) as the change in velocities
|
||||
vec3 accel_t0 = rateOfChange(velocity_t0, velocity_t1, delta_time_t0);
|
||||
|
||||
// allows for the bottom and top of the screen to have different look-ahead values
|
||||
float look_ahead_scanline_adjust = texcoord.y * look_ahead_cfg.z;
|
||||
|
||||
// use the 4th value of the look-ahead config to cap the look-ahead value
|
||||
float look_ahead_ms_capped = min(min(look_ahead_ms, look_ahead_cfg.w), look_ahead_ms_cap) + look_ahead_scanline_adjust;
|
||||
float look_ahead_ms_squared = pow(look_ahead_ms_capped, 2);
|
||||
|
||||
// apply most recent velocity and acceleration to most recent position to get a predicted position
|
||||
vec3 res = applyLookAhead(rotated_vector_t0, velocity_t0, accel_t0, look_ahead_ms, look_ahead_ms_squared) -
|
||||
rotated_lens_vector;
|
||||
|
||||
bool looking_behind = res.x < 0.0;
|
||||
|
||||
// divide all values by x to scale the magnitude so x is exactly 1, and multiply by the final display distance
|
||||
// so the vector is pointing at a coordinate on the screen
|
||||
float display_distance = display_north_offset - rotated_lens_vector.x;
|
||||
res *= display_distance / res.x;
|
||||
res += rotated_lens_vector;
|
||||
|
||||
// deconstruct the rotated and scaled vector back to a texcoord (just inverse operations of the first conversion
|
||||
// above)
|
||||
texcoord.x = (fov_y_half_width - res.y) / fov_y_width;
|
||||
texcoord.y = (fov_z_half_width - res.z) / fov_z_width;
|
||||
|
||||
// apply the screen offsets now
|
||||
float texcoord_width = texcoord_x_max - texcoord_x_min;
|
||||
texcoord.x = texcoord.x * texcoord_width + texcoord_x_min;
|
||||
|
||||
if(looking_behind || texcoord.x < texcoord_x_min || texcoord.y < 0.0 || texcoord.x > texcoord_x_max || texcoord.y > 1.0 || texcoord.x <= 0.001 && texcoord.y <= 0.002) {
|
||||
color = vec4(0, 0, 0, 1);
|
||||
} else {
|
||||
texcoord.x = (1.0 - trim_width_percent * 2) * texcoord.x + trim_width_percent;
|
||||
texcoord.y = (1.0 - trim_height_percent * 2) * texcoord.y + trim_height_percent;
|
||||
color = texture2D(uDesktopTexture, texcoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../modules/sombrero/Sombrero.frag
|
||||
|
|
@ -2,46 +2,44 @@ 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(mainActor) {
|
||||
this._mainActor = mainActor;
|
||||
|
||||
this._changeHookFn = null;
|
||||
constructor(targetMonitors, refreshRate) {
|
||||
this._targetMonitors = targetMonitors;
|
||||
this._refreshRate = refreshRate;
|
||||
|
||||
// Set/destroyed by _enableCloningMouse/_disableCloningMouse
|
||||
this._cursorWantedVisible = null;
|
||||
this._cursorTracker = null;
|
||||
this._cursorTrackerSetPointerVisible = null;
|
||||
this._cursorTrackerSetPointerVisibleBound = null;
|
||||
this._cursorSprite = null;
|
||||
this._cursorActor = null;
|
||||
this._cursorWatcher = null;
|
||||
this._cursorSeat = null;
|
||||
this._mouseSprite = null;
|
||||
this._cursorRoot = null;
|
||||
this._cursorUnfocusInhibited = false;
|
||||
|
||||
// Set/destroyed by _startCloningMouse / _stopCloningMouse
|
||||
this._cursorWatch = null;
|
||||
this._cursorChangedConnection = null;
|
||||
this._cursorVisibilityChangedConnection = null;
|
||||
this._cursorPositionInvalidatedConnection = 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();
|
||||
}
|
||||
|
||||
|
|
@ -53,27 +51,50 @@ export class CursorManager {
|
|||
// 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() {
|
||||
this._cursorTracker = Meta.CursorTracker.get_for_display(global.display);
|
||||
this._cursorWantedVisible = this._cursorTracker.get_pointer_visible();
|
||||
this._cursorTrackerSetPointerVisible = Meta.CursorTracker.prototype.set_pointer_visible;
|
||||
this._cursorTrackerSetPointerVisibleBound = this._cursorTrackerSetPointerVisible.bind(this._cursorTracker);
|
||||
Meta.CursorTracker.prototype.set_pointer_visible = this._cursorTrackerSetPointerVisibleReplacement.bind(this);
|
||||
Globals.logger.log_debug('CursorManager _enableCloningMouse');
|
||||
this._cursorTracker = global.backend.get_cursor_tracker?.() ?? Meta.CursorTracker.get_for_display(global.display);
|
||||
|
||||
this._cursorTrackerSetPointerVisibleBound(false);
|
||||
this._mouseSprite = new Clutter.Actor({ request_mode: Clutter.RequestMode.CONTENT_SIZE });
|
||||
this._mouseSprite.content = new MouseSpriteContent();
|
||||
|
||||
this._cursorSprite = new Clutter.Actor({ request_mode: Clutter.RequestMode.CONTENT_SIZE });
|
||||
this._cursorSprite.content = new MouseSpriteContent();
|
||||
|
||||
this._cursorActor = new Clutter.Actor();
|
||||
if (Clutter.Container === undefined) {
|
||||
this._cursorActor.add_child(this._cursorSprite);
|
||||
} else {
|
||||
this._cursorActor.add_actor(this._cursorSprite);
|
||||
}
|
||||
this._cursorWatcher = PointerWatcher.getPointerWatcher();
|
||||
this._cursorSeat = Clutter.get_default_backend().get_default_seat();
|
||||
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"
|
||||
|
|
@ -81,29 +102,17 @@ export class CursorManager {
|
|||
//
|
||||
// completely reverts _enableCloningMouse
|
||||
_disableCloningMouse() {
|
||||
Globals.logger.log_debug('CursorManager _disableCloningMouse');
|
||||
this._stopCloningMouse();
|
||||
Meta.CursorTracker.prototype.set_pointer_visible = this._cursorTrackerSetPointerVisible;
|
||||
this._cursorTracker.set_pointer_visible(this._cursorWantedVisible);
|
||||
|
||||
this._cursorWantedVisible = null;
|
||||
this._cursorTracker = null;
|
||||
this._cursorTrackerSetPointerVisible = null;
|
||||
this._cursorTrackerSetPointerVisibleBound = null;
|
||||
this._cursorSprite = null;
|
||||
this._cursorActor = null;
|
||||
this._cursorWatcher = null;
|
||||
this._cursorSeat = null;
|
||||
}
|
||||
|
||||
// bound to Meta.CursorTracker.prototype.set_pointer_visible when cloning is "on"
|
||||
// original function available in this._cursorTrackerSetPointerVisibleBound
|
||||
_cursorTrackerSetPointerVisibleReplacement(visible) {
|
||||
this._cursorWantedVisible = visible;
|
||||
if (visible) {
|
||||
this._startCloningMouse();
|
||||
} else {
|
||||
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:
|
||||
|
|
@ -112,35 +121,18 @@ export class CursorManager {
|
|||
// * 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, _cursorWantedVisible is true
|
||||
// prereqs: setup in _enableCloningMouse
|
||||
_startCloningMouse() {
|
||||
if (this._cursorWatch == null) {
|
||||
if (Clutter.Container === undefined) {
|
||||
this._mainActor.add_child(this._cursorActor);
|
||||
} else {
|
||||
this._mainActor.add_actor(this._cursorActor);
|
||||
}
|
||||
this._cursorChangedConnection = this._cursorTracker.connect('cursor-changed', this._updateMouseSprite.bind(this));
|
||||
this._cursorVisibilityChangedConnection = this._cursorTracker.connect('visibility-changed', this._updateMouseSprite.bind(this));
|
||||
this._cursorPositionInvalidatedConnection = this._cursorTracker.connect('position-invalidated', this._updateMouseSprite.bind(this));
|
||||
Globals.logger.log_debug('CursorManager _startCloningMouse');
|
||||
|
||||
const interval = 1000 / 250;
|
||||
this._cursorWatch = this._cursorWatcher.addWatch(interval, this._updateMousePosition.bind(this));
|
||||
this._updateMouseSprite();
|
||||
this._cursorTracker.connectObject('cursor-changed', this._updateMouseSprite.bind(this), this);
|
||||
|
||||
const [x, y] = global.get_pointer();
|
||||
this._updateMousePosition(x, y);
|
||||
this._updateMouseSprite();
|
||||
}
|
||||
// cap the refresh rate for performance reasons
|
||||
const interval = 1000.0 / Math.min(this._refreshRate, 60);
|
||||
|
||||
if (this._cursorTracker.set_keep_focus_while_hidden) {
|
||||
this._cursorTracker.set_keep_focus_while_hidden(true);
|
||||
}
|
||||
|
||||
if (!this._cursorUnfocusInhibited) {
|
||||
console.log('Breezy debug - inhibit_unfocus\n');
|
||||
this._cursorSeat.inhibit_unfocus();
|
||||
this._cursorUnfocusInhibited = true;
|
||||
}
|
||||
this._cursorWatch = PointerWatcher.getPointerWatcher().addWatch(interval, this._updateMousePosition.bind(this));
|
||||
this._updateMousePosition();
|
||||
}
|
||||
|
||||
// After this:
|
||||
|
|
@ -150,62 +142,133 @@ export class CursorManager {
|
|||
//
|
||||
// completely reverts _startCloningMouse
|
||||
_stopCloningMouse() {
|
||||
Globals.logger.log_debug('CursorManager _stopCloningMouse');
|
||||
if (this._cursorWatch != null) {
|
||||
this._cursorWatch.remove();
|
||||
this._cursorWatch = null;
|
||||
}
|
||||
|
||||
this._cursorTracker.disconnect(this._cursorChangedConnection);
|
||||
this._cursorChangedConnection = null;
|
||||
if (this._cursorTracker) this._cursorTracker.disconnectObject(this);
|
||||
if (this._mouseSprite?.content?.texture) this._mouseSprite.content.texture = null;
|
||||
|
||||
this._cursorTracker.disconnect(this._cursorVisibilityChangedConnection);
|
||||
this._cursorVisibilityChangedConnection = null;
|
||||
if (!this._systemCursorShown) this._showSystemCursor();
|
||||
}
|
||||
|
||||
this._cursorTracker.disconnect(this._cursorPositionInvalidatedConnection);
|
||||
this._cursorPositionInvalidatedConnection = null;
|
||||
_showSystemCursor() {
|
||||
this._systemCursorShown = true;
|
||||
|
||||
if (Clutter.Container === undefined) {
|
||||
this._mainActor.remove_child(this._cursorActor);
|
||||
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._mainActor.remove_actor(this._cursorActor);
|
||||
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._cursorTracker.set_keep_focus_while_hidden) {
|
||||
this._cursorTracker.set_keep_focus_while_hidden(false);
|
||||
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._cursorUnfocusInhibited) {
|
||||
console.log('Breezy debug - uninhibit_unfocus\n');
|
||||
this._cursorSeat.uninhibit_unfocus();
|
||||
this._cursorUnfocusInhibited = false;
|
||||
if (this.onMonitorIndex !== undefined) {
|
||||
if (this._systemCursorShown) this._hideSystemCursor();
|
||||
this._cursorRoot.set_position(xRel, yRel);
|
||||
} else if (!this._systemCursorShown) {
|
||||
this._showSystemCursor();
|
||||
}
|
||||
}
|
||||
|
||||
_updateMousePosition(x, y) {
|
||||
this._cursorActor.set_position(x, y);
|
||||
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() {
|
||||
const sprite = this._cursorTracker.get_sprite();
|
||||
if (sprite) {
|
||||
this._cursorSprite.content.texture = sprite;
|
||||
this._cursorSprite.show();
|
||||
} else {
|
||||
this._cursorSprite.hide();
|
||||
}
|
||||
|
||||
const [xHot, yHot] = this._cursorTracker.get_hot();
|
||||
this._cursorSprite.set({
|
||||
this._updateSpriteTexture();
|
||||
let [xHot, yHot] = this._cursorTracker.get_hot();
|
||||
this._mouseSprite.set({
|
||||
translation_x: -xHot,
|
||||
translation_y: -yHot,
|
||||
});
|
||||
this._mainActor.set_child_above_sibling(this._cursorActor, null);
|
||||
this._cursorTrackerSetPointerVisibleBound(false);
|
||||
}
|
||||
|
||||
// some other processes are uninhibiting when they shouldn't, so we need to re-inhibit here
|
||||
if (!this._cursorSeat.is_unfocus_inhibited() && this._cursorUnfocusInhibited) {
|
||||
console.log('Breezy debug - reinhibiting\n');
|
||||
this._cursorSeat.inhibit_unfocus();
|
||||
_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);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,343 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
import Clutter from 'gi://Clutter'
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
import Meta from 'gi://Meta';
|
||||
|
|
@ -6,19 +5,18 @@ 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 MonitorManager from './monitormanager.js';
|
||||
import { IPC_FILE_PATH, XREffect } from './xrEffect.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 SUPPORTED_MONITOR_PRODUCTS = [
|
||||
'VITURE',
|
||||
'nreal air',
|
||||
'Air',
|
||||
'MetaMonitor' // nested mode dummy monitor
|
||||
];
|
||||
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) {
|
||||
|
|
@ -29,155 +27,364 @@ export default class BreezyDesktopExtension extends Extension {
|
|||
// Set/destroyed by enable/disable
|
||||
this._cursor_manager = null;
|
||||
this._monitor_manager = null;
|
||||
this._xr_effect = null;
|
||||
this._overlay = 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.extension_dir = this.path;
|
||||
this._monitor_manager = new MonitorManager(this.path);
|
||||
this._monitor_manager.setChangeHook(this._setup.bind(this));
|
||||
this._monitor_manager.enable();
|
||||
Globals.logger.log_debug('BreezyDesktopExtension enable');
|
||||
|
||||
this._setup();
|
||||
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}`);
|
||||
}
|
||||
}
|
||||
|
||||
_poll_for_ready() {
|
||||
var target_monitor = this._target_monitor;
|
||||
var is_effect_running = this._is_effect_running;
|
||||
this._running_poller_id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1000, (() => {
|
||||
if (is_effect_running) return GLib.SOURCE_REMOVE;
|
||||
|
||||
const is_driver_running = this._check_driver_running();
|
||||
if (is_driver_running && target_monitor) {
|
||||
console.log('Driver is running, supported monitor connected. Enabling XR effect.');
|
||||
this._effect_enable();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
} else {
|
||||
return GLib.SOURCE_CONTINUE;
|
||||
_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];
|
||||
});
|
||||
}
|
||||
}).bind(this));
|
||||
|
||||
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() {
|
||||
const target_monitor = this._monitor_manager.getMonitorPropertiesList()?.find(
|
||||
monitor => SUPPORTED_MONITOR_PRODUCTS.includes(monitor.product));
|
||||
if (target_monitor !== undefined) {
|
||||
return {
|
||||
monitor: this._monitor_manager.getMonitors()[target_monitor.index],
|
||||
refreshRate: target_monitor.refreshRate,
|
||||
};
|
||||
}
|
||||
if (!this._monitor_manager.getMonitorPropertiesList()) return null;
|
||||
|
||||
if (this.settings.get_boolean('developer-mode')) {
|
||||
// allow testing XR devices with just USB, no video needed
|
||||
return {
|
||||
monitor: this._monitor_manager.getMonitors()[0],
|
||||
refreshRate: 60,
|
||||
};
|
||||
}
|
||||
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;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
_setup() {
|
||||
if (this._is_effect_running) {
|
||||
console.log('Monitors changed, disabling XR effect');
|
||||
this._effect_disable();
|
||||
}
|
||||
const target_monitor = this._find_supported_monitor();
|
||||
|
||||
// if target_monitor isn't set, do nothing and wait for MonitorManager to call this again
|
||||
if (target_monitor && this._running_poller_id === undefined) {
|
||||
this._target_monitor = target_monitor.monitor;
|
||||
this._refresh_rate = target_monitor.refreshRate;
|
||||
|
||||
if (this._check_driver_running()) {
|
||||
console.log('Ready, enabling XR effect');
|
||||
this._effect_enable();
|
||||
} else {
|
||||
this._poll_for_ready();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
_check_driver_running() {
|
||||
if (!Globals.ipc_file) Globals.ipc_file = Gio.file_new_for_path(IPC_FILE_PATH);
|
||||
return Globals.ipc_file.query_exists(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() {
|
||||
this._running_poller_id = undefined;
|
||||
Globals.logger.log_debug('BreezyDesktopExtension _effect_enable');
|
||||
if (!this._is_effect_running) {
|
||||
this._is_effect_running = true;
|
||||
|
||||
try {
|
||||
this._cursor_manager = new CursorManager(Main.layoutManager.uiGroup);
|
||||
this._cursor_manager.enable();
|
||||
const targetMonitor = this._target_monitor.monitor;
|
||||
const virtualMonitors = this._find_virtual_monitors();
|
||||
const refreshRate = targetMonitor.refreshRate ?? 60;
|
||||
|
||||
this._overlay = new St.Bin({ style: 'background-color: rgba(0, 0, 0, 1);'});
|
||||
this._overlay.opacity = 255;
|
||||
this._overlay.set_position(this._target_monitor.x, this._target_monitor.y);
|
||||
this._overlay.set_size(this._target_monitor.width, this._target_monitor.height);
|
||||
// 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 overlayContent = new Clutter.Actor({clip_to_allocation: true});
|
||||
const uiClone = new Clutter.Clone({ source: Main.layoutManager.uiGroup, clip_to_allocation: true });
|
||||
uiClone.x = -this._target_monitor.x;
|
||||
uiClone.y = -this._target_monitor.y;
|
||||
if (Clutter.Container === undefined) {
|
||||
overlayContent.add_child(uiClone);
|
||||
} else {
|
||||
overlayContent.add_actor(uiClone);
|
||||
}
|
||||
const state = this._read_state();
|
||||
const pose_has_position = state['connected_device_pose_has_position'] === 'true';
|
||||
this._pose_has_position = pose_has_position;
|
||||
|
||||
this._overlay.set_child(overlayContent);
|
||||
Globals.logger.log_debug(
|
||||
`connected_device_pose_has_position=${pose_has_position}`
|
||||
);
|
||||
|
||||
global.stage.insert_child_above(this._overlay, null);
|
||||
Shell.util_set_hidden_from_pick(this._overlay, true);
|
||||
|
||||
this._xr_effect = new XREffect({
|
||||
target_monitor: this._target_monitor,
|
||||
target_framerate: this._refresh_rate ?? 60,
|
||||
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.settings.bind('effect-enable', this._xr_effect, 'effect-enable', Gio.SettingsBindFlags.DEFAULT)
|
||||
this.settings.bind('display-distance', this._xr_effect, 'display-distance', Gio.SettingsBindFlags.DEFAULT)
|
||||
this.settings.bind('toggle-display-distance-start', this._xr_effect, 'toggle-display-distance-start', Gio.SettingsBindFlags.DEFAULT)
|
||||
this.settings.bind('toggle-display-distance-end', this._xr_effect, 'toggle-display-distance-end', Gio.SettingsBindFlags.DEFAULT)
|
||||
this._virtual_displays_overlay.set_child(this._virtual_displays_actor);
|
||||
this._virtual_displays_actor.renderMonitors();
|
||||
|
||||
this._overlay.add_effect_with_name('xr-desktop', this._xr_effect);
|
||||
Meta.disable_unredirect_for_display(global.display);
|
||||
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._xr_effect._change_distance.bind(this._xr_effect));
|
||||
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) {
|
||||
console.error('Error enabling XR effect', 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) {
|
||||
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}`, () => {
|
||||
// Remove the old keybinding
|
||||
Main.wm.removeKeybinding(settings_key);
|
||||
|
||||
// Add the updated keybinding
|
||||
try {
|
||||
Main.wm.addKeybinding(
|
||||
settings_key,
|
||||
this.settings,
|
||||
|
|
@ -185,56 +392,353 @@ export default class BreezyDesktopExtension extends Extension {
|
|||
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) {
|
||||
const file = Gio.file_new_for_path('/dev/shm/xr_driver_control');
|
||||
const stream = file.replace(null, false, Gio.FileCreateFlags.NONE, null);
|
||||
stream.write(`${key}=${value}`, null);
|
||||
stream.close(null);
|
||||
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');
|
||||
}
|
||||
|
||||
_effect_disable() {
|
||||
this._is_effect_running = false;
|
||||
|
||||
if (this._running_poller_id) GLib.source_remove(this._running_poller_id);
|
||||
|
||||
Main.wm.removeKeybinding('recenter-display-shortcut');
|
||||
Main.wm.removeKeybinding('toggle-display-distance-shortcut');
|
||||
Meta.enable_unredirect_for_display(global.display);
|
||||
|
||||
if (this._overlay) {
|
||||
global.stage.remove_child(this._overlay);
|
||||
this._overlay.remove_effect_by_name('xr-desktop');
|
||||
this._overlay.destroy();
|
||||
this._overlay = null;
|
||||
_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);
|
||||
}
|
||||
}
|
||||
|
||||
if (this._xr_effect) {
|
||||
this._xr_effect = null;
|
||||
// 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}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (this._cursor_manager) {
|
||||
this._cursor_manager.disable();
|
||||
this._cursor_manager = null;
|
||||
_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() {
|
||||
this._effect_disable();
|
||||
this._target_monitor = null;
|
||||
if (this._monitor_manager) {
|
||||
this._monitor_manager.disable();
|
||||
this._monitor_manager = null;
|
||||
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}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
const Globals = {
|
||||
ipc_file: null, // Gio.File instance, file exists
|
||||
extension_dir: null // string path
|
||||
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;
|
||||
|
|
@ -24,7 +24,7 @@ export function dataViewBigUint(dataView, dataViewInfo) {
|
|||
return Number(dataView.getBigUint64(dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX], true));
|
||||
}
|
||||
|
||||
export function dataViewUintArray(dataView, dataViewInfo) {
|
||||
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++) {
|
||||
|
|
@ -34,6 +34,16 @@ export function dataViewUintArray(dataView, dataViewInfo) {
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,119 @@
|
|||
// 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}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -1,3 +1,78 @@
|
|||
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];
|
||||
}
|
||||
|
|
@ -3,8 +3,9 @@
|
|||
"name": "Breezy GNOME XR Desktop",
|
||||
"description": "XR virtual desktop for GNOME.",
|
||||
"settings-schema": "com.xronlinux.BreezyDesktop",
|
||||
"session-modes": ["user"],
|
||||
"shell-version": [
|
||||
"45", "46"
|
||||
"46", "47", "48", "49", "50"
|
||||
],
|
||||
"url": "https://github.com/wheaney/breezy-desktop"
|
||||
}
|
||||
|
|
@ -17,9 +17,33 @@
|
|||
// 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) {
|
||||
|
|
@ -32,7 +56,7 @@ function getDisplayConfigProxy(extPath) {
|
|||
xml = new TextDecoder().decode(bytes);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('failed to load DisplayConfig interface XML');
|
||||
Globals.logger.log('[ERROR] failed to load DisplayConfig interface XML');
|
||||
throw e;
|
||||
}
|
||||
cachedDisplayConfigProxy = Gio.DBusProxy.makeProxyWrapper(xml);
|
||||
|
|
@ -50,69 +74,382 @@ export function newDisplayConfig(extPath, callback) {
|
|||
);
|
||||
}
|
||||
|
||||
export function getMonitorConfig(displayConfigProxy, callback) {
|
||||
displayConfigProxy.GetResourcesRemote((result) => {
|
||||
if (result.length <= 2) {
|
||||
callback(null, 'Cannot get DisplayConfig: No outputs in GetResources()');
|
||||
function getMonitorConfig(displayConfigProxy, callback) {
|
||||
displayConfigProxy.GetCurrentStateRemote((result, error) => {
|
||||
if (error) {
|
||||
callback(null, `GetCurrentState failed: ${error}`);
|
||||
} else {
|
||||
const monitors = [];
|
||||
for (let i = 0; i < result[2].length; i++) {
|
||||
const output = result[2][i];
|
||||
if (output.length <= 7) {
|
||||
callback(null, 'Cannot get DisplayConfig: No properties on output #' + i);
|
||||
return;
|
||||
}
|
||||
const props = output[7];
|
||||
const displayName = props['display-name'].get_string()[0];
|
||||
const connectorName = output[4];
|
||||
if (!displayName || displayName == '') {
|
||||
const displayName = 'Monitor on output ' + connectorName;
|
||||
}
|
||||
const vendor = props['vendor'].get_string()[0];
|
||||
const product = props['product'].get_string()[0];
|
||||
const serial = props['serial'].get_string()[0];
|
||||
Globals.logger.log_debug(`monitormanager.js getMonitorConfig GetCurrentState result: ${JSON.stringify(result)}`);
|
||||
|
||||
// grab refresh rate from the modes array
|
||||
const refreshRate = result[3][i][4];
|
||||
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];
|
||||
|
||||
monitors.push([displayName, connectorName, vendor, product, serial, refreshRate]);
|
||||
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`);
|
||||
}
|
||||
callback(monitors, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Monitor change handling
|
||||
export default class MonitorManager {
|
||||
constructor(extPath) {
|
||||
this._extPath = extPath;
|
||||
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._backendManager = 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() {
|
||||
this._backendManager = global.backend.get_monitor_manager();
|
||||
newDisplayConfig(this._extPath, (proxy, error) => {
|
||||
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._backendManager = null;
|
||||
this._monitorProperties = null;
|
||||
this._changeHookFn = null;
|
||||
}
|
||||
|
|
@ -121,10 +458,6 @@ export default class MonitorManager {
|
|||
this._changeHookFn = fn;
|
||||
}
|
||||
|
||||
setPostCallback(callback) {
|
||||
this._postCallback = callback;
|
||||
}
|
||||
|
||||
getMonitors() {
|
||||
return Main.layoutManager.monitors;
|
||||
}
|
||||
|
|
@ -133,19 +466,85 @@ export default class MonitorManager {
|
|||
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;
|
||||
}
|
||||
getMonitorConfig(this._displayConfigProxy, (result, error) => {
|
||||
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 = this._backendManager.get_monitor_for_connector(connectorName);
|
||||
console.log(`\n\nFound monitor ${monitorName}, vendor ${vendor}, product ${product}, serial ${serial}, connector ${connectorName}, index ${monitorIndex}\n\n`);
|
||||
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,
|
||||
|
|
@ -159,9 +558,24 @@ export default class MonitorManager {
|
|||
}
|
||||
}
|
||||
this._monitorProperties = monitorProperties;
|
||||
if (this._changeHookFn !== null) {
|
||||
this._changeHookFn();
|
||||
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -4,11 +4,10 @@ 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
|
||||
//
|
||||
// TODO - Gjs on GNOME 45.5 WARNING: Some code called array.toString() on a Uint8Array instance. Previously this
|
||||
// would have interpreted the bytes of the array as a string, but that is nonstandard. In the future this
|
||||
// will return the bytes as comma-separated digits. For the time being, the old behavior has been preserved,
|
||||
// but please fix your code anyway to use TextDecoder.
|
||||
return data[1].toString().replace(/^#version .*$/gm, '') + '\n';
|
||||
return shaderSource.replace(/^#version .*$/gm, '') + '\n';
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../modules/sombrero/calibrating.png
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../vulkan/custom_banner.png
|
||||
|
|
@ -5,3 +5,7 @@ export function getEpochSec() {
|
|||
export function toSec(milliseconds) {
|
||||
return Math.floor(milliseconds / 1000);
|
||||
}
|
||||
|
||||
export function isValidKeepAlive(dateSec) {
|
||||
return Math.abs(getEpochSec() - dateSec) <= 1;
|
||||
}
|
||||
|
|
@ -0,0 +1,630 @@
|
|||
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
|
|
@ -1,308 +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 {
|
||||
dataViewEnd,
|
||||
dataViewUint8,
|
||||
dataViewBigUint,
|
||||
dataViewUintArray,
|
||||
dataViewFloat,
|
||||
dataViewFloatArray,
|
||||
BOOL_SIZE,
|
||||
DATA_VIEW_INFO_COUNT_INDEX,
|
||||
DATA_VIEW_INFO_OFFSET_INDEX,
|
||||
FLOAT_SIZE,
|
||||
UINT_SIZE,
|
||||
UINT8_SIZE
|
||||
} from "./ipc.js";
|
||||
import { degreeToRadian } from "./math.js";
|
||||
import { getShaderSource } from "./shader.js";
|
||||
import { toSec } from "./time.js";
|
||||
|
||||
export const IPC_FILE_PATH = "/dev/shm/breezy_desktop_imu";
|
||||
|
||||
// the driver should be using the same data layout version
|
||||
const DATA_LAYOUT_VERSION = 2;
|
||||
|
||||
// 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 EPOCH_MS = [dataViewEnd(CUSTOM_BANNER_ENABLED), UINT_SIZE, 2];
|
||||
const IMU_QUAT_DATA = [dataViewEnd(EPOCH_MS), FLOAT_SIZE, 16];
|
||||
const DATA_VIEW_LENGTH = dataViewEnd(IMU_QUAT_DATA);
|
||||
|
||||
// cached after first retrieval
|
||||
const shaderUniformLocations = {
|
||||
'enabled': null,
|
||||
'show_banner': null,
|
||||
'imu_quat_data': null,
|
||||
'look_ahead_cfg': null,
|
||||
'look_ahead_ms': null,
|
||||
'stage_aspect_ratio': null,
|
||||
'display_aspect_ratio': null,
|
||||
'trim_width_percent': null,
|
||||
'trim_height_percent': null,
|
||||
'display_zoom': null,
|
||||
'display_north_offset': null,
|
||||
'lens_distance_ratio': null,
|
||||
'sbs_enabled': null,
|
||||
'sbs_content': null,
|
||||
'custom_banner_enabled': null,
|
||||
'half_fov_z_rads': null,
|
||||
'half_fov_y_rads': null,
|
||||
'screen_distance': null
|
||||
};
|
||||
|
||||
function transferUniformBoolean(effect, location, dataView, dataViewInfo) {
|
||||
// GLSL bool is a float under the hood, evaluates false if 0 or 0.0, true otherwise
|
||||
effect.set_uniform_float(location, 1, [dataViewUint8(dataView, dataViewInfo)]);
|
||||
}
|
||||
|
||||
function setUniformFloat(effect, locationName, dataViewInfo, value) {
|
||||
effect.set_uniform_float(shaderUniformLocations[locationName], dataViewInfo[DATA_VIEW_INFO_COUNT_INDEX], value);
|
||||
}
|
||||
|
||||
function transferUniformFloat(effect, locationName, dataView, dataViewInfo) {
|
||||
setUniformFloat(effect, locationName, dataViewInfo, dataViewFloatArray(dataView, dataViewInfo));
|
||||
}
|
||||
|
||||
function setSingleFloat(effect, locationName, value) {
|
||||
effect.set_uniform_float(shaderUniformLocations[locationName], 1, [value]);
|
||||
}
|
||||
|
||||
function setUniformMatrix(effect, locationName, components, dataView, dataViewInfo) {
|
||||
const numValues = dataViewInfo[DATA_VIEW_INFO_COUNT_INDEX];
|
||||
if (numValues / components !== components) {
|
||||
throw new Error('Invalid matrix size');
|
||||
}
|
||||
|
||||
const floatArray = [].fill(0, 0, numValues);
|
||||
let offset = dataViewInfo[DATA_VIEW_INFO_OFFSET_INDEX];
|
||||
for (let i = 0; i < numValues; i++) {
|
||||
// GLSL uses column-major order, so we need to transpose the matrix
|
||||
const row = i % components;
|
||||
const column = Math.floor(i / components);
|
||||
|
||||
floatArray[row * components + column] = dataView.getFloat32(offset, true);
|
||||
offset += FLOAT_SIZE;
|
||||
}
|
||||
effect.set_uniform_matrix(shaderUniformLocations[locationName], true, components, floatArray);
|
||||
}
|
||||
|
||||
function lookAheadMS(dataView) {
|
||||
const lookAheadCfg = dataViewFloatArray(dataView, LOOK_AHEAD_CFG);
|
||||
const imuDateMS = dataViewBigUint(dataView, EPOCH_MS);
|
||||
|
||||
// how stale the imu data is
|
||||
const dataAge = Date.now() - imuDateMS;
|
||||
|
||||
return lookAheadCfg[0] + dataAge;
|
||||
}
|
||||
|
||||
// most uniforms don't change frequently, this function should be called periodically
|
||||
function setIntermittentUniformVariables() {
|
||||
const dataView = this._dataView;
|
||||
|
||||
if (dataView.byteLength === DATA_VIEW_LENGTH) {
|
||||
const version = dataViewUint8(dataView, VERSION);
|
||||
const imuDateMS = dataViewBigUint(dataView, EPOCH_MS);
|
||||
const currentDateMS = Date.now();
|
||||
const validKeepalive = Math.abs(toSec(currentDateMS) - toSec(imuDateMS)) < 5;
|
||||
const imuData = dataViewFloatArray(dataView, IMU_QUAT_DATA);
|
||||
const imuResetState = imuData[0] === 0.0 && imuData[1] === 0.0 && imuData[2] === 0.0 && imuData[3] === 1.0;
|
||||
const enabled = this.effect_enable && dataViewUint8(dataView, ENABLED) !== 0 && version === DATA_LAYOUT_VERSION && validKeepalive && !imuResetState;
|
||||
|
||||
if (enabled) {
|
||||
const displayRes = dataViewUintArray(dataView, DISPLAY_RES);
|
||||
const displayFov = dataViewFloat(dataView, DISPLAY_FOV);
|
||||
const lensDistanceRatio = dataViewFloat(dataView, LENS_DISTANCE_RATIO);
|
||||
|
||||
// compute these values once, they only change when the XR device changes
|
||||
const displayAspectRatio = displayRes[0] / displayRes[1];
|
||||
const stageAspectRatio = this.target_monitor.width / this.target_monitor.height;
|
||||
const diagToVertRatio = Math.sqrt(Math.pow(stageAspectRatio, 2) + 1);
|
||||
const halfFovZRads = degreeToRadian(displayFov / diagToVertRatio) / 2;
|
||||
const halfFovYRads = halfFovZRads * stageAspectRatio;
|
||||
const screenDistance = 1.0 - lensDistanceRatio;
|
||||
|
||||
// our overlay doesn't quite cover the full screen texture, which allows us to see some of the real desktop
|
||||
// underneath, so we trim two pixels around the entire edge of the texture
|
||||
const trimWidthPercent = 2.0 / this.target_monitor.width;
|
||||
const trimHeightPercent = 2.0 / this.target_monitor.height;
|
||||
|
||||
// all these values are transferred directly, unmodified from the driver
|
||||
transferUniformFloat(this, 'look_ahead_cfg', dataView, LOOK_AHEAD_CFG);
|
||||
transferUniformFloat(this, 'lens_distance_ratio', dataView, LENS_DISTANCE_RATIO);
|
||||
transferUniformBoolean(this, 'sbs_enabled', dataView, SBS_ENABLED);
|
||||
transferUniformBoolean(this, 'custom_banner_enabled', dataView, CUSTOM_BANNER_ENABLED);
|
||||
|
||||
// computed values with no dataViewInfo, so we set these manually
|
||||
setSingleFloat(this, 'show_banner', imuResetState);
|
||||
setSingleFloat(this, 'stage_aspect_ratio', stageAspectRatio);
|
||||
setSingleFloat(this, 'display_aspect_ratio', displayAspectRatio);
|
||||
setSingleFloat(this, 'trim_width_percent', trimWidthPercent);
|
||||
setSingleFloat(this, 'trim_height_percent', trimHeightPercent);
|
||||
setSingleFloat(this, 'half_fov_z_rads', halfFovZRads);
|
||||
setSingleFloat(this, 'half_fov_y_rads', halfFovYRads);
|
||||
setSingleFloat(this, 'screen_distance', screenDistance);
|
||||
|
||||
// TOOD - drive from settings
|
||||
setSingleFloat(this, 'display_zoom', 1.0);
|
||||
setSingleFloat(this, 'sbs_content', 0.0);
|
||||
}
|
||||
setSingleFloat(this, 'enabled', enabled ? 1.0 : 0.0);
|
||||
} else if (dataView.byteLength !== 0) {
|
||||
console.error(`Invalid dataView.byteLength: ${dataView.byteLength} !== ${DATA_VIEW_LENGTH}`)
|
||||
}
|
||||
}
|
||||
|
||||
export const XREffect = GObject.registerClass({
|
||||
Properties: {
|
||||
'effect-enable': GObject.ParamSpec.boolean(
|
||||
'effect-enable',
|
||||
'Effect enable',
|
||||
'Whether this effect is enabled',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
true
|
||||
),
|
||||
'target-monitor': GObject.ParamSpec.jsobject(
|
||||
'target-monitor',
|
||||
'Target Monitor',
|
||||
'Geometry of the target monitor for this effect',
|
||||
GObject.ParamFlags.READWRITE
|
||||
),
|
||||
'target-framerate': GObject.ParamSpec.uint(
|
||||
'target-framerate',
|
||||
'Target Framerate',
|
||||
'Target framerate for this effect',
|
||||
GObject.ParamFlags.READWRITE, 60, 240, 60
|
||||
),
|
||||
'display-distance': GObject.ParamSpec.double(
|
||||
'display-distance',
|
||||
'Display Distance',
|
||||
'How far away the display appears',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
0.2,
|
||||
2.5,
|
||||
1.05
|
||||
),
|
||||
'toggle-display-distance-start': GObject.ParamSpec.double(
|
||||
'toggle-display-distance-start',
|
||||
'Display distance start',
|
||||
'Start distance when using the "change distance" shortcut.',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
0.2,
|
||||
2.5,
|
||||
1.05
|
||||
),
|
||||
'toggle-display-distance-end': GObject.ParamSpec.double(
|
||||
'toggle-display-distance-end',
|
||||
'Display distance end',
|
||||
'End distance when using the "change distance" shortcut.',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
0.2,
|
||||
2.5,
|
||||
1.05
|
||||
)
|
||||
}
|
||||
}, class XREffect extends Shell.GLSLEffect {
|
||||
constructor(params = {}) {
|
||||
super(params);
|
||||
|
||||
this._frametime = Math.floor(1000 / this.target_framerate);
|
||||
|
||||
this._is_display_distance_at_end = false;
|
||||
this._distance_ease_timeline = null;
|
||||
}
|
||||
|
||||
_change_distance() {
|
||||
if (this._distance_ease_timeline?.is_playing()) this._distance_ease_timeline.stop();
|
||||
|
||||
this._distance_ease_start = this.display_distance;
|
||||
this._distance_ease_timeline = Clutter.Timeline.new_for_actor(this.get_actor(), 250);
|
||||
|
||||
const toggle_display_distance_target = this._is_display_distance_at_end ?
|
||||
this.toggle_display_distance_start : this.toggle_display_distance_end;
|
||||
this._distance_ease_timeline.connect('new-frame', () => {
|
||||
this.display_distance = this._distance_ease_start +
|
||||
this._distance_ease_timeline.get_progress() *
|
||||
(toggle_display_distance_target - this._distance_ease_start);
|
||||
});
|
||||
this._is_display_distance_at_end = !this._is_display_distance_at_end;
|
||||
|
||||
this._distance_ease_timeline.start();
|
||||
}
|
||||
|
||||
vfunc_build_pipeline() {
|
||||
const code = getShaderSource(`${Globals.extension_dir}/IMUAdjust.frag`);
|
||||
const main = 'PS_IMU_Transform(vec4(0, 0, 0, 0), cogl_tex_coord_in[0].xy, cogl_color_out);';
|
||||
this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT, code, main, false);
|
||||
}
|
||||
|
||||
vfunc_paint_target(node, paintContext) {
|
||||
var now = Date.now();
|
||||
var lastPaint = this._last_paint || 0;
|
||||
var frametime = this._frametime;
|
||||
const data = Globals.ipc_file.load_contents(null);
|
||||
if (data[0]) {
|
||||
const buffer = new Uint8Array(data[1]).buffer;
|
||||
this._dataView = new DataView(buffer);
|
||||
if (!this._initialized) {
|
||||
this.set_uniform_float(this.get_uniform_location('uDesktopTexture'), 1, [0]);
|
||||
for (let key in shaderUniformLocations) {
|
||||
shaderUniformLocations[key] = this.get_uniform_location(key);
|
||||
}
|
||||
this.setIntermittentUniformVariables = setIntermittentUniformVariables.bind(this);
|
||||
this.setIntermittentUniformVariables();
|
||||
|
||||
this._redraw_timeout_id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, this._frametime, () => {
|
||||
if ((now - lastPaint) > frametime) global.stage.queue_redraw();
|
||||
return GLib.SOURCE_CONTINUE;
|
||||
});
|
||||
|
||||
this._uniforms_timeout_id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 250, (() => {
|
||||
this.setIntermittentUniformVariables();
|
||||
return GLib.SOURCE_CONTINUE;
|
||||
}).bind(this));
|
||||
|
||||
this._initialized = true;
|
||||
}
|
||||
|
||||
if (this._dataView.byteLength === DATA_VIEW_LENGTH) {
|
||||
setSingleFloat(this, 'display_north_offset', this.display_distance);
|
||||
setSingleFloat(this, 'look_ahead_ms', lookAheadMS(this._dataView));
|
||||
setUniformMatrix(this, 'imu_quat_data', 4, this._dataView, IMU_QUAT_DATA);
|
||||
} else if (this._dataView.byteLength !== 0) {
|
||||
console.error(`Invalid dataView.byteLength: ${this._dataView.byteLength} !== ${DATA_VIEW_LENGTH}`)
|
||||
}
|
||||
|
||||
// improves sampling quality for smooth text and edges
|
||||
this.get_pipeline().set_layer_filters (
|
||||
0,
|
||||
Cogl.PipelineFilter.LINEAR_MIPMAP_LINEAR,
|
||||
Cogl.PipelineFilter.LINEAR
|
||||
);
|
||||
|
||||
super.vfunc_paint_target(node, paintContext);
|
||||
} else {
|
||||
super.vfunc_paint_target(node, paintContext);
|
||||
}
|
||||
this._last_paint = now;
|
||||
}
|
||||
|
||||
vfunc_dispose() {
|
||||
if (this._redraw_timeout_id) GLib.source_remove(this._redraw_timeout_id);
|
||||
if (this._uniforms_timeout_id) GLib.source_remove(this._uniforms_timeout_id);
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
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)
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#!/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"
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
#!/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
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#!/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
|
||||
|
|
@ -0,0 +1,268 @@
|
|||
#!/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"
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
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)
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
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()
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# 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'
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
add_test (NAME KWinEffectSupport COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/tools/isSupported.sh)
|
||||
set_property (TEST KWinEffectSupport PROPERTY PASS_REGULAR_EXPRESSION "true")
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
# 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
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
# 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
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
# 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
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#!/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 .
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/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/
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
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)
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
<?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>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
File=breezydesktopconfig.kcfg
|
||||
ClassName=BreezyDesktopConfig
|
||||
Singleton=true
|
||||
Mutators=true
|
||||
Notifiers=true
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,244 @@
|
|||
#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
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
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)
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[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
|
|
@ -0,0 +1,91 @@
|
|||
#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;
|
||||
};
|
||||
|
|
@ -0,0 +1,960 @@
|
|||
<?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>&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>&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>&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>&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><a href="https://ko-fi.com/wheaney">Renew or support on Ko‑fi</a></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>&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 <wayne@xronlinux.com></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>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#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();
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#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;
|
||||
};
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
<?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>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"KPlugin": {
|
||||
"Name": "Breezy Desktop",
|
||||
"Description": "Configure Breezy Desktop",
|
||||
"Category": "Tools",
|
||||
"License": "GPL"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "labeledslider.h"
|
||||
|
|
@ -0,0 +1,284 @@
|
|||
#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;
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#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")
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#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));
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#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;
|
||||
};
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<?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>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#include "breezydesktopeffect.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
KWIN_EFFECT_FACTORY(BreezyDesktopEffect, "metadata.json")
|
||||
|
||||
} // namespace KWin
|
||||
|
||||
#include "main.moc"
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,340 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,182 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
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: [] };
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,477 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
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);
|
||||
}
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
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)
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
// 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");
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
// 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
|
||||
};
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
#!/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())
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 33f15b0e15b141e7664afcc4c09d2c19b62716c0
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit e3da76189390d81fda70ced38976a2061a8711ea
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 0869b8686aa204b581c212ee20ad3d63dce0e73a
|
||||
675
ui/COPYING
675
ui/COPYING
|
|
@ -1,675 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
# breezydesktop
|
||||
|
||||
A description of this project.
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
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
|
||||
|
|
@ -3,24 +3,65 @@
|
|||
# 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"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
ARCH=${ARCH:-$(uname -m)}
|
||||
echo "Building Breezy UI for $ARCH"
|
||||
|
||||
check_command "flatpak"
|
||||
check_command "flatpak-builder"
|
||||
BUILD_PATH=build
|
||||
UI_BUILD_PATH=$BUILD_PATH/ui
|
||||
PACKAGE_DIR=$BUILD_PATH/breezy_ui
|
||||
mkdir -p $UI_BUILD_PATH
|
||||
mkdir -p $PACKAGE_DIR
|
||||
|
||||
# https://stackoverflow.com/a/246128
|
||||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||
meson setup $UI_BUILD_PATH
|
||||
pushd $UI_BUILD_PATH
|
||||
meson compile
|
||||
popd
|
||||
|
||||
TMP_DIR=$(mktemp -d -t breezy-ui-flatpak-XXXXXXXXXX)
|
||||
OUT_DIR=$SCRIPT_DIR/../out
|
||||
rm -rf $OUT_DIR
|
||||
mkdir -p $OUT_DIR
|
||||
# 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
|
||||
|
||||
flatpak-builder --force-clean $TMP_DIR/build $SCRIPT_DIR/../com.xronlinux.BreezyDesktop.json
|
||||
flatpak build-export $TMP_DIR/export $TMP_DIR/build
|
||||
flatpak build-bundle $TMP_DIR/export $OUT_DIR/com.xronlinux.BreezyDesktop.flatpak com.xronlinux.BreezyDesktop --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
|
||||
# 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
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#!/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
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
diff --git a/engine/dconf-engine-source-user.c b/engine/dconf-engine-source-user.c
|
||||
index 1657875..e4f8786 100644
|
||||
--- a/engine/dconf-engine-source-user.c
|
||||
+++ b/engine/dconf-engine-source-user.c
|
||||
@@ -39,11 +39,17 @@ dconf_engine_source_user_open_gvdb (const gchar *name)
|
||||
{
|
||||
GvdbTable *table;
|
||||
gchar *filename;
|
||||
+ const gchar *override;
|
||||
+
|
||||
+ override = g_getenv ("DCONF_USER_CONFIG_DIR");
|
||||
+ if (override == NULL)
|
||||
+ filename = g_build_filename (g_get_user_config_dir (), "dconf", name, NULL);
|
||||
+ else
|
||||
+ filename = g_build_filename (g_get_home_dir (), override, name, NULL);
|
||||
|
||||
/* This can fail in the normal case of the user not having any
|
||||
* settings. That's OK and it shouldn't be considered as an error.
|
||||
*/
|
||||
- filename = g_build_filename (g_get_user_config_dir (), "dconf", name, NULL);
|
||||
table = gvdb_table_new (filename, FALSE, NULL);
|
||||
g_free (filename);
|
||||
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# stolen from dconf-editor:
|
||||
# https://gitlab.gnome.org/GNOME/dconf-editor/-/blob/master/build-aux/start-dconf-editor.sh
|
||||
|
||||
IFS=: read -ra host_data_dirs < <(flatpak-spawn --host sh -c 'echo "$XDG_DATA_DIRS"')
|
||||
|
||||
# To avoid potentially muddying up $XDG_DATA_DIRS too much, we link the schema paths
|
||||
# into a temporary directory.
|
||||
bridge_dir=$XDG_RUNTIME_DIR/dconf-bridge
|
||||
mkdir -p "$bridge_dir"
|
||||
|
||||
HOST_XDG_DATA_DIRS=""
|
||||
|
||||
for dir in "${host_data_dirs[@]}"; do
|
||||
if [[ "$dir" == /usr/* ]]; then
|
||||
dir=/run/host/"$dir"
|
||||
fi
|
||||
|
||||
schemas="$dir/glib-2.0/schemas"
|
||||
if [[ -d "$schemas" ]]; then
|
||||
bridged=$(mktemp -d XXXXXXXXXX -p "$bridge_dir")
|
||||
mkdir -p "$bridged"/glib-2.0
|
||||
ln -s "$schemas" "$bridged"/glib-2.0
|
||||
HOST_XDG_DATA_DIRS="${HOST_XDG_DATA_DIRS}:${bridged}"
|
||||
fi
|
||||
done
|
||||
|
||||
# We MUST prepend the host's data dirs BEFORE the Flatpak environment's own dirs,
|
||||
# otherwise data (such as default values) load in the wrong order and would then
|
||||
# incorrectly prefer the Flatpak's internal defaults instead of the host's defaults!
|
||||
if [[ ! -z "${HOST_XDG_DATA_DIRS}" ]]; then
|
||||
XDG_DATA_DIRS="${HOST_XDG_DATA_DIRS:1}:${XDG_DATA_DIRS}"
|
||||
fi
|
||||
|
||||
export XDG_DATA_DIRS
|
||||
exec breezydesktop "$@"
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
{
|
||||
"id" : "com.xronlinux.BreezyDesktop",
|
||||
"runtime" : "org.gnome.Platform",
|
||||
"runtime-version" : "46",
|
||||
"sdk" : "org.gnome.Sdk",
|
||||
"command" : "breezydesktop",
|
||||
"finish-args" : [
|
||||
"--share=network",
|
||||
"--share=ipc",
|
||||
"--socket=fallback-x11",
|
||||
"--device=dri",
|
||||
"--socket=wayland",
|
||||
"--device=shm",
|
||||
"--talk-name=ca.desrt.dconf",
|
||||
"--filesystem=xdg-run/dconf",
|
||||
"--filesystem=host:ro",
|
||||
"--env=DCONF_USER_CONFIG_DIR=.config/dconf",
|
||||
"--env=GIO_EXTRA_MODULES=/app/lib/gio/modules/",
|
||||
"--talk-name=org.freedesktop.Flatpak"
|
||||
],
|
||||
"cleanup" : [
|
||||
"/include",
|
||||
"/lib/pkgconfig",
|
||||
"/man",
|
||||
"/share/doc",
|
||||
"/share/gtk-doc",
|
||||
"/share/man",
|
||||
"/share/pkgconfig",
|
||||
"*.la",
|
||||
"*.a"
|
||||
],
|
||||
"modules" : [
|
||||
{
|
||||
"name": "dconf",
|
||||
"buildsystem": "meson",
|
||||
"config-opts": [
|
||||
"-Dbash_completion=false",
|
||||
"-Dman=false",
|
||||
"-Dsystemduserunitdir=' '"
|
||||
],
|
||||
"cleanup": [
|
||||
"/include",
|
||||
"/lib/pkgconfig",
|
||||
"/libexec",
|
||||
"/share/dbus-1"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://download.gnome.org/sources/dconf/0.40/dconf-0.40.0.tar.xz",
|
||||
"sha256": "cf7f22a4c9200421d8d3325c5c1b8b93a36843650c9f95d6451e20f0bcb24533"
|
||||
},
|
||||
{
|
||||
"type": "patch",
|
||||
"path": "build-aux/dconf-override.patch"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "scripts",
|
||||
"buildsystem": "simple",
|
||||
"build-commands": [
|
||||
"install -Dm 755 start-breezy-desktop.sh /app/bin/start-breezy-desktop"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "file",
|
||||
"path": "build-aux/start-breezy-desktop.sh"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"name" : "breezydesktop",
|
||||
"builddir" : true,
|
||||
"buildsystem" : "meson",
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "dir",
|
||||
"path" : "."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[Desktop Entry]
|
||||
Name=Breezy Desktop
|
||||
Exec=start-breezy-desktop
|
||||
Exec=breezydesktop
|
||||
Icon=com.xronlinux.BreezyDesktop
|
||||
Terminal=false
|
||||
Type=Application
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue