Compare commits

..
130 Commits
Author SHA1 Message Date
founta 00bc179655 Add space reset to openvr actions (#475)
* Add space reset to openvr actions

* remove additional reset state storage
2026-03-28 14:44:14 +09:00
oo8dev a4115f5e4b Merge pull request #478 from wayvr-org/move-doc
docs: move out docs to a separate repo/website, fix typos
2026-03-25 18:39:59 +00:00
Aleksander 6c896bb956 fix typo 2026-03-25 19:39:20 +01:00
galister d9c8689c18 docs move: continuation
Updated links and references to the new GitHub organization.
2026-03-26 03:33:45 +09:00
Aleksander 5df6ce93f8 docs: move out docs to a separate repo/website, fix typos
[skip ci]
2026-03-24 00:19:27 +01:00
Earthgames ee4bb5ca29 Allow the checkbox to be themed (#462) 2026-03-23 12:24:16 +09:00
hare_ware b89ae4726c Revert "fix bindings for wmr controllers"
This reverts commit 285f6db134.
2026-03-23 12:23:01 +09:00
galister b0bbc25083 dont die if autostart app cant be started 2026-03-20 12:48:52 +09:00
Craig McLure 635df298fe Updated the pipewire reference in Cargo.lock 2026-03-18 22:22:00 +09:00
galister 786847cc2f update pipewire-rs to fix build on arch 2026-03-18 12:31:42 +09:00
Aleksander d9f89faf33 wayvr: "Fix floor" countdown timer and sound
- 5-second timeout sound with countdown timer
- sort locale JSON
- modify toast lerp amount
2026-03-16 13:47:51 +09:00
galister 769978560e oops 2026-03-16 13:46:23 +09:00
galister bebc39e766 dbus notify timeout is ms 2026-03-16 13:38:10 +09:00
oo8dev bb15a4e867 Merge pull request #466 from wlx-team/toast-mp3-update
update toast.mp3 sound
2026-03-14 12:23:30 +00:00
Aleksander 84015c7972 update toast.mp3 sound
[skip ci]
2026-03-14 13:20:48 +01:00
galister f2c34fba8f sticky modifier keys explanation in README 2026-03-11 10:44:01 +09:00
Earthgames 1a74eb1507 Use a more common name 2026-03-08 01:18:35 +09:00
Earthgames 6b3f8a7b42 Only convert locale one time 2026-03-08 01:18:35 +09:00
Earthgames ad78fdab24 Hack in full lang codes
Add British
2026-03-08 01:18:35 +09:00
Earthgames 12ceebec6d Used locale in chrono 2026-03-08 01:18:35 +09:00
Earthgames 6f9ca5b3b7 Added documentation for default colors 2026-03-06 12:23:50 +09:00
oo8dev c54b211872 Merge pull request #460 from wlx-team/defaults-globals-refactor
wgui: separate globals from themes
2026-03-05 21:55:46 +00:00
Aleksander cb899235b4 wgui: separate globals and themes 2026-03-05 19:28:42 +01:00
Aleksander a83af3d833 translations 2026-03-05 12:42:04 +01:00
galister e8c8a67fc0 add wiki links to readme 2026-03-03 02:52:51 +09:00
Earthgames 2b4a0b6a0d Changed old link to the new one 2026-03-01 13:53:49 +09:00
galister 5ffa5e59bf skybox cleanups 2026-02-28 13:33:54 +09:00
galister ed8ca1e068 fix copy-paste fail causing stuck images 2026-02-28 13:33:27 +09:00
galister f21776b123 box CompositionLayerColorScaleBiasKHR 2026-02-28 13:10:02 +09:00
Torge Matthies ab3f873a38 fix grid opacity not updating live 2026-02-27 12:30:27 +09:00
oo8dev de6047107e Merge pull request #450 from openglfreak/feat-grid-opacity
add option for grid opacity
2026-02-25 21:14:11 +01:00
Torge Matthies 39152b8548 add option for grid opacity 2026-02-25 20:59:17 +01:00
Kresny b517afc379 Rebind toggle_dashboard and show_hide (#449) 2026-02-25 14:58:30 +09:00
oo8dev b84d565b1e Merge pull request #443 from wlx-team/feat-editbox
Editbox, wgui fixes, doc
2026-02-21 12:23:49 +01:00
Sapphire 46f3a54203 don't block inputs for headless sessions 2026-02-21 14:13:31 +09:00
Sapphire 4afaa6d048 reduce indentations in block_inputs 2026-02-21 14:13:31 +09:00
Sapphire 26f078d512 unblock inputs on exit 2026-02-21 14:13:31 +09:00
Aleksander 124d817752 fix logic bug in push_scissor_stack 2026-02-16 20:33:43 +01:00
Aleksander 2ddb419676 editbox keyboard input, scrollbars fix (scissoring broken atm), clippy 2026-02-14 22:20:51 +01:00
Aleksander 841241a7e6 wgui: Editbox basics, component focus, minor refactoring 2026-02-14 19:24:36 +01:00
Aleksander c902f0cd44 wgui: widgets.md: document tabs 2026-02-14 19:24:36 +01:00
Aleksander 756c42609d use SlotMap 2026-02-14 16:04:36 +01:00
Aleksander 4fc439abe2 uidev: fix color formats
Current implementation picks up the first available color format, which could be HDR (A2R10G10B10_UNORM_PACK32 in my case), but we don't have any color profiles. Stick back to SDR-only instead.
2026-02-14 10:18:41 +01:00
oo8dev 9685576272 Merge pull request #438 from wlx-team/feat-language-selector
Settings: Language selector, "Requires restart" info
2026-02-13 08:33:32 +01:00
galister d2f01c06ec Add Open Collective link 2026-02-13 13:29:53 +09:00
Aleksander 94c36076af Language selector and "requires restart" info 2026-02-12 20:53:06 +01:00
galister a4134030fe Release 26.2.1 2026-02-11 02:58:18 +09:00
Aleksander ebacbf175a Update lang
[skip ci]
2026-02-10 17:59:27 +01:00
Sefa Eyeoglu 6c987b4492 Add Nix package to README (#432)
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2026-02-10 21:29:01 +09:00
SpookySkeletons 8acb2236bd fix: delete hand bindings from openxr_actions.json5 (#429)
* fix: delete hand bindings from openxr_actions.json5

Presumably fixes handtracking causing laser offsets to tear off of controllers when hands switch to and from handtrack.

* Comment out fallback controller
2026-02-10 17:20:35 +09:00
Sapphire 5dae6f8387 fix openxr aspect ratio calculation (#430) 2026-02-10 17:20:07 +09:00
Sapphire 5ab242f8e0 fix size of set buttons (#431) 2026-02-10 17:19:51 +09:00
galister fcbb5fab73 update workflow for vendor tarball 2026-02-09 02:38:16 +09:00
galister f9a57e58bb Release 26.2.0 2026-02-09 02:34:31 +09:00
Sapphire d713302d0d add option to block poses when using keyboard (OpenXR only) 2026-02-08 01:13:56 +09:00
Sapphire d398e6fb5a update libmonado and use better input blocking when available 2026-02-08 01:13:56 +09:00
Sapphire 903a6b351c allow hotswitch between 12h and 24h clock for keyboard (#426) 2026-02-07 10:21:47 +09:00
galister b3e09b330f screen.frag: force alpha to 1.0 2026-02-06 10:56:33 +09:00
dependabot[bot] c63089b944 Bump time from 0.3.44 to 0.3.47
Bumps [time](https://github.com/time-rs/time) from 0.3.44 to 0.3.47.
- [Release notes](https://github.com/time-rs/time/releases)
- [Changelog](https://github.com/time-rs/time/blob/main/CHANGELOG.md)
- [Commits](https://github.com/time-rs/time/compare/v0.3.44...v0.3.47)

---
updated-dependencies:
- dependency-name: time
  dependency-version: 0.3.47
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-06 09:55:25 +09:00
Sapphire ca770c1c05 disable grabbing for watch in default state
watch should only be grabbable in edit mode
2026-02-06 09:54:52 +09:00
galister ac65bca05a only write non-default attributes to state 2026-02-05 11:55:03 +09:00
Sapphire e61fd66210 remove libmonado active client workaround 2026-02-05 10:25:27 +09:00
Sapphire 1dc7d4340c better filtering for monado app switcher 2026-02-05 10:25:27 +09:00
galister a22bb2bf1a KHR_composition_layer_color_scale_bias instead of raster alpha (#407) 2026-02-04 09:39:57 +09:00
dependabot[bot] e1c72fa446 Bump bytes from 1.11.0 to 1.11.1 (#419)
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.11.0 to 1.11.1.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.11.0...v1.11.1)

---
updated-dependencies:
- dependency-name: bytes
  dependency-version: 1.11.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-04 09:39:21 +09:00
galister 676a96b2cd fix KeySymbol font size 2026-02-02 12:56:20 +09:00
oo8dev 4821123c73 Merge pull request #417 from wlx-team/staging
dash-frontend: UX improvements
2026-01-28 10:47:37 +01:00
galister 32c8b7ae62 uidev: query surface format + color space from gpu 2026-01-28 11:25:18 +09:00
Aleksander d97bbfc796 dash-frontend: games: pagination 2026-01-27 19:49:27 +01:00
Aleksander 19083cfd83 dash-frontend: Top panel title 2026-01-27 19:49:27 +01:00
oo8dev 2c60196ead Merge pull request #416 from wlx-team/staging
wgui: perf: Scissor render culling
2026-01-27 17:53:26 +01:00
Aleksander b17de39ef0 wgui: perf: scissor render culling
Greatly increases rendering performance and minimizes drawcall count for large lists.
2026-01-27 00:36:23 +01:00
ZokuTe 46e54db969 Fix: Refine locale matching logic to support region-specific tags (#411)
* wgui(i18n): Fix language matching logic

* wgui(i18n): Fix locale prefix match
2026-01-25 03:22:59 +00:00
galister 554029aacf fix dropdowns being stuck open; multi button events 2026-01-25 12:21:57 +09:00
galister a5146e0396 fix color bias behavior 2026-01-25 11:44:42 +09:00
galister 6960652379 reset playspace button in settings 2026-01-25 11:44:17 +09:00
galister 3ec1dd7f4e mouse-motion-only handsfree modes 2026-01-25 11:43:44 +09:00
oo8dev 157c88127f Merge pull request #412 from wlx-team/staging
Update ovr_overlay
2026-01-24 15:24:45 +01:00
Aleksander 18e628f083 Update ovr_overlay 2026-01-24 14:32:40 +01:00
ZokuTe ab83d44a5e i18n: add support for zh_CN locale (#409) 2026-01-23 01:30:40 +00:00
galister fa6492a422 fix build without openxr feature 2026-01-22 16:16:59 +09:00
galister 160e84120d fix monado no-layer bug 2026-01-22 01:14:04 +09:00
galister c222c25ddf angle fade (partial, need monado fix) 2026-01-22 01:00:44 +09:00
galister ee8391a45f refactor skybox & passthru realtime switching 2026-01-21 18:26:18 +09:00
Sapphire 3ac6f70725 allow toggling skybox during runtime 2026-01-21 03:47:20 +00:00
Sapphire d23b058d0e allow toggling passthrough during runtime 2026-01-21 03:47:20 +00:00
Orion 37fde4c642 scale grab offset together with the overlay/anchor (#404)
fixes #397
2026-01-21 02:22:12 +00:00
Sapphire 2ade8c542e fix active modifier border color not sticking on unhover (#405) 2026-01-21 02:21:27 +00:00
Aleksander 03a1f449b5 Running games list (Closes #398) 2026-01-18 03:20:29 +00:00
Aleksander 7b3a2a1e48 UI gradient intensity slider, update wgui Defaults for dashboard, prepend ui-related config entries with ui_ 2026-01-18 03:20:29 +00:00
Aleksander dabd122a1d translations, minor refactoring, wgui: gradient intensity in globals, dash-frontend: remove unused window_list, process_list and window_options 2026-01-18 03:20:29 +00:00
Orion 0181119393 input blocking improvements (#399)
* move input blocking hover logic into InteractionState

* add per-window input blocking setting

* OpenVR: per-hand input blocking

* move block_input setting into OverlayWindowState
2026-01-18 03:09:22 +00:00
Orion 2e1d07abc2 fix 2D scroll in apps spawned inside wayvr (#401) 2026-01-18 02:00:31 +00:00
Jay fe61319fc2 OSC: Change ::OscSend format and restore String support to Button Actions. (#388)
* OscSend: support strings poc
- change value delimiter to `;`
- default convert values to String when not converted to another type

* add `_arg<n>="<value>"` format instead of `;` delimiter
that is, vrchat chatbox is controlled like `_press="::OscSend /chatbox/input" _arg0="${send}" _arg1="true" _arg2="true"` now

old format still supported as shorthand, with same "strings can't have spaces" limit as before. `_arg<n>` are appended after these.

* fix accidentally resetting `osc_args` to empty between formats

* update readme to document `::OscSend` paramter-form

* clean up, use `while let` instead of `while match`

* merge `parse_osc_value` into while condition

* remove second log from shortform arg parsing
2026-01-16 02:13:44 +00:00
galister da644c97d3 Fix readme formatting 2026-01-15 12:34:30 +00:00
galister b67914b956 expand vars in paths 2026-01-15 20:47:43 +09:00
Kresny e4caa1d6d4 Fix typos,improve clarity remove Homebrew in README.md (#392)
* Fix typos and improve clarity in README.md

Also replaced wlx with wayvr in build instructions

* Remove Homebrew
2026-01-15 09:13:03 +00:00
galister ea62be8ad7 openvr lines 2026-01-15 18:11:41 +09:00
galister 6ab1db9a76 fix openvr lines 2026-01-15 14:32:36 +09:00
galister cd0d49eaf6 steamvr is broken completely, not just steam link 2026-01-15 02:31:31 +00:00
galister a97ee2cee2 wayvrctl switch-set 2026-01-14 15:01:01 +09:00
galister 9d43068271 adjust mouse for stereo 2026-01-14 14:24:14 +09:00
oo8dev c7ebb7492e Merge pull request #390 from wlx-team/staging
Tooltip improvements
2026-01-13 18:08:38 +01:00
Aleksander c5356724fd Tooltip fade-in animations, implement tooltip for CheckBox and Slider, use FnOnce for layout tasks 2026-01-13 17:51:35 +01:00
galister d02efc2657 always visible checkbox 2026-01-13 23:59:03 +09:00
galister 40cd532134 add help for handsfree mode 2026-01-13 20:00:43 +09:00
galister 869c0ba5e2 bindings for eye + pinch 2026-01-13 19:23:04 +09:00
galister fd24060d7b handsfree mode 2026-01-13 19:15:51 +09:00
Orion 1318f23947 task bar: toggle overlays on right click (#385) 2026-01-13 01:28:16 +00:00
galister d2385fd3b2 exported images to have dedicated allocations 2026-01-12 22:27:26 +09:00
Jay 7059a85742 Re-implement custom audio files support. (#379)
* reimplement custom audio loading for `toast` and `key_click` using `from_mp3`

* run cargo fmt

* `try_bytes_from_config`: output with `log::trace` when file cannot be opened

* rewrite `try_bytes_from_config`

* use file `read_to_end`, log categories

* edit `register_wgui_samples`

* rework audio functions for loading custom wgui sounds
oh hey, it works!

* clean up

* allow custom `startup` and `app_start` sounds
these sounds are loaded on-demand and never registered; this behaviour is unchanged

* edit `bytes_from_config` outputs

* use return value of `read_to_end` instead of `len()` for reported file size

* implement suggested changes
- remove now-unused `register_mp3_sample_from_assets` function
- replace implementation of `try_bytes_from_config`
  - missing the `real_path` context

* swap out `context`s for `inspect_err`s with closures to output `real_path`

* clean up `audio.rs`
- remove unused import
- unify capitalisation + quotes in output messages.
2026-01-12 12:42:03 +00:00
Orion 2e5dcd62c1 add missing test_button checks in button.rs (#384) 2026-01-12 04:16:29 +00:00
galister 72e64ad965 Update documentation for sprite and image widgets
Added emphasis on setting width and height for sprite and image widgets.
2026-01-12 04:07:59 +00:00
galister 0e004e7b3f fix some button actions missing filters 2026-01-12 12:17:30 +09:00
oo8dev 91bc46defe Merge pull request #382 from wlx-team/feat-dash-tabbed-settings
dash-frontend: Tabbed settings, minor fixes
2026-01-11 19:45:26 +01:00
oo8dev b8f266ea6a Merge pull request #383 from BERADQ/chinese/1-11
Add Chinese (Simplified) translation
2026-01-11 19:24:53 +01:00
galister a33d4ec9d0 log svg loads 2026-01-12 02:32:45 +09:00
ZokuTeandAmos Wong 4c3500ea16 chore(i18n): Fix typo in Chinese (Simplified) translation
Co-authored-by: Amos Wong <8733840+amoshydra@users.noreply.github.com>
2026-01-12 01:10:33 +08:00
BERADQ bc1c993e17 chore(i18n): Add Chinese (Simplified) translation 2026-01-11 23:24:08 +08:00
galister 3889c9d2ea fix stereo on wayvr overlays 2026-01-11 23:38:35 +09:00
Aleksander 8eda46fb5e update logo 2026-01-11 15:05:23 +01:00
Aleksander a0451408aa wgui: fix possible panic 2026-01-11 14:59:26 +01:00
Aleksander 84d4fb7cc2 Tabbed settings (Closes #355) 2026-01-11 14:41:47 +01:00
amoshydra b48320c7bc feat: use contextual label for full frame 3d base on stereo mode
show Full-SBS when stereo is LeftRight or RightLeft
show Full-TAB when stereo is TopBottom
show Full-BAT when stereo is BottomTop
2026-01-11 12:03:45 +00:00
amoshydra ce5191ddd1 feat: add full frame 3d support
Related to #346
2026-01-11 12:03:45 +00:00
Aleksander 37e3ab1bda dash-frontend: Scrollable audio device list (Closes #353), wgui: fix scrollbar rendering 2026-01-11 11:11:01 +01:00
Aleksander 6b98d5f188 openxr: Fix 1.0 click threshold (Closes #374), wgi: less aggressive scrolling 2026-01-11 10:45:45 +01:00
oo8dev f059c5668a Merge pull request #373 from wlx-team/staging
Add Italian translations
2026-01-10 21:41:53 +01:00
Aleksander e7fc7be950 Add Italian translations
[skip ci]
2026-01-10 21:40:38 +01:00
galister 6136fae885 Remove button label update instructions from README
Removed section about updating button label from stdout in README.
2026-01-10 17:15:41 +00:00
187 changed files with 6512 additions and 3866 deletions

No files matched your search

+1
View File
@@ -0,0 +1 @@
open_collective: wlx-team
+6 -7
View File
@@ -36,10 +36,9 @@ jobs:
cargo build --release
- name: Make tarball
run: |
pip install portage pycargoebuild
wget https://github.com/gentoo/gentoo/raw/refs/heads/master/metadata/license-mapping.conf
mkdir dist
pycargoebuild --distdir dist --license-mapping license-mapping.conf --crate-tarball --crate-tarball-path wayvr-crates.tar.xz
cargo vendor > vendor-config.toml
mv vendor-config.toml vendor
tar --xz -cf vendor.tar.xz vendor
- name: Create Release
id: create_release
uses: actions/create-release@v1
@@ -81,12 +80,12 @@ jobs:
asset_name: WayVR-${{ github.ref_name }}-x86_64.AppImage
asset_content_type: application/octet-stream
- name: Upload crates tarball
- name: Upload vendor tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_KEY }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./wayvr/wayvr-crates.tar.xz
asset_name: WayVR-${{ github.ref_name }}-crates.tar.xz
asset_path: ./wayvr/vendor.tar.xz
asset_name: vendor.tar.xz
asset_content_type: application/x-gtar
Generated
+38 -122
View File
@@ -143,16 +143,6 @@ dependencies = [
"libc",
]
[[package]]
name = "annotate-snippets"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccaf7e9dfbb6ab22c82e473cd1a8a7bd313c19a5b7e40970f3d89ef5a5c9e81e"
dependencies = [
"unicode-width 0.1.14",
"yansi-term",
]
[[package]]
name = "anstream"
version = "0.6.21"
@@ -683,26 +673,20 @@ checksum = "f09c37bc0e9f0924b7dae9988265ef3c76c88538f41a3b06caf4bed07cee5226"
[[package]]
name = "bindgen"
version = "0.69.5"
version = "0.72.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
dependencies = [
"annotate-snippets",
"bitflags 2.10.0",
"cexpr",
"clang-sys",
"itertools 0.12.1",
"lazy_static",
"lazycell",
"log",
"prettyplease",
"itertools 0.10.5",
"proc-macro2",
"quote",
"regex",
"rustc-hash 1.1.0",
"rustc-hash 2.1.1",
"shlex",
"syn 2.0.113",
"which",
]
[[package]]
@@ -812,9 +796,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
[[package]]
name = "bytes"
version = "1.11.0"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
[[package]]
name = "calloop"
@@ -935,6 +919,7 @@ dependencies = [
"iana-time-zone",
"js-sys",
"num-traits",
"pure-rust-locales",
"wasm-bindgen",
"windows-link 0.2.1",
]
@@ -2277,15 +2262,6 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "home"
version = "0.5.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"
dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "hound"
version = "3.5.1"
@@ -2677,15 +2653,6 @@ dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.13.0"
@@ -2828,12 +2795,6 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "lazycell"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "lebe"
version = "0.5.3"
@@ -2893,12 +2854,10 @@ checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"
[[package]]
name = "libmonado"
version = "1.3.2"
source = "git+https://github.com/technobaboo/libmonado-rs.git?rev=26292e5b14663ee2f089f66f0851438a0c00ee67#26292e5b14663ee2f089f66f0851438a0c00ee67"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0df3183760954d877b894d42f5c6954837d8a7d7bd5f042409c4175afeaf24ea"
dependencies = [
"bindgen",
"cmake",
"convert_case 0.6.0",
"dlopen2",
"flagset",
"libc",
@@ -2923,7 +2882,7 @@ dependencies = [
[[package]]
name = "libspa"
version = "0.8.0"
source = "git+https://gitlab.freedesktop.org/galister/pipewire-rs.git?rev=ba32202c3c391004c3bb533b58fa75a50e47ff57#ba32202c3c391004c3bb533b58fa75a50e47ff57"
source = "git+https://gitlab.freedesktop.org/galister/pipewire-rs.git?rev=6ef2cd1af41e5e8844c63c37ea9a01f0758079b0#6ef2cd1af41e5e8844c63c37ea9a01f0758079b0"
dependencies = [
"bitflags 2.10.0",
"cc",
@@ -2939,7 +2898,7 @@ dependencies = [
[[package]]
name = "libspa-sys"
version = "0.8.0"
source = "git+https://gitlab.freedesktop.org/galister/pipewire-rs.git?rev=ba32202c3c391004c3bb533b58fa75a50e47ff57#ba32202c3c391004c3bb533b58fa75a50e47ff57"
source = "git+https://gitlab.freedesktop.org/galister/pipewire-rs.git?rev=6ef2cd1af41e5e8844c63c37ea9a01f0758079b0#6ef2cd1af41e5e8844c63c37ea9a01f0758079b0"
dependencies = [
"bindgen",
"cc",
@@ -3302,9 +3261,9 @@ dependencies = [
[[package]]
name = "num-conv"
version = "0.1.0"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050"
[[package]]
name = "num-derive"
@@ -3817,7 +3776,7 @@ dependencies = [
[[package]]
name = "ovr_overlay"
version = "0.0.0"
source = "git+https://github.com/galister/ovr_overlay_oyasumi?rev=8d62c73d5f17e4210d6d0cd52e7f3953eb9b481a#8d62c73d5f17e4210d6d0cd52e7f3953eb9b481a"
source = "git+https://github.com/galister/ovr_overlay_oyasumi?rev=e477bd2a9e04293ea68c1e7529ef2cb131f32acc#e477bd2a9e04293ea68c1e7529ef2cb131f32acc"
dependencies = [
"byteorder",
"derive_more",
@@ -3832,7 +3791,7 @@ dependencies = [
[[package]]
name = "ovr_overlay_sys"
version = "0.0.0"
source = "git+https://github.com/galister/ovr_overlay_oyasumi?rev=8d62c73d5f17e4210d6d0cd52e7f3953eb9b481a#8d62c73d5f17e4210d6d0cd52e7f3953eb9b481a"
source = "git+https://github.com/galister/ovr_overlay_oyasumi?rev=e477bd2a9e04293ea68c1e7529ef2cb131f32acc#e477bd2a9e04293ea68c1e7529ef2cb131f32acc"
dependencies = [
"autocxx",
"autocxx-build",
@@ -4016,7 +3975,7 @@ dependencies = [
[[package]]
name = "pipewire"
version = "0.8.0"
source = "git+https://gitlab.freedesktop.org/galister/pipewire-rs.git?rev=ba32202c3c391004c3bb533b58fa75a50e47ff57#ba32202c3c391004c3bb533b58fa75a50e47ff57"
source = "git+https://gitlab.freedesktop.org/galister/pipewire-rs.git?rev=6ef2cd1af41e5e8844c63c37ea9a01f0758079b0#6ef2cd1af41e5e8844c63c37ea9a01f0758079b0"
dependencies = [
"anyhow",
"bitflags 2.10.0",
@@ -4032,7 +3991,7 @@ dependencies = [
[[package]]
name = "pipewire-sys"
version = "0.8.0"
source = "git+https://gitlab.freedesktop.org/galister/pipewire-rs.git?rev=ba32202c3c391004c3bb533b58fa75a50e47ff57#ba32202c3c391004c3bb533b58fa75a50e47ff57"
source = "git+https://gitlab.freedesktop.org/galister/pipewire-rs.git?rev=6ef2cd1af41e5e8844c63c37ea9a01f0758079b0#6ef2cd1af41e5e8844c63c37ea9a01f0758079b0"
dependencies = [
"bindgen",
"libspa-sys",
@@ -4208,6 +4167,12 @@ dependencies = [
"syn 2.0.113",
]
[[package]]
name = "pure-rust-locales"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "869675ad2d7541aea90c6d88c81f46a7f4ea9af8cd0395d38f11a95126998a0d"
[[package]]
name = "pxfm"
version = "0.1.27"
@@ -5516,30 +5481,30 @@ dependencies = [
[[package]]
name = "time"
version = "0.3.44"
version = "0.3.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d"
checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c"
dependencies = [
"deranged",
"itoa",
"num-conv",
"powerfmt",
"serde",
"serde_core",
"time-core",
"time-macros",
]
[[package]]
name = "time-core"
version = "0.1.6"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b"
checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca"
[[package]]
name = "time-macros"
version = "0.2.24"
version = "0.2.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3"
checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215"
dependencies = [
"num-conv",
"time-core",
@@ -5837,7 +5802,7 @@ dependencies = [
"log",
"rust-embed",
"tracing-subscriber",
"vulkano 0.35.2 (git+https://github.com/galister/vulkano.git?rev=cf7f92867928a56ce16b376037c1120f2b167678)",
"vulkano",
"vulkano-shaders",
"wgui",
"winit",
@@ -5995,35 +5960,6 @@ dependencies = [
"xml-rs",
]
[[package]]
name = "vulkano"
version = "0.35.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee487adf7c13e5aa46d4d7fac6ffb8e172eb7e6472aaf815e9ade4992f8f2414"
dependencies = [
"ash",
"bytemuck",
"crossbeam-queue",
"foldhash 0.1.5",
"half",
"heck 0.4.1",
"indexmap 2.12.1",
"libloading 0.8.9",
"nom 7.1.3",
"once_cell",
"parking_lot",
"proc-macro2",
"quote",
"raw-window-handle",
"raw-window-metal",
"serde",
"serde_json",
"slabbin",
"smallvec",
"thread_local",
"vk-parse",
]
[[package]]
name = "vulkano"
version = "0.35.2"
@@ -6076,7 +6012,7 @@ dependencies = [
"quote",
"shaderc",
"syn 2.0.113",
"vulkano 0.35.2 (registry+https://github.com/rust-lang/crates.io-index)",
"vulkano",
]
[[package]]
@@ -6330,7 +6266,7 @@ dependencies = [
[[package]]
name = "wayvr"
version = "26.1.2"
version = "26.2.1"
dependencies = [
"anyhow",
"ash",
@@ -6357,6 +6293,7 @@ dependencies = [
"mint",
"openxr",
"ovr_overlay",
"pure-rust-locales",
"regex",
"rosc",
"rust-embed",
@@ -6374,7 +6311,7 @@ dependencies = [
"tracing",
"tracing-subscriber",
"uuid",
"vulkano 0.35.2 (git+https://github.com/galister/vulkano.git?rev=cf7f92867928a56ce16b376037c1120f2b167678)",
"vulkano",
"vulkano-shaders",
"wayland-client",
"wayvr-ipc",
@@ -6404,7 +6341,7 @@ dependencies = [
[[package]]
name = "wayvrctl"
version = "26.1.2"
version = "26.2.1"
dependencies = [
"anyhow",
"clap",
@@ -6466,22 +6403,10 @@ dependencies = [
"slotmap",
"smallvec",
"taffy",
"vulkano 0.35.2 (git+https://github.com/galister/vulkano.git?rev=cf7f92867928a56ce16b376037c1120f2b167678)",
"vulkano",
"vulkano-shaders",
]
[[package]]
name = "which"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
dependencies = [
"either",
"home",
"once_cell",
"rustix 0.38.44",
]
[[package]]
name = "widestring"
version = "1.2.1"
@@ -7177,15 +7102,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"
[[package]]
name = "yansi-term"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe5c30ade05e61656247b2e334a031dfd0cc466fadef865bdcdea8d537951bf1"
dependencies = [
"winapi",
]
[[package]]
name = "yazi"
version = "0.2.1"
+4 -2
View File
@@ -33,6 +33,9 @@ members = [
]
resolver = "3"
[patch.crates-io]
vulkano = { git = "https://github.com/galister/vulkano.git", rev = "cf7f92867928a56ce16b376037c1120f2b167678" }
[workspace.dependencies]
anyhow = "1.0.100"
glam = { version = "0.30.9", features = ["mint", "serde"] }
@@ -47,8 +50,7 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1.0.145"
slotmap = "1.1.1"
strum = { version = "0.27.2", features = ["derive"] }
#vulkano = { version = "0.35.2", default-features = false, features = [
vulkano = { git = "https://github.com/galister/vulkano.git", rev = "cf7f92867928a56ce16b376037c1120f2b167678", default-features = false, features = [
vulkano = { version = "0.35.2", default-features = false, features = [
"macros",
] }
vulkano-shaders = "0.35.0"
+49 -37
View File
@@ -1,20 +1,20 @@
![WayVR splash screen header](https://github.com/wlx-team/wayvr/blob/guide/wayvr-readme-header.webp?raw=true)
![WayVR splash screen header](https://github.com/wayvr-org/wayvr/blob/guide/wayvr-readme-header.webp?raw=true)
# WayVR (previously WlxOverlay-S)
A lightweight OpenXR/OpenVR overlay for Wayland and X11 desktops.
WayVR lets you to access your desktop screens while in VR, and even launch apps directly in VR.
WayVR lets you access your desktop screens while in VR, and even launch apps directly in VR.
In comparison to similar overlays, WayVR aims to run alongside VR games and experiences while having as little performance impact as possible. The UI appearance and rendering techniques are kept as simple and efficient as possible, while still allowing a high degree of customizability.
![Screenshot of WayVR being used as an OpenXR home environment](https://github.com/wlx-team/wayvr/blob/guide/wayvr-readme-screenshot.webp?raw=true)
![Screenshot of WayVR being used as an OpenXR home environment](https://github.com/wayvr-org/wayvr/blob/guide/wayvr-readme-screenshot.webp?raw=true)
## Join the Linux VR Community
We are available on either **Discord** or **Matrix space**:
[![LVRA Discord](https://img.shields.io/discord/1065291958328758352?style=for-the-badge&logo=discord)](https://discord.gg/EHAYe3tTYa) [![LVRA Matrix](https://img.shields.io/matrix/linux-vr-adventures:matrix.org?logo=matrix&style=for-the-badge)](https://matrix.to/#/#linux-vr-adventures:matrix.org)
[![LVRA Discord](https://img.shields.io/discord/1065291958328758352?style=for-the-badge/&logo=discord)](https://discord.gg/EHAYe3tTYa) [![LVRA Matrix](https://img.shields.io/matrix/linux-vr-adventures:matrix.org?logo=matrix&style=for-the-badge)](https://matrix.to/#/#linux-vr-adventures:matrix.org)
Questions/issues specific to WayVR will be handled in the `wayvr` chat room. Feel free to ask anything.
@@ -24,14 +24,10 @@ Questions/issues specific to WayVR will be handled in the `wayvr` chat room. Fee
There are multiple ways to install WayVR:
1. AppImage: Download from [Releases](https://github.com/wlx-team/wayvr/releases)
1. AUR package: [wayvr](https://aur.archlinux.org/packages/wayvr) or [wayvr-git](https://aur.archlinux.org/packages/wayvr-git)
1. Homebrew:
- Add AtomicXR tap: `brew tap matrixfurry.com/atomicxr https://tangled.sh/@matrixfurry.com/homebrew-atomicxr`
- Install WayVR: `brew install wlx-overlay-s`
1. [Building from source](https://github.com/wlx-team/wayvr/wiki/Building-from-Source).
1. AppImage: Download from [Releases](https://github.com/wayvr-org/wayvr/releases)
1. AUR package: [wayvr](https://aur.archlinux.org/packages/wayvr) or [wayvr-git](https://aur.archlinux.org/packages/wayvr-git)
1. Nix package: [wayvr](https://search.nixos.org/packages?channel=unstable&show=wayvr&query=wayvr) or [unstable package from nixpkgs-xr](https://github.com/nix-community/nixpkgs-xr)
1. [Docs: Building from source](https://wayvr.org/docs/basics/building-from-source/).
### General Setup
@@ -44,7 +40,7 @@ There are multiple ways to install WayVR:
For users specifically running **SteamVR via Steam Flatpak**, follow these steps:
1. Grab the latest AppImage from [Releases](https://github.com/wlx-team/wayvr/releases).
1. Grab the latest AppImage from [Releases](https://github.com/wayvr-org/wayvr/releases).
1. `WayVR-*.AppImage --appimage-extract`
1. `chmod +x squashfs-root/AppRun`
1. Move the newly created `squashfs-root` folder to a location accessible by the Steam Flatpak.
@@ -60,15 +56,15 @@ For users specifically running **SteamVR via Steam Flatpak**, follow these steps
In case screens were selected in the wrong order:
- Go to Settings and press `Clear PipeWire tokens` and then `Restart software`
- Pay attention to your notifications, it tells you in which order to pick the screens.
- If notifications don't show, try start WayVR from the terminal and look for instructions in there.
- Pay attention to your notifications, which tell you in which order to pick the screens.
- If notifications don't show, try starting WayVR from the terminal and look for instructions in there.
**WiVRn users**: Select WayVR from the `Application` drop-down. If there's no such entry, select `Custom` and browse to your WayVR executable or AppImage.
**Envision users**: Go to the Plugins menu and select the WayVR plugin. This will download and run the AppImage version of the overlay.
In order to run a standalone installation (for instance from the AUR), create a bash script containing `wayvr --openxr --show` and then set this bash script as a custom Envision plugin.
To run a standalone installation (for instance, from the AUR), create a bash script containing `wayvr --openxr --show` and then set this bash script as a custom Envision plugin.
This will show a home environment with headset passthrough by default or a [customizable background](https://github.com/wlx-team/wayvr/wiki/OpenXR-Skybox)!
This will show a home environment with headset passthrough enabled by default or a [customizable background](https://wayvr.org/docs/various/openxr-skybox/)!
**SteamVR users**: WayVR will register itself for auto-start, so there is no need to start it every time. Disclaimer: SteamVR will sometimes disregard this and not start WayVR anyway.
@@ -78,7 +74,7 @@ This will show a home environment with headset passthrough by default or a [cust
### Working Set
The working set consists of all currently selected overlays; screens, mirrors, keyboard, etc.
The working set consists of all currently selected overlays: screens, mirrors, keyboard, etc.
The working set appears in front of the headset when shown, and can be re-centered by hiding and showing again.
@@ -108,17 +104,17 @@ Check your left wrist for the watch. The watch is the primary tool for controlli
The top of the watch shows device batteries, and the bottom shows your overlay controls.
Enter edit mode (leftmost button on bottom) to edit your overlay sets.
Enter edit mode (the leftmost button at the bottom) to edit your overlay sets.
While in edit mode, the watch can also be grabbed, and passed between your hands.
While in edit mode, the watch can also be grabbed and passed between your hands.
After grabbing, the watch will automatically attach to the hand that's opposite from the one that held it.
In edit mode, try hovering other overlays to see their advanced options!
In edit mode, try hovering over other overlays to see their advanced options!
### The screens
Hovering a pointer over a screen will move the mouse. If there are more than one pointers hovering a screen, the pointer that was last used to click will take precedence.
Hovering a pointer over a screen will move the mouse. If more than one pointer is hovering over a screen, the pointer that was last used to click will take precedence.
The click type depends on the laser color:
@@ -132,29 +128,45 @@ The click type depends on the laser color:
Typing
- Use the BLUE laser when typing regularly.
- While using ORANGE laser, all keystrokes will have SHIFT applied.
- While using the ORANGE laser, all keystrokes will have SHIFT applied.
- Purple laser is customizable via the settings, no modifier by default.
**Modifier Keys** are sticky. They will remain pressed until a non-modifier key is pressed, the modifier gets toggled off, or the keyboard gets hidden.
**Modifier Keys are sticky**. They will remain pressed until either:
- a non-modifier key is pressed
- the modifier is toggled off by clicking again
- the keyboard is hidden (including via show-hide)
### Default Bindings
![Index Controller Bindings](https://github.com/wlx-team/wayvr/blob/guide/wlx-index.png)
![Index Controller Bindings](https://github.com/wayvr-org/wayvr/blob/guide/wlx-index.png)
![Touch Controller Bindings](https://github.com/wlx-team/wayvr/blob/guide/wlx-oculus.png)
![Touch Controller Bindings](https://github.com/wayvr-org/wayvr/blob/guide/wlx-oculus.png)
To customize bindings on OpenXR, refer to the [OpenXR Bindings wiki page](https://github.com/wlx-team/wayvr/wiki/OpenXR-Bindings).
### Changing Bindings
If your bindings are not supported, please reach out. \
SteamVR: Simply change the bindings from the SteamVR bindings section. If WayVR doesn't show up on the list, select any other title and then press back on the top left. (SteamVR is weird like that sometimes)
OpenXR (Monado/WiVRn): See [Docs: OpenXR Bindings](https://wayvr.org/docs/various/openxr-bindings/)
If your controllers are not supported, please reach out. \
We would like to work with you and include additional bindings.
## Customization
See these relevant wiki pages:
- For all available config options, check [Docs: Configuration](https://wayvr.org/docs/basics/configuration/)
- Looking to customize look & feel, or add functionality? See [Docs: Customization](https://wayvr.org/docs/basics/customization/)
- Looking to change the OpenXR background? See [Docs: OpenXR Skybox](https://wayvr.org/docs/various/openxr-skybox/)
## Troubleshooting
When an error is detected, we often print tips for fixing into the log file.
When an error is detected, we often print tips for fixing it into the log file.
Logs will be at `/tmp/wayvr.log` for most distros.
Check [here](https://github.com/wlx-team/wayvr/wiki/Troubleshooting) for tips.
Check [here](https://wayvr.org/docs/various/troubleshooting/) for tips.
## Known Issues
@@ -163,8 +175,8 @@ Check [here](https://github.com/wlx-team/wayvr/wiki/Troubleshooting) for tips.
If the mouse is moving on a completely different screen, the screens were likely selected in the wrong order:
- Go to Settings and press `Clear PipeWire tokens` and then `Restart software`
- Pay attention to your notifications, it tells you in which order to pick the screens.
- If notifications don't show, try start WayVR from the terminal and look for instructions in there.
- Pay attention to your notifications, which tell you in which order to pick the screens.
- If notifications don't show, try starting WayVR from the terminal and look for instructions in there.
COSMIC desktop:
@@ -176,23 +188,23 @@ X11 users:
- DPI scaling is not supported and will mess with the mouse.
- Upright screens are not supported and will mess with the mouse.
### Screens are blank or black or frozen on Steam Link
### Screens are blank or black or frozen on SteamVR 2.14+
As of SteamVR version 2.14.x, PipeWire capture no longer works when using Steam Link.
We're unable to completely troubleshoot how and why Steam Link interferes with PipeWire, so consider the following workarounds for the time being:
We're unable to completely troubleshoot how and why SteamVR interferes with PipeWire, so consider the following workarounds for the time being:
- Use another streamer, such as WiVRn or ALVR
- Use another streamer, such as WiVRn or ALVR. Note that SteamVR on Linux is considered experimental by Valve themselves [disclaimer](https://github.com/ValveSoftware/SteamVR-for-Linux?tab=readme-ov-file#steamvr-release-notes-and-known-issues).
- If your desktop [supports ScreenCopy](https://wayland.app/protocols/wlr-screencopy-unstable-v1#compositor-support), go to Settings and set `Wayland capture method` to `ScreenCopy`
- If your desktop has an X11 mode, try using that
### Modifiers get stuck
Hiding the keyboard will un-press all of its buttons. Alternatively, go to Settings and use the `Restart software` button.
Hiding the keyboard will unpress all of its buttons. Alternatively, go to Settings and use the `Restart software` button.
### X11 limitations
- X11 capture can generally seem slow. This is because zero-copy GPU capture is not supported on the general X11 desktop. Consider trying Wayland.
- DPI scaling is not supported and may cause the mouse to not follow the laser properly.
- Upright screens are not supported and can cause the mouse to not follow the laser properly.
- Screen changes (connecting / disconnecting a display, resolution changes, etc) are not handled at runtime. Restart the overlay for these to take effect.
- Screen changes (connecting/disconnecting a display, resolution changes, etc) are not handled at runtime. Restart the overlay for these to take effect.
@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><!-- Icon from Material Symbols by Google - https://github.com/google/material-design-icons/blob/master/LICENSE -->
<path fill="currentColor" d="m10 18l-6-6l6-6l1.4 1.45L7.85 11H20v2H7.85l3.55 3.55z" />
</svg>

After

Width:  |  Height:  |  Size: 294 B

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><!-- Icon from Material Symbols by Google - https://github.com/google/material-design-icons/blob/master/LICENSE -->
<path fill="currentColor" d="m14 18l-1.4-1.45L16.15 13H4v-2h12.15L12.6 7.45L14 6l6 6z" />
</svg>

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

@@ -1,110 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="30"
height="30"
viewBox="0 0 7.9375004 7.9375004"
version="1.1"
id="svg1"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
sodipodi:docname="dashboard_logo.svg"
inkscape:export-filename="dashboard_logo.png"
inkscape:export-xdpi="409.60001"
inkscape:export-ydpi="409.60001"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="true"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="16"
inkscape:cx="11.8125"
inkscape:cy="16.78125"
inkscape:window-width="1836"
inkscape:window-height="1185"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="layer1"
showgrid="true"
showguides="false">
<inkscape:grid
id="grid2"
units="mm"
originx="0"
originy="0"
spacingx="0.26458333"
spacingy="0.26458333"
empcolor="#0099e5"
empopacity="0.30196078"
color="#0099e5"
opacity="0.14901961"
empspacing="5"
enabled="true"
visible="true" />
</sodipodi:namedview>
<defs
id="defs1">
<linearGradient
id="linearGradient1"
inkscape:collect="always">
<stop
style="stop-color:#ad70ff;stop-opacity:1;"
offset="0"
id="stop1" />
<stop
style="stop-color:#00ffff;stop-opacity:1;"
offset="0.99844205"
id="stop2" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1"
id="linearGradient2"
x1="0"
y1="8.4666653"
x2="8.4664993"
y2="0"
gradientUnits="userSpaceOnUse"
gradientTransform="scale(0.93751843,0.93750002)" />
</defs>
<g
inkscape:label="back"
inkscape:groupmode="layer"
id="layer1">
<rect
style="font-variation-settings:'wght' 700;fill:url(#linearGradient2);stroke-width:0.468754;stroke-linecap:round;stroke-linejoin:round"
id="rect1"
width="7.9380002"
height="7.9375"
x="0"
y="0"
rx="1.5874999"
ry="1.5874999" />
<path
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1.05833;stroke-linecap:butt;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
d="m 1.5874998,3.7041664 v 1.3229167 h 1.3229166 v 1.3229165 l 1.3229165,-1e-7"
id="path3"
sodipodi:nodetypes="ccccc" />
<path
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1.05833;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
d="M 1.5874998,2.6458332 V 1.5875 c 3.1749997,-2e-7 4.7624995,1.5874997 4.7624995,4.7624995 H 5.2916661"
id="path4"
sodipodi:nodetypes="cccc" />
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="front"
style="stroke-width:2.11667;stroke-dasharray:none" />
</svg>

Before

Width:  |  Height:  |  Size: 3.4 KiB

+29 -26
View File
@@ -3,6 +3,7 @@
<theme>
<var key="side_size" value="48" />
<var key="top_size" value="40" />
<var key="side_sprite_size" value="26" />
<var key="side_button_size" value="48" />
</theme>
@@ -25,13 +26,6 @@
</template>
<elements>
<div position="absolute" width="100%" justify_content="space_between">
<div />
<div padding="6">
<Button id="btn_close" sprite_src_builtin="dashboard/close.svg" color="#000000" border="2" border_color="~color_faded" />
</div>
</div>
<!-- left/right separator (menu and rest) -->
<div flex_direction="row" gap="8" width="100%" height="100%" padding="4" interactable="0">
<!-- LEFT MENU -->
@@ -55,21 +49,34 @@
<SideButton id="btn_side_apps" src_builtin="dashboard/apps.svg" tooltip="APPLICATIONS" tooltip_side="right" />
<SideButton id="btn_side_games" src_builtin="dashboard/games.svg" tooltip="GAMES" tooltip_side="right" />
<SideButton id="btn_side_monado" src_builtin="dashboard/monado.svg" tooltip="MONADO_RUNTIME" tooltip_side="right" />
<!-- SideButton id="btn_side_processes" src_builtin="dashboard/window.svg" tooltip="PROCESSES" tooltip_side="right" /-->
<rectangle height="2" color="#FFFFFF33" width="~side_sprite_size" />
<SideButton id="btn_side_settings" src_builtin="dashboard/settings.svg" tooltip="SETTINGS" tooltip_side="right" />
</rectangle>
</div>
<!-- REST -->
<!-- content/bottom panel separator -->
<!-- top/content/bottom panel separator -->
<div
flex_direction="column"
gap="8"
width="100%"
height="100%"
overflow_x="scroll">
<!-- CONTENT -->
<!-- TOP PANEL -->
<div position="relative" width="100%" height="~top_size" min_height="~top_size" max_height="~top_size" justify_content="end">
<!-- Title bar -->
<div width="100%" align_items="center" justify_content="center">
<rectangle min_width="300" height="100%" consume_mouse_events="1" round="100%" color="~color_top_panel" align_items="center" justify_content="center" gap="8">
<sprite id="sprite_titlebar_icon" width="24" height="24" />
<label id="label_titlebar_title" weight="bold" size="16" text="Title" />
</rectangle>
</div>
<!-- Close button -->
<Button position="absolute" id="btn_close" color="~color_top_panel" round="100%" width="~top_size" height="~top_size" tooltip="CLOSE_WINDOW" tooltip_side="left">
<sprite src_builtin="dashboard/close.svg" width="32" height="32" />
</Button>
</div>
<!-- CONTENT -->
<!-- color and color2 alpha will be modified at runtime -->
<rectangle
id="rect_content"
@@ -86,22 +93,18 @@
position="absolute" width="100%" height="100%"
gradient="radial" color="#44BBFF11" color2="#00000000" />
<div
id="content"
flex_direction="column"
overflow_x="scroll"
overflow_y="scroll"
padding_top="8"
padding_bottom="8"
padding_left="16"
padding_right="16"
gap="8"
width="100%"
min_height="100%"
>
<!-- filled-in at runtime -->
<div overflow_x="scroll" overflow_y="scroll" width="100%" height="100%">
<div
id="content"
flex_direction="column"
padding="16"
gap="8"
width="100%"
height="100%"
>
<!-- filled-in at runtime -->
</div>
</div>
<div position="absolute" id="popup_manager" width="100%" height="100%" />
</rectangle>
<!-- BOTTOM PANEL -->
@@ -151,4 +154,4 @@
</div>
</div>
</elements>
</layout>
</layout>
-3
View File
@@ -1,5 +1,4 @@
<layout>
<include src="t_tab_title.xml" />
<include src="../theme.xml" />
<template name="AppEntry">
@@ -25,7 +24,6 @@
</template>
<elements>
<TabTitle translation="APPLICATIONS" icon="dashboard/apps.svg" />
<!-- placeholders for now -->
<!--
<div gap="4" align_items="center">
@@ -46,7 +44,6 @@
flex_direction="row"
flex_wrap="wrap"
gap="4"
overflow_y="scroll"
/>
</elements>
</layout>
+2 -4
View File
@@ -1,8 +1,6 @@
<layout>
<include src="t_tab_title.xml" />
<elements>
<TabTitle translation="GAMES" icon="dashboard/games.svg" />
<div id="game_list_parent" align_items="center" />
<div id="running_games_list_parent" align_self="center" />
<div id="game_list_parent" align_items="center" flex_direction="column" gap="8" />
</elements>
</layout>
+2 -3
View File
@@ -8,7 +8,7 @@
align_items="center"
flex_grow="1"
gap="24">
<sprite src_builtin="dashboard/wayvr_dashboard.svg" width="96" height="96" />
<sprite src_builtin="dashboard/wayvr_dashboard.png" width="96" height="96" />
<label id="label_hello" size="32" weight="bold" />
<!-- main button list -->
@@ -16,9 +16,8 @@
<MenuButton id="btn_apps" icon="dashboard/apps.svg" translation="APPLICATIONS" />
<MenuButton id="btn_games" icon="dashboard/games.svg" translation="GAMES" />
<MenuButton id="btn_monado" icon="dashboard/monado.svg" text="Monado" />
<!--MenuButton id="btn_processes" icon="dashboard/window.svg" translation="PROCESSES" /-->
<MenuButton id="btn_settings" icon="dashboard/settings.svg" translation="SETTINGS" />
</div>
</div>
</elements>
</layout>
</layout>
+1 -4
View File
@@ -1,8 +1,6 @@
<layout>
<include src="t_tab_title.xml" />
<include src="../t_group_box.xml" />
<!-- key: str, value: str -->
<template name="BoolFlag">
<div flex_direction="row" gap="4">
@@ -27,11 +25,10 @@
</template>
<elements>
<TabTitle translation="MONADO_RUNTIME" icon="dashboard/monado.svg" />
<label translation="DISPLAY_BRIGHTNESS" />
<Slider id="slider_brightness" width="300" height="24" min_value="0" max_value="140" />
<label translation="LIST_OF_PROCESSES" />
<label translation="PROCESS_LIST" />
<div id="list_parent" flex_direction="column" gap="8">
<!-- filled at runtime -->
</div>
@@ -1,10 +0,0 @@
<layout>
<include src="t_tab_title.xml" />
<elements>
<TabTitle translation="LIST_OF_WINDOWS" icon="dashboard/window.svg" />
<div id="window_list_parent" />
<TabTitle translation="LIST_OF_PROCESSES" icon="dashboard/cpu.svg" />
<div id="process_list_parent" />
</elements>
</layout>
+16 -8
View File
@@ -1,5 +1,4 @@
<layout>
<include src="t_tab_title.xml" />
<include src="../t_group_box.xml" />
<include src="../t_dropdown_button.xml" />
@@ -28,7 +27,7 @@
</template>
<template name="DangerButton">
<Button id="${id}" color="#AA3333" height="32" tooltip="${translation}_HELP" padding="4" gap="8" >
<Button id="${id}" color="#AA3333" height="32" tooltip="${translation}_HELP" padding="4" gap="8">
<sprite src_builtin="${icon}" height="24" width="24" />
<label align="left" translation="${translation}" weight="bold" min_width="200" />
</Button>
@@ -36,17 +35,26 @@
<template name="AutostartApp">
<div id="${id}_root" flex_direction="row">
<Button id="${id}" color="#AA3333" height="24" padding="4" margin_top="-2" margin_bottom="-2" >
<Button id="${id}" color="#AA3333" height="24" padding="4" margin_top="-2" margin_bottom="-2">
<sprite src_builtin="dashboard/close.svg" height="20" width="20" />
</Button>
<div padding_left="8" >
<label align="left" text="${text}" weight="bold" overflow="hidden"/>
<div padding_left="8">
<label align="left" text="${text}" weight="bold" overflow="hidden" />
</div>
</div>
</template>
<elements>
<TabTitle translation="SETTINGS" icon="dashboard/settings.svg" />
<div flex_wrap="wrap" justify_content="stretch" gap="4" id="settings_root" />
<div gap="4">
<Tabs id="tabs">
<Tab name="look_and_feel" translation="APP_SETTINGS.LOOK_AND_FEEL" sprite_src_builtin="dashboard/palette.svg" />
<Tab name="features" translation="APP_SETTINGS.FEATURES" sprite_src_builtin="dashboard/options.svg" />
<Tab name="controls" translation="APP_SETTINGS.CONTROLS" sprite_src_builtin="dashboard/controller.svg" />
<Tab name="misc" translation="APP_SETTINGS.MISC" sprite_src_builtin="dashboard/blocks.svg" />
<Tab name="autostart_apps" translation="APP_SETTINGS.AUTOSTART_APPS" sprite_src_builtin="dashboard/apps.svg" />
<Tab name="troubleshooting" translation="APP_SETTINGS.TROUBLESHOOTING" sprite_src_builtin="dashboard/cpu.svg" />
</Tabs>
<div flex_wrap="wrap" justify_content="stretch" gap="4" id="settings_root" width="100%" />
</div>
</elements>
</layout>
</layout>
@@ -1,9 +0,0 @@
<layout>
<!-- translation, icon -->
<template name="TabTitle">
<div gap="8" align_items="center">
<sprite src_builtin="${icon}" width="24" height="24" />
<label translation="${translation}" size="18" weight="bold" />
</div>
</template>
</layout>
+1
View File
@@ -2,6 +2,7 @@
<theme>
<var key="color_menu_dark" value="#0A0A0ACC" />
<var key="color_accent" value="#008cff" />
<var key="color_top_panel" value="#00000099" />
<var key="color_bottom_panel" value="#141e28" />
</theme>
</layout>
@@ -37,18 +37,18 @@
<Separator />
<label translation="APP_LAUNCHER.ASPECT_TITLE" />
<RadioGroup id="radio_orientation" flex_direction="row" gap="16">
<RadioBox translation="APP_LAUNCHER.ASPECT.WIDE" value="Wide" tooltip="16:9" checked="1" />
<RadioBox translation="APP_LAUNCHER.ASPECT.SEMI_WIDE" value="SemiWide" tooltip="3:2" />
<RadioBox translation="APP_LAUNCHER.ASPECT.SQUARE" value="Square" tooltip="1:1" />
<RadioBox translation="APP_LAUNCHER.ASPECT.SEMI_TALL" value="SemiTall" tooltip="2:3" />
<RadioBox translation="APP_LAUNCHER.ASPECT.TALL" value="Tall" tooltip="9:16" />
<RadioBox translation="APP_LAUNCHER.ASPECT.WIDE" value="Wide" tooltip_str="16:9" checked="1" />
<RadioBox translation="APP_LAUNCHER.ASPECT.SEMI_WIDE" value="SemiWide" tooltip_str="3:2" />
<RadioBox translation="APP_LAUNCHER.ASPECT.SQUARE" value="Square" tooltip_str="1:1" />
<RadioBox translation="APP_LAUNCHER.ASPECT.SEMI_TALL" value="SemiTall" tooltip_str="2:3" />
<RadioBox translation="APP_LAUNCHER.ASPECT.TALL" value="Tall" tooltip_str="9:16" />
</RadioGroup>
<!-- Separator /> // saved settings override this, so let's hide it for now
<label translation="APP_LAUNCHER.POS_TITLE" />
<RadioGroup id="radio_pos" flex_direction="row" gap="16">
<RadioBox translation="APP_LAUNCHER.POS.FLOATING" value="Floating" tooltip="APP_LAUNCHER.POS.FLOATING_HELP" />
<RadioBox translation="APP_LAUNCHER.POS.ANCHORED" value="Anchored" tooltip="APP_LAUNCHER.POS.ANCHORED_HELP" checked="1" />
<RadioBox translation="APP_LAUNCHER.POS.STATIC" value="Static" tooltip="APP_LAUNCHER.POS.STATIC_HELP" />
<RadioBox translation="APP_LAUNCHER.POS.FLOATING" value="Floating" tooltip_str="APP_LAUNCHER.POS.FLOATING_HELP" />
<RadioBox translation="APP_LAUNCHER.POS.ANCHORED" value="Anchored" tooltip_str="APP_LAUNCHER.POS.ANCHORED_HELP" checked="1" />
<RadioBox translation="APP_LAUNCHER.POS.STATIC" value="Static" tooltip_str="APP_LAUNCHER.POS.STATIC_HELP" />
</RadioGroup -->
<Separator />
<div flex_direction="row" justify_content="space_between" gap="16">
@@ -61,4 +61,4 @@
</div>
</div>
</elements>
</layout>
</layout>
@@ -46,23 +46,25 @@
</template>
<elements>
<div id="devices" flex_direction="column" gap="4">
<div flex_direction="column" gap="4">
<div id="devices" flex_direction="column" gap="4" max_height="400" overflow_y="scroll">
</div>
</div>
<!-- bottom buttons -->
<div flex_direction="row" gap="4">
<Button
id="btn_auto"
sprite_src_builtin="dashboard/magic_wand.svg"
min_width="32"
tooltip="AUDIO.AUTO_SWITCH_TO_VR_AUDIO"
color="~color_accent"
tooltip_side="right" />
<!-- bottom buttons -->
<div flex_direction="row" gap="4">
<Button
id="btn_auto"
sprite_src_builtin="dashboard/magic_wand.svg"
min_width="32"
tooltip="AUDIO.AUTO_SWITCH_TO_VR_AUDIO"
color="~color_accent"
tooltip_side="right" />
<BottomButton id="btn_sinks" src_builtin="dashboard/volume.svg" translation="AUDIO.SPEAKERS" />
<BottomButton id="btn_sources" src_builtin="dashboard/microphone.svg" translation="AUDIO.MICROPHONES" />
<BottomButton id="btn_cards" src_builtin="dashboard/cpu.svg" translation="AUDIO.CARDS" />
<BottomButton id="btn_sinks" src_builtin="dashboard/volume.svg" translation="AUDIO.SPEAKERS" />
<BottomButton id="btn_sources" src_builtin="dashboard/microphone.svg" translation="AUDIO.MICROPHONES" />
<BottomButton id="btn_cards" src_builtin="dashboard/cpu.svg" translation="AUDIO.CARDS" />
</div>
</div>
</elements>
</layout>
+8 -3
View File
@@ -1,7 +1,12 @@
<layout>
<include src="../t_group_box.xml" />
<elements>
<div id="list_parent" gap="8" flex_direction="row" flex_wrap="wrap" justify_content="center" />
<div flex_direction="column" padding_top="8" padding_bottom="8">
<div id="list_parent" gap="8" flex_direction="row" flex_wrap="wrap" justify_content="center" />
</div>
<div align_items="center" justify_content="center" gap="16">
<Button id="btn_prev" sprite_src_builtin="dashboard/arrow_left.svg" width="32" height="32" />
<label id="label_page" text="Page X" weight="bold" />
<Button id="btn_next" sprite_src_builtin="dashboard/arrow_right.svg" width="32" height="32" />
</div>
</elements>
</layout>
@@ -1,9 +0,0 @@
<layout>
<include src="../t_group_box.xml" />
<elements>
<rectangle macro="group_box" flex_direction="row" align_items="center">
<div id="list_parent" gap="8" flex_direction="column" flex_wrap="wrap" flex_grow="1" />
</rectangle>
</elements>
</layout>
@@ -0,0 +1,20 @@
<layout>
<include src="../t_group_box.xml" />
<template name="RunningGameCell">
<rectangle macro="group_box" flex_direction="row">
<Button id="btn_stop" sprite_src_builtin="dashboard/remove_circle.svg" tooltip="PROCESS.STOP" />
<Button id="btn_kill" sprite_src_builtin="dashboard/knife.svg" tooltip="PROCESS.FORCE_KILL" />
<label id="label_name" weight="bold" />
</rectangle>
</template>
<elements>
<div align_items="center" gap="8">
<Button id="btn_refresh" tooltip="REFRESH" width="32" height="32" sprite_src_builtin="dashboard/refresh.svg" />
<sprite src_builtin="dashboard/cpu.svg" width="24" height="24" />
<label translation="GAME_LIST.RUNNING_GAMES_LIST" />
</div>
<div id="list_parent" gap="8" />
</elements>
</layout>
+27 -15
View File
@@ -4,14 +4,12 @@
"APPLICATIONS": "Anwendungen",
"GAMES": "Spiele",
"SETTINGS": "Einstellungen",
"PROCESSES": "Prozesse",
"HELLO_USER": "Hallo, {USER}!",
"GENERAL_SETTINGS": "Allgemeine Einstellungen",
"APPLICATION_LAUNCHER": "Anwendung Launcher",
"APP_SETTINGS": {
"HIDE_USERNAME": "Benutzernamen ausblenden",
"OPAQUE_BACKGROUND": "Undurchsichtiger Hintergrund",
"WLX": {},
"LOOK_AND_FEEL": "Aussehen und Verhalten",
"HIDE_GRAB_HELP": "Greif-Hilfe ausblenden",
"ANIMATION_SPEED": "UI-Animationsgeschwindigkeit",
@@ -76,9 +74,25 @@
"PIPEWIRE_HELP": "Schnelle GPU-Erfassung,\nStandard auf allen Desktops.",
"PW_FALLBACK_HELP": "Langsame Methode mit hoher CPU-Auslastung.\nVersuchen Sie es, falls PipeWire GPU nicht funktioniert.",
"SCREENCOPY_GPU_HELP": "Schnell, keine Bildschirmfreigabe-Popups.\nFunktioniert mit: Hyprland, Niri, River, Sway",
"SCREENCOPY_HELP": "Langsam, keine Bildschirmfreigabe-Popups.\nFunktioniert mit: Hyprland, Niri, River, Sway"
"SCREENCOPY_HELP": "Langsam, keine Bildschirmfreigabe-Popups.\nFunktioniert mit: Hyprland, Niri, River, Sway",
"NONE": "Keine",
"HMD_PINCH": "HMD + Kneifen",
"EYE_PINCH": "Auge + Kneifen",
"EYE_ONLY": "Nur Auge",
"HMD_ONLY": "Nur HMD"
},
"AUTOSTART_APPS": "Anwendungen, die beim Start ausgeführt werden sollen"
"AUTOSTART_APPS": "Anwendungen, die beim Start ausgeführt werden sollen",
"HANDSFREE_POINTER": "Freihändige Modus",
"HANDSFREE_POINTER_HELP": "Eingabe, die bei Bewegung\nder Controller verwendet wird, wenn diese nicht verfügbar sind.\nLinkes Kneifen greift, rechtes klickt.",
"UI_GRADIENT_INTENSITY": "UI-Verlaufsintensität",
"RESET_PLAYSPACE": "Spielbereich zurücksetzen",
"RESET_PLAYSPACE_HELP": "Den Abstand des Spielbereichs zurücksetzen.",
"BLOCK_POSES_ON_KBD_INTERACTION": "Posen beim Interagieren mit der Tastatur blockieren",
"BLOCK_POSES_ON_KBD_INTERACTION_HELP": "Verhindert, dass das Spiel Posen empfängt, wenn die Tastatur angefahren wird und „Spieleingabe blockieren“ aktiviert ist",
"LANGUAGE": "Sprache",
"REQUIRES_RESTART": "Erfordert Neustart",
"GRID_OPACITY": "Bodenraster-Undurchsichtigkeit",
"GRID_OPACITY_HELP": "Undurchsichtigkeit des Bodenrasters, wenn der Skybox aktiviert ist"
},
"HELLO": "Hallo!",
"AUDIO": {
@@ -98,7 +112,6 @@
"ACTIONS": {
"RECENTER_PLAYSPACE": "Playspace neu zentrieren"
},
"LIST_OF_PROCESSES": "Prozessliste",
"POPUP_ADD_DISPLAY": {
"RESOLUTION": "Auflösung"
},
@@ -107,19 +120,12 @@
"HIDE": "Verbergen",
"REMOVE": "Entfernen",
"SHOW": "Anzeigen",
"PROCESS_LIST": {
"NO_PROCESSES_FOUND": "Keine Prozesse gefunden",
"LOCATED_ON": "auf",
"TERMINATE_PROCESS_NAMED_X": "Prozess \"{PROCESS_NAME}\" beenden"
},
"FAILED_TO_LAUNCH_APPLICATION": "Fehler beim Starten der Anwendung:",
"NO_WINDOWS_FOUND": "Keine Fenster gefunden",
"WINDOW_OPTIONS": "Fensteroptionen",
"APPLICATION_STARTED": "Anwendung gestartet",
"LIST_OF_WINDOWS": "Fensterliste",
"CLOSE_WINDOW": "Fenster schließen",
"GAME_LIST": {
"NO_GAMES_FOUND": "Keine Spiele gefunden"
"NO_GAMES_FOUND": "Keine Spiele gefunden",
"RUNNING_GAMES_LIST": "Liste der laufenden Spiele"
},
"TERMINATE_PROCESS": "Prozess beenden",
"GAME_LAUNCHED": "Spiel gestartet",
@@ -149,5 +155,11 @@
"AUTOSTART": "Automatisch beim Start ausführen",
"LAUNCH": "Starten"
},
"DISPLAY_BRIGHTNESS": "Bildschirmhelligkeit"
"DISPLAY_BRIGHTNESS": "Bildschirmhelligkeit",
"PROCESS_LIST": "Prozessliste",
"REFRESH": "Aktualisieren",
"PROCESS": {
"STOP": "Stopp",
"FORCE_KILL": "Erzwinge Beenden"
}
}
+26 -13
View File
@@ -31,10 +31,13 @@
"APP_SETTINGS": {
"ALLOW_SLIDING": "Stick interaction during grab",
"ANIMATION_SPEED": "UI Animation speed",
"AUTOSTART_APPS": "Apps to run on startup",
"BLOCK_GAME_INPUT": "Block game input",
"BLOCK_GAME_INPUT_HELP": "Blocks all input when an overlay is hovered",
"BLOCK_GAME_INPUT_IGNORE_WATCH": "Ignore watch when blocking input",
"BLOCK_GAME_INPUT_IGNORE_WATCH_HELP": "Do not block input when watch is hovered",
"BLOCK_POSES_ON_KBD_INTERACTION": "Block poses when interacting with keyboard",
"BLOCK_POSES_ON_KBD_INTERACTION_HELP": "Blocks the game from receiving poses when the keyboard is hovered and 'Block game input' is enabled",
"CAPTURE_METHOD": "Wayland screen capture",
"CAPTURE_METHOD_HELP": "Try changing this if you are\nexperiencing black or glitchy screens",
"CLEAR_PIPEWIRE_TOKENS": "Clear PipeWire tokens",
@@ -51,6 +54,8 @@
"DOUBLE_CURSOR_FIX_HELP": "Enable this if you see 2 cursors",
"FEATURES": "Features",
"FOCUS_FOLLOWS_MOUSE_MODE": "Mouse move on trigger touch",
"HANDSFREE_POINTER": "Handsfree mode",
"HANDSFREE_POINTER_HELP": "Input to use when motion\ncontrollers are unavailable.\nLeft pinch is grab, right is click.",
"HIDE_GRAB_HELP": "Hide grab help",
"HIDE_USERNAME": "Hide username",
"INVERT_SCROLL_DIRECTION_X": "Invert horizontal scroll direction",
@@ -58,6 +63,7 @@
"KEYBOARD_MIDDLE_CLICK": "Keyboard middle click",
"KEYBOARD_MIDDLE_CLICK_HELP": "Modifier to use when typing\nwith purple laser",
"KEYBOARD_SOUND_ENABLED": "Keyboard sounds",
"LANGUAGE": "Language",
"LEFT_HANDED_MOUSE": "Left-handed mouse",
"LEFT_HANDED_MOUSE_HELP": "Use this if mouse buttons are swapped",
"LONG_PRESS_DURATION": "Long press duration",
@@ -69,12 +75,20 @@
"OPTION": {
"AUTO": "Automatic",
"AUTO_HELP": "ScreenCopy GPU if supported,\notherwise PipeWire GPU.",
"EYE_ONLY": "Eye only",
"EYE_PINCH": "Eye + pinch",
"HMD_ONLY": "HMD only",
"HMD_PINCH": "HMD + pinch",
"NONE": "None",
"PIPEWIRE_HELP": "Fast GPU capture,\nstandard on all desktops.",
"PW_FALLBACK_HELP": "Slow method with high CPU usage.\nTry in case PipeWire GPU doesn't work",
"SCREENCOPY_GPU_HELP": "Fast, no screen share popups.\nWorks on: Hyprland, Niri, River, Sway",
"SCREENCOPY_HELP": "Slow, no screen share popups.\nWorks on: Hyprland, Niri, River, Sway"
},
"POINTER_LERP_FACTOR": "Pointer smoothing",
"REQUIRES_RESTART": "Requires restart",
"RESET_PLAYSPACE": "Reset playspace",
"RESET_PLAYSPACE_HELP": "Clear the stage space offset.",
"RESTART_SOFTWARE": "Restart software",
"RESTART_SOFTWARE_HELP": "Apply settings that require a restart",
"ROUND_MULTIPLIER": "UI Edge roundness",
@@ -86,18 +100,20 @@
"SPACE_DRAG_UNLOCKED": "Allow space drag on all axes",
"SPACE_ROTATE_UNLOCKED": "Allow space rotate on all axes",
"TROUBLESHOOTING": "Troubleshooting",
"UI_GRADIENT_INTENSITY": "UI Gradient intensity",
"UPRIGHT_SCREEN_FIX": "Upright screen fix",
"UPRIGHT_SCREEN_FIX_HELP": "Fixes upright screens on some desktops",
"USE_PASSTHROUGH": "Enable passthrough",
"USE_PASSTHROUGH_HELP": "Allow passthrough if the XR runtime supports it",
"USE_SKYBOX": "Enable skybox",
"USE_SKYBOX_HELP": "Show a skybox if there's no scene app or passthrough",
"GRID_OPACITY": "Floor grid opacity",
"GRID_OPACITY_HELP": "Opacity of the floor grid when the skybox is enabled",
"XR_CLICK_SENSITIVITY": "XR click sensitivity",
"XR_CLICK_SENSITIVITY_HELP": "Analog trigger sensitivity",
"XR_CLICK_SENSITIVITY_RELEASE": "XR release sensitivity",
"XR_CLICK_SENSITIVITY_RELEASE_HELP": "Must be lower than click",
"XWAYLAND_BY_DEFAULT": "Run apps in Compatibility mode by default",
"AUTOSTART_APPS": "Apps to run on startup"
"XWAYLAND_BY_DEFAULT": "Run apps in Compatibility mode by default"
},
"APPLICATION_LAUNCHER": "Application launcher",
"APPLICATION_STARTED": "Application started",
@@ -121,7 +137,8 @@
"FAILED_TO_LAUNCH_APPLICATION": "Failed to launch a application:",
"GAME_LAUNCHED": "Game launched",
"GAME_LIST": {
"NO_GAMES_FOUND": "No games found"
"NO_GAMES_FOUND": "No games found",
"RUNNING_GAMES_LIST": "List of running games"
},
"GAMES": "Games",
"GENERAL_SETTINGS": "General settings",
@@ -130,23 +147,19 @@
"HELLO_USER": "Hello, {USER}!",
"HIDE": "Hide",
"HOME_SCREEN": "Home",
"LIST_OF_PROCESSES": "Process list",
"LIST_OF_WINDOWS": "Window list",
"MONADO_RUNTIME": "Monado runtime",
"NO_WINDOWS_FOUND": "No windows found",
"POPUP_ADD_DISPLAY": {
"RESOLUTION": "Resolution"
},
"PROCESS_LIST": {
"LOCATED_ON": "on",
"NO_PROCESSES_FOUND": "No processes found",
"TERMINATE_PROCESS_NAMED_X": "Terminate process \"{PROCESS_NAME}\""
"PROCESS": {
"FORCE_KILL": "Force-kill",
"STOP": "Stop"
},
"PROCESSES": "Processes",
"PROCESS_LIST": "Process list",
"REFRESH": "Refresh",
"REMOVE": "Remove",
"SETTINGS": "Settings",
"SHOW": "Show",
"TERMINATE_PROCESS": "Terminate process",
"WIDTH": "Width",
"WINDOW_OPTIONS": "Window options"
"WIDTH": "Width"
}
+27 -15
View File
@@ -4,14 +4,12 @@
"APPLICATIONS": "Aplicaciones",
"GAMES": "Juegos",
"SETTINGS": "Ajustes",
"PROCESSES": "Procesos",
"HELLO_USER": "¡Hola, {USER}!",
"GENERAL_SETTINGS": "Ajustes generales",
"APPLICATION_LAUNCHER": "Lanzador de aplicaciones",
"APP_SETTINGS": {
"HIDE_USERNAME": "Ocultar nombre de usuario",
"OPAQUE_BACKGROUND": "Fondo opaco",
"WLX": {},
"LOOK_AND_FEEL": "Apariencia y estilo",
"HIDE_GRAB_HELP": "Ocultar ayuda para agarrar",
"ANIMATION_SPEED": "Velocidad de animación de la IU",
@@ -76,9 +74,25 @@
"PIPEWIRE_HELP": "Captura de GPU rápida,\nestándar en todos los escritorios.",
"PW_FALLBACK_HELP": "Método lento con alto uso de CPU.\nPruébalo si PipeWire GPU no funciona",
"SCREENCOPY_GPU_HELP": "Rápido, sin ventanas emergentes de uso compartido de pantalla.\nFunciona en: Hyprland, Niri, River, Sway",
"SCREENCOPY_HELP": "Lento, sin ventanas emergentes de uso compartido de pantalla.\nFunciona en: Hyprland, Niri, River, Sway"
"SCREENCOPY_HELP": "Lento, sin ventanas emergentes de uso compartido de pantalla.\nFunciona en: Hyprland, Niri, River, Sway",
"NONE": "Ninguno",
"HMD_PINCH": "HMD + pellizco",
"EYE_PINCH": "Ojo + pellizco",
"EYE_ONLY": "Solo ojo",
"HMD_ONLY": "Solo HMD"
},
"AUTOSTART_APPS": "Aplicaciones a ejecutar al inicio"
"AUTOSTART_APPS": "Aplicaciones a ejecutar al inicio",
"HANDSFREE_POINTER": "Modo manos libres",
"HANDSFREE_POINTER_HELP": "Entrada a utilizar cuando no\nestén disponibles los mandos de movimiento.\nPellizco con la izquierda para agarrar, con la derecha para hacer clic.",
"UI_GRADIENT_INTENSITY": "Intensidad del degradado de la IU",
"RESET_PLAYSPACE": "Restablecer espacio de juego",
"RESET_PLAYSPACE_HELP": "Borrar el desplazamiento del espacio de juego.",
"BLOCK_POSES_ON_KBD_INTERACTION": "Bloquear poses al interactuar con el teclado",
"BLOCK_POSES_ON_KBD_INTERACTION_HELP": "Bloquea que el juego reciba poses cuando el teclado está sobre él y 'Bloquear entrada del juego' está habilitado",
"LANGUAGE": "Idioma",
"REQUIRES_RESTART": "Requiere reinicio",
"GRID_OPACITY": "Opacidad de la cuadrícula del suelo",
"GRID_OPACITY_HELP": "Opacidad de la cuadrícula del suelo cuando el skybox está habilitado"
},
"HELLO": "¡Hola!",
"AUDIO": {
@@ -98,7 +112,6 @@
"ACTIONS": {
"RECENTER_PLAYSPACE": "Re-centrar espacio de juego"
},
"LIST_OF_PROCESSES": "Lista de procesos",
"POPUP_ADD_DISPLAY": {
"RESOLUTION": "Resolución"
},
@@ -107,19 +120,12 @@
"HIDE": "Ocultar",
"REMOVE": "Eliminar",
"SHOW": "Mostrar",
"PROCESS_LIST": {
"NO_PROCESSES_FOUND": "No se encontraron procesos",
"LOCATED_ON": "en",
"TERMINATE_PROCESS_NAMED_X": "Terminar proceso \"{PROCESS_NAME}\""
},
"FAILED_TO_LAUNCH_APPLICATION": "No se pudo iniciar la aplicación:",
"NO_WINDOWS_FOUND": "No se encontraron ventanas",
"WINDOW_OPTIONS": "Opciones de ventana",
"APPLICATION_STARTED": "Aplicación iniciada",
"LIST_OF_WINDOWS": "Lista de ventanas",
"CLOSE_WINDOW": "Cerrar ventana",
"GAME_LIST": {
"NO_GAMES_FOUND": "No se encontraron juegos"
"NO_GAMES_FOUND": "No se encontraron juegos",
"RUNNING_GAMES_LIST": "Lista de juegos en ejecución"
},
"TERMINATE_PROCESS": "Finalizar proceso",
"GAME_LAUNCHED": "Juego lanzado",
@@ -149,5 +155,11 @@
"AUTOSTART": "Ejecutar automáticamente al inicio",
"LAUNCH": "Iniciar"
},
"DISPLAY_BRIGHTNESS": "Brillo de la pantalla"
"DISPLAY_BRIGHTNESS": "Brillo de la pantalla",
"PROCESS_LIST": "Lista de procesos",
"REFRESH": "Actualizar",
"PROCESS": {
"STOP": "Detener",
"FORCE_KILL": "Forzar cierre"
}
}
+165
View File
@@ -0,0 +1,165 @@
{
"ACTIONS": {
"RECENTER_PLAYSPACE": "Recentra lo spazio di gioco"
},
"APP_LAUNCHER": {
"ASPECT": {
"SEMI_TALL": "Semi-alto",
"SEMI_WIDE": "Semi-ampio",
"SQUARE": "Quadrato",
"TALL": "Alto",
"WIDE": "Ampio"
},
"ASPECT_TITLE": "Proporzioni",
"AUTOSTART": "Avvia automaticamente all'avvio",
"LAUNCH": "Avvia",
"MODE": {
"CAGE": "Modalità compatibilità (Cage)",
"NATIVE": "Modalità nativa"
},
"POS": {
"ANCHORED": "Ancorato",
"ANCHORED_HELP": "Rimane fermo rispetto al marcatore centrale.",
"FLOATING": "Fluttuante",
"FLOATING_HELP": "Si muove in modo indipendente, si recentra quando viene mostrato.",
"STATIC": "Statico",
"STATIC_HELP": "Non fa parte di alcun set. Non recentra."
},
"POS_TITLE": "Posizionamento",
"RES_TITLE": "Risoluzione"
},
"APP_SETTINGS": {
"ALLOW_SLIDING": "Interazione tramite stick durante l'afferrare",
"ANIMATION_SPEED": "Velocità dell'animazione dell'interfaccia utente",
"BLOCK_GAME_INPUT": "Blocca l'input di gioco",
"BLOCK_GAME_INPUT_HELP": "Blocca tutti gli input quando il cursore è sopra un overlay",
"BLOCK_GAME_INPUT_IGNORE_WATCH": "Ignora il Watch quando si blocca l'input",
"BLOCK_GAME_INPUT_IGNORE_WATCH_HELP": "Non bloccare l'input quando il watch è evidenziato",
"CAPTURE_METHOD": "Acquisizione dello schermo Wayland",
"CAPTURE_METHOD_HELP": "Prova a modificare questa impostazione se riscontri schermate nere o con artefatti.",
"CLEAR_PIPEWIRE_TOKENS": "Cancella i token PipeWire",
"CLEAR_PIPEWIRE_TOKENS_HELP": "Richiedi la selezione dello schermo all'avvio successivo",
"CLEAR_SAVED_STATE": "Cancella stato salvato",
"CLEAR_SAVED_STATE_HELP": "Ripristina set e posizioni degli overlay",
"CLICK_FREEZE_TIME_MS": "Tempo di congelamento del click (ms)",
"CLICK_FREEZE_TIME_MS_HELP": "Aiuta con la precisione dei doppi clic",
"CLOCK_12H": "Orologio a 12 ore",
"CONTROLS": "Controlli",
"DELETE_ALL_CONFIGS": "Elimina configurazione",
"DELETE_ALL_CONFIGS_HELP": "Rimuovi tutti i file di configurazione da conf.d",
"DOUBLE_CURSOR_FIX": "Correzione doppio cursore",
"DOUBLE_CURSOR_FIX_HELP": "Abilita questa opzione se vedi 2 cursori",
"FEATURES": "Funzionalità",
"FOCUS_FOLLOWS_MOUSE_MODE": "Movimento del mouse al tocco del grilletto",
"HIDE_GRAB_HELP": "Nascondi l'aiuto per l'afferrare",
"HIDE_USERNAME": "Nascondi nome utente",
"INVERT_SCROLL_DIRECTION_X": "Inverti direzione dello scorrimento orizzontale",
"INVERT_SCROLL_DIRECTION_Y": "Inverti direzione dello scorrimento verticale",
"KEYBOARD_MIDDLE_CLICK": "Click centrale del tasto",
"KEYBOARD_MIDDLE_CLICK_HELP": "Modificatore da usare durante la digitazione\ncon laser viola",
"KEYBOARD_SOUND_ENABLED": "Suoni della tastiera",
"LEFT_HANDED_MOUSE": "Mouse per mancini",
"LEFT_HANDED_MOUSE_HELP": "Usalo se i pulsanti del mouse sono invertiti",
"LONG_PRESS_DURATION": "Durata pressione prolungata",
"LOOK_AND_FEEL": "Aspetto",
"MISC": "Varie",
"NOTIFICATIONS_ENABLED": "Abilita notifiche",
"NOTIFICATIONS_SOUND_ENABLED": "Suoni di notifica",
"OPAQUE_BACKGROUND": "Sfondo opaco",
"OPTION": {
"AUTO": "Automatico",
"AUTO_HELP": "Copia dello schermo tramite GPU se supportata,\naltrimenti tramite GPU PipeWire.",
"PIPEWIRE_HELP": "Acquisizione GPU veloce,\nstandard su tutti i desktop.",
"PW_FALLBACK_HELP": "Metodo lento con elevato utilizzo della CPU.\nProva in caso PipeWire GPU non funzioni",
"SCREENCOPY_GPU_HELP": "Veloce, senza popup di condivisione schermo.\nFunziona su: Hyprland, Niri, River, Sway",
"SCREENCOPY_HELP": "Lento, nessuna finestra pop-up per la condivisione dello schermo.\nFunziona su: Hyprland, Niri, River, Sway",
"NONE": "Nessuno",
"HMD_PINCH": "HMD + pizzico",
"EYE_PINCH": "Occhio + pizzico",
"EYE_ONLY": "Solo occhio",
"HMD_ONLY": "Solo HMD"
},
"POINTER_LERP_FACTOR": "Smussamento puntatore",
"RESTART_SOFTWARE": "Riavvia il software",
"RESTART_SOFTWARE_HELP": "Applica impostazioni che richiedono un riavvio",
"ROUND_MULTIPLIER": "Arrotondamento bordi UI",
"SCREEN_RENDER_DOWN": "Rendering dello schermo a risoluzione inferiore",
"SCREEN_RENDER_DOWN_HELP": "Aiuta a ridurre l'aliasing su schermi ad alta risoluzione",
"SCROLL_SPEED": "Velocità di scorrimento",
"SETS_ON_WATCH": "Set sul Watch",
"SPACE_DRAG_MULTIPLIER": "Moltiplicatore space-drag",
"SPACE_DRAG_UNLOCKED": "Consenti lo space-drag su tutti gli assi",
"SPACE_ROTATE_UNLOCKED": "Consenti la rotazione dello spazio su tutti gli assi",
"TROUBLESHOOTING": "Risoluzione dei problemi",
"UPRIGHT_SCREEN_FIX": "Correzione schermo verticale",
"UPRIGHT_SCREEN_FIX_HELP": "Corregge schermi verticali su alcuni desktop",
"USE_PASSTHROUGH": "Abilita passthrough",
"USE_PASSTHROUGH_HELP": "Consenti il passthrough se supportato dal runtime XR",
"USE_SKYBOX": "Abilita skybox",
"USE_SKYBOX_HELP": "Mostra uno skybox se non c'è un'app di scena o passthrough",
"XR_CLICK_SENSITIVITY": "Sensibilità del click XR",
"XR_CLICK_SENSITIVITY_HELP": "Sensibilità del trigger analogico",
"XR_CLICK_SENSITIVITY_RELEASE": "Sensibilità di rilascio XR",
"XR_CLICK_SENSITIVITY_RELEASE_HELP": "Deve essere inferiore al clic",
"XWAYLAND_BY_DEFAULT": "Esegui le app in modalità Compatibilità per impostazione predefinita",
"AUTOSTART_APPS": "App da avviare all'avvio",
"HANDSFREE_POINTER": "Modalità a mani libere",
"HANDSFREE_POINTER_HELP": "Input da usare quando i\ncontroller di movimento non sono disponibili.\nPizzico sinistro per afferrare, destro per cliccare.",
"UI_GRADIENT_INTENSITY": "Intensità gradiente dell'interfaccia utente",
"RESET_PLAYSPACE": "Ripristina playspace",
"RESET_PLAYSPACE_HELP": "Cancella l'offset dello spazio di gioco.",
"BLOCK_POSES_ON_KBD_INTERACTION": "Blocca le pose durante l'interazione con la tastiera",
"BLOCK_POSES_ON_KBD_INTERACTION_HELP": "Impedisce al gioco di ricevere pose quando la tastiera è evidenziata e 'Blocca input di gioco' è abilitato",
"LANGUAGE": "Lingua",
"REQUIRES_RESTART": "Richiede riavvio",
"GRID_OPACITY": "Opacità della griglia del pavimento",
"GRID_OPACITY_HELP": "Opacità della griglia del pavimento quando lo skybox è abilitato"
},
"APPLICATION_LAUNCHER": "Lanciatore applicazioni",
"APPLICATION_STARTED": "Applicazione avviata",
"APPLICATIONS": "Applicazioni",
"AUDIO": {
"AUTO_SWITCH_TO_VR_AUDIO": "Passa automaticamente all'audio VR",
"CARDS": "Schede",
"FAILED_TO_SWITCH_MICROPHONE": "Impossibile cambiare microfono",
"MICROPHONE_SET_SUCCESSFULLY": "Microfono impostato con successo",
"MICROPHONES": "Microfoni",
"NO_VR_MICROPHONE_SWITCH_MANUALLY": "Nessun microfono VR trovato. Attivalo manualmente.",
"NO_VR_SPEAKERS_FOUND_SWITCH_MANUALLY": "Nessun altoparlante VR trovato. Selezionali manualmente.",
"SELECT_AUDIO_CARD_PROFILE": "Seleziona profilo scheda audio",
"SETTINGS": "Impostazioni audio",
"SPEAKERS": "Altoparlanti",
"SPEAKERS_SET_SUCCESSFULLY": "Altoparlanti impostati correttamente",
"VOLUME": "Volume"
},
"CLOSE_WINDOW": "Chiudi finestra",
"DISPLAY_BRIGHTNESS": "Luminosità display",
"FAILED_TO_LAUNCH_APPLICATION": "Impossibile avviare l'applicazione:",
"GAME_LAUNCHED": "Gioco lanciato",
"GAME_LIST": {
"NO_GAMES_FOUND": "Nessun gioco trovato",
"RUNNING_GAMES_LIST": "Lista dei giochi in esecuzione"
},
"GAMES": "Giochi",
"GENERAL_SETTINGS": "Impostazioni generali",
"HEIGHT": "Altezza",
"HELLO": "Ciao!",
"HELLO_USER": "Ciao, {USER}!",
"HIDE": "Nascondi",
"HOME_SCREEN": "Home",
"MONADO_RUNTIME": "Runtime Monado",
"POPUP_ADD_DISPLAY": {
"RESOLUTION": "Risoluzione"
},
"REMOVE": "Rimuovi",
"SETTINGS": "Impostazioni",
"SHOW": "Mostra",
"TERMINATE_PROCESS": "Termina processo",
"WIDTH": "Larghezza",
"PROCESS_LIST": "Elenco processi",
"REFRESH": "Aggiorna",
"PROCESS": {
"STOP": "Interrompi",
"FORCE_KILL": "Uccidi forzatamente"
}
}
+27 -15
View File
@@ -4,14 +4,12 @@
"APPLICATIONS": "アプリ",
"GAMES": "ゲーム",
"SETTINGS": "設定",
"PROCESSES": "プロセス",
"HELLO_USER": "こんにちは、{USER}!",
"GENERAL_SETTINGS": "全般設定",
"APPLICATION_LAUNCHER": "アプリケーションランチャー",
"APP_SETTINGS": {
"HIDE_USERNAME": "ユーザー名を非表示",
"OPAQUE_BACKGROUND": "不透明な背景",
"WLX": {},
"LOOK_AND_FEEL": "外観",
"HIDE_GRAB_HELP": "グリップ動作中にのヘルプを非表示",
"ANIMATION_SPEED": "UIアニメーション速度",
@@ -76,9 +74,25 @@
"PIPEWIRE_HELP": "GPU高速キャプチャ。\nすべてのデスクトップで標準です。",
"PW_FALLBACK_HELP": "CPU使用量が多い低速な方法です。\nPipeWire GPUが動作しない場合に試してください。",
"SCREENCOPY_GPU_HELP": "高速で、スクリーン共有ポップアップはありません。\n動作する環境: Hyprland, Niri, River, Sway",
"SCREENCOPY_HELP": "遅延あり、画面共有ポップアップなし。\n動作する環境: Hyprland, Niri, River, Sway"
"SCREENCOPY_HELP": "遅延あり、画面共有ポップアップなし。\n動作する環境: Hyprland, Niri, River, Sway",
"NONE": "なし",
"HMD_PINCH": "HMD + ピンチ",
"EYE_PINCH": "つまんで目を合わせる",
"EYE_ONLY": "視野のみ",
"HMD_ONLY": "HMDのみ"
},
"AUTOSTART_APPS": "起動時に実行するアプリ"
"AUTOSTART_APPS": "起動時に実行するアプリ",
"HANDSFREE_POINTER": "ハンズフリーモード",
"HANDSFREE_POINTER_HELP": "モーションコントローラーが利用できない場合の入力方法。\n左手のピンチは掴み、右手のピンチはクリックです。",
"UI_GRADIENT_INTENSITY": "UIグラデーションの強さ",
"RESET_PLAYSPACE": "プレイエリアをリセット",
"RESET_PLAYSPACE_HELP": "プレイエリアのオフセットをクリアします。",
"BLOCK_POSES_ON_KBD_INTERACTION": "キーボード操作時のポーズをブロック",
"BLOCK_POSES_ON_KBD_INTERACTION_HELP": "キーボードがホバーされ、「ゲーム入力をブロック」が有効になっている場合、ゲームがポーズを受信することをブロックします",
"LANGUAGE": "言語",
"REQUIRES_RESTART": "再起動が必要です",
"GRID_OPACITY": "フロアグリッドの不透明度",
"GRID_OPACITY_HELP": "スカイボックスが有効なときの床グリッドの不透明度"
},
"HELLO": "こんにちは!",
"AUDIO": {
@@ -98,7 +112,6 @@
"ACTIONS": {
"RECENTER_PLAYSPACE": "プレイスペースを再中央"
},
"LIST_OF_PROCESSES": "プロセスのリスト",
"POPUP_ADD_DISPLAY": {
"RESOLUTION": "解像度"
},
@@ -107,19 +120,12 @@
"HIDE": "隠す",
"REMOVE": "削除",
"SHOW": "表示",
"PROCESS_LIST": {
"NO_PROCESSES_FOUND": "プロセスが見つかりませんでした",
"LOCATED_ON": "に",
"TERMINATE_PROCESS_NAMED_X": "プロセス \"{PROCESS_NAME}\" を終了します"
},
"FAILED_TO_LAUNCH_APPLICATION": "アプリケーションの起動に失敗しました:",
"NO_WINDOWS_FOUND": "ウィンドウが見つかりませんでした",
"WINDOW_OPTIONS": "ウィンドウオプション",
"APPLICATION_STARTED": "アプリケーションが起動しました",
"LIST_OF_WINDOWS": "ウィンドウ一覧",
"CLOSE_WINDOW": "ウィンドウを閉じる",
"GAME_LIST": {
"NO_GAMES_FOUND": "ゲームが見つかりませんでした"
"NO_GAMES_FOUND": "ゲームが見つかりませんでした",
"RUNNING_GAMES_LIST": "実行中のゲーム一覧"
},
"TERMINATE_PROCESS": "プロセスを終了する",
"GAME_LAUNCHED": "ゲームが起動しました",
@@ -149,5 +155,11 @@
"AUTOSTART": "起動時に自動実行",
"LAUNCH": "起動"
},
"DISPLAY_BRIGHTNESS": "ディスプレイの明るさ"
"DISPLAY_BRIGHTNESS": "ディスプレイの明るさ",
"PROCESS_LIST": "プロセスリスト",
"REFRESH": "更新",
"PROCESS": {
"STOP": "停止",
"FORCE_KILL": "強制終了"
}
}
+29 -17
View File
@@ -5,7 +5,6 @@
"APP_SETTINGS": {
"HIDE_USERNAME": "Ukryj nazwę użytkownika",
"OPAQUE_BACKGROUND": "Nieprzezroczyste tło",
"WLX": {},
"LOOK_AND_FEEL": "Wygląd i działanie",
"HIDE_GRAB_HELP": "Ukryj pomoc dotyczącą chwytania",
"ANIMATION_SPEED": "Prędkość animacji UI",
@@ -34,7 +33,6 @@
"XR_CLICK_SENSITIVITY": "Czułość kliknięć XR",
"XR_CLICK_SENSITIVITY_RELEASE": "Czułość zwalniania XR",
"CLICK_FREEZE_TIME_MS": "Czas zamrożenia po kliknięciu (ms)",
"MISC": "Różne",
"XWAYLAND_BY_DEFAULT": "Uruchamiaj aplikacje domyślnie w trybie kompatybilności",
"UPRIGHT_SCREEN_FIX": "Naprawa pozycji ekranu",
"DOUBLE_CURSOR_FIX": "Naprawa podwójnego kursora",
@@ -55,7 +53,7 @@
"CLEAR_SAVED_STATE": "Wyczyść zapisany stan",
"CLEAR_PIPEWIRE_TOKENS": "Wyczyść tokeny PipeWire",
"DELETE_ALL_CONFIGS": "Wyczyść konfigurację",
"RESTART_SOFTWARE": "Uruchom ponownie oprogramowanie",
"RESTART_SOFTWARE": "Restartuj WayVR",
"CLEAR_SAVED_STATE_HELP": "Zresetuj zestawy i pozycje nakładek",
"CLEAR_PIPEWIRE_TOKENS_HELP": "Zapytaj o wybór ekranu przy następnym uruchomieniu",
"DELETE_ALL_CONFIGS_HELP": "Usuń wszystkie pliki konfiguracyjne z katalogu conf.d",
@@ -70,9 +68,26 @@
"PIPEWIRE_HELP": "Szybkie przechwytywanie GPU,\nstandard na wszystkich komputerach.",
"PW_FALLBACK_HELP": "Powolna metoda z wysokim użyciem procesora.\nWypróbuj w przypadku, gdy PipeWire GPU nie działa",
"SCREENCOPY_GPU_HELP": "Szybkie działanie, brak wyskakujących okien z informacją o udostępnianiu ekranu.\nDziała na: Hyprland, Niri, River, Sway",
"SCREENCOPY_HELP": "Wolne, bez wyskakujących okienek udostępniania ekranu.\nDziała na: Hyprland, Niri, River, Sway"
"SCREENCOPY_HELP": "Wolne, bez wyskakujących okienek udostępniania ekranu.\nDziała na: Hyprland, Niri, River, Sway",
"NONE": "Brak",
"HMD_PINCH": "HMD + ściśnięcie placami",
"EYE_PINCH": "Ściśnięcie palcami + oko",
"EYE_ONLY": "Tylko oko",
"HMD_ONLY": "Tylko HMD"
},
"AUTOSTART_APPS": "Aplikacje do uruchomienia przy starcie"
"AUTOSTART_APPS": "Aplikacje auto-start",
"HANDSFREE_POINTER": "Tryb bez użycia rąk",
"HANDSFREE_POINTER_HELP": "Wejście do użycia, gdy kontrolery ruchu\nsą niedostępne. Lewy szczyptak to chwyt,\nprawy to kliknięcie.",
"UI_GRADIENT_INTENSITY": "Intensywność gradientu UI",
"RESET_PLAYSPACE": "Zresetuj przestrzeń gry",
"RESET_PLAYSPACE_HELP": "Wyczyść przesunięcie przestrzeni gry.",
"BLOCK_POSES_ON_KBD_INTERACTION": "Blokuj pozy podczas interakcji z klawiaturą",
"BLOCK_POSES_ON_KBD_INTERACTION_HELP": "Blokuje odbieranie póz przez grę, gdy kursor myszy znajduje się nad klawiaturą i włączona jest opcja 'Blokuj dane wejściowe z gry'",
"LANGUAGE": "Język",
"REQUIRES_RESTART": "Wymaga restartu",
"MISC": "Różne",
"GRID_OPACITY": "Przezroczystość siatki podłogowej",
"GRID_OPACITY_HELP": "Przezroczystość siatki podłogowej, gdy włączony jest skybox"
},
"APPLICATION_LAUNCHER": "Uruchamiacz aplikacji",
"APPLICATIONS": "Aplikacje",
@@ -97,7 +112,6 @@
"HELLO_USER": "Witaj, {USER}!",
"HIDE": "Ukryj",
"HOME_SCREEN": "Ekran główny",
"LIST_OF_PROCESSES": "Lista procesów",
"MONADO_RUNTIME": "Środowisko Monado",
"POPUP_ADD_DISPLAY": {
"RESOLUTION": "Rozdzielczość"
@@ -106,20 +120,12 @@
"SETTINGS": "Ustawienia",
"SHOW": "Pokaż",
"WIDTH": "Szerokość",
"PROCESSES": "Procesy",
"PROCESS_LIST": {
"NO_PROCESSES_FOUND": "Nie znaleziono procesów",
"LOCATED_ON": "na",
"TERMINATE_PROCESS_NAMED_X": "Zakończ proces \"{PROCESS_NAME}\""
},
"FAILED_TO_LAUNCH_APPLICATION": "Nie udało się uruchomić aplikacji:",
"NO_WINDOWS_FOUND": "Nie znaleziono okien",
"WINDOW_OPTIONS": "Opcje okna",
"APPLICATION_STARTED": "Aplikacja uruchomiona",
"LIST_OF_WINDOWS": "Lista okien",
"CLOSE_WINDOW": "Zamknij okno",
"GAME_LIST": {
"NO_GAMES_FOUND": "Nie znaleziono gier"
"NO_GAMES_FOUND": "Nie znaleziono gier",
"RUNNING_GAMES_LIST": "Lista uruchomionych gier"
},
"TERMINATE_PROCESS": "Zakończ proces",
"GAME_LAUNCHED": "Gra uruchomiona",
@@ -149,5 +155,11 @@
"AUTOSTART": "Uruchom automatycznie przy starcie",
"LAUNCH": "Uruchom"
},
"DISPLAY_BRIGHTNESS": "Jasność wyświetlacza"
"DISPLAY_BRIGHTNESS": "Jasność wyświetlacza",
"PROCESS_LIST": "Lista procesów",
"REFRESH": "Odśwież",
"PROCESS": {
"STOP": "Zatrzymaj",
"FORCE_KILL": "Wymuś zakończenie"
}
}
+165
View File
@@ -0,0 +1,165 @@
{
"ACTIONS": {
"RECENTER_PLAYSPACE": "重置游玩区中心"
},
"APP_LAUNCHER": {
"ASPECT": {
"SEMI_TALL": "略高",
"SEMI_WIDE": "略宽",
"SQUARE": "正方形",
"TALL": "高",
"WIDE": "宽"
},
"ASPECT_TITLE": "比例",
"AUTOSTART": "启动时自动运行",
"LAUNCH": "启动",
"MODE": {
"CAGE": "兼容模式 (Cage)",
"NATIVE": "原生模式"
},
"POS": {
"ANCHORED": "锚定",
"ANCHORED_HELP": "相对于中心标记保持固定。",
"FLOATING": "悬浮",
"FLOATING_HELP": "独立移动,显示时自动重置中心。",
"STATIC": "静态",
"STATIC_HELP": "不属于任何集合。不会重置中心。"
},
"POS_TITLE": "定位",
"RES_TITLE": "分辨率"
},
"APP_SETTINGS": {
"ALLOW_SLIDING": "抓取时允许摇杆交互",
"ANIMATION_SPEED": "UI 动画速度",
"BLOCK_GAME_INPUT": "屏蔽游戏输入",
"BLOCK_GAME_INPUT_HELP": "悬停在覆盖层上时屏蔽所有输入",
"BLOCK_GAME_INPUT_IGNORE_WATCH": "屏蔽输入时忽略手表",
"BLOCK_GAME_INPUT_IGNORE_WATCH_HELP": "悬停在手表上时不屏蔽输入",
"CAPTURE_METHOD": "Wayland 屏幕采集",
"CAPTURE_METHOD_HELP": "如果您遇到黑屏或花屏,请尝试更改此项",
"CLEAR_PIPEWIRE_TOKENS": "清除 PipeWire 令牌",
"CLEAR_PIPEWIRE_TOKENS_HELP": "下次启动时提示选择屏幕",
"CLEAR_SAVED_STATE": "清除保存的状态",
"CLEAR_SAVED_STATE_HELP": "重置集合与覆盖层位置",
"CLICK_FREEZE_TIME_MS": "点击冻结时间 (毫秒)",
"CLICK_FREEZE_TIME_MS_HELP": "有助于提高双击精度",
"CLOCK_12H": "12 小时制时钟",
"CONTROLS": "控制",
"DELETE_ALL_CONFIGS": "擦除配置",
"DELETE_ALL_CONFIGS_HELP": "从 conf.d 中删除所有配置文件",
"DOUBLE_CURSOR_FIX": "双光标修复",
"DOUBLE_CURSOR_FIX_HELP": "如果您看到两个光标,请启用此项",
"FEATURES": "功能",
"FOCUS_FOLLOWS_MOUSE_MODE": "触摸扳机时移动鼠标",
"HIDE_GRAB_HELP": "隐藏抓取帮助",
"HIDE_USERNAME": "隐藏用户名",
"INVERT_SCROLL_DIRECTION_X": "反转水平滚动方向",
"INVERT_SCROLL_DIRECTION_Y": "反转垂直滚动方向",
"KEYBOARD_MIDDLE_CLICK": "键盘中键点击",
"KEYBOARD_MIDDLE_CLICK_HELP": "使用紫色激光打字时的修饰键",
"KEYBOARD_SOUND_ENABLED": "键盘音效",
"LEFT_HANDED_MOUSE": "左手鼠标",
"LEFT_HANDED_MOUSE_HELP": "如果鼠标按钮反置,请使用此项",
"LONG_PRESS_DURATION": "长按持续时间",
"LOOK_AND_FEEL": "外观与体验",
"MISC": "杂项",
"NOTIFICATIONS_ENABLED": "启用通知",
"NOTIFICATIONS_SOUND_ENABLED": "通知音效",
"OPAQUE_BACKGROUND": "不透明背景",
"OPTION": {
"AUTO": "自动",
"AUTO_HELP": "如果支持,则使用 ScreenCopy GPU,\n否则使用 PipeWire GPU。",
"PIPEWIRE_HELP": "快速 GPU 采集,\n所有桌面环境的标准方式。",
"PW_FALLBACK_HELP": "高 CPU 占用的慢速方法。\n在 PipeWire GPU 不起作用时尝试。",
"SCREENCOPY_GPU_HELP": "快速,无屏幕共享弹窗。\n支持:Hyprland, Niri, River, Sway",
"SCREENCOPY_HELP": "慢速,无屏幕共享弹窗。\n支持:Hyprland, Niri, River, Sway",
"NONE": "无",
"HMD_PINCH": "HMD + 捏合",
"EYE_PINCH": "眼睛 + 捏合",
"EYE_ONLY": "仅眼球",
"HMD_ONLY": "仅限头显"
},
"POINTER_LERP_FACTOR": "指针平滑",
"RESTART_SOFTWARE": "重启软件",
"RESTART_SOFTWARE_HELP": "应用需要重启的设置",
"ROUND_MULTIPLIER": "UI 边缘圆角",
"SCREEN_RENDER_DOWN": "以较低分辨率渲染屏幕",
"SCREEN_RENDER_DOWN_HELP": "有助于解决高分辨率屏幕的锯齿问题",
"SCROLL_SPEED": "滚动速度",
"SETS_ON_WATCH": "在手表上显示集合",
"SPACE_DRAG_MULTIPLIER": "空间拖拽倍率",
"SPACE_DRAG_UNLOCKED": "允许在所有轴上进行空间拖拽",
"SPACE_ROTATE_UNLOCKED": "允许在所有轴上进行空间旋转",
"TROUBLESHOOTING": "故障排除",
"UPRIGHT_SCREEN_FIX": "垂直屏幕修复",
"UPRIGHT_SCREEN_FIX_HELP": "修复某些桌面上的垂直屏幕问题",
"USE_PASSTHROUGH": "启用穿透",
"USE_PASSTHROUGH_HELP": "如果 XR 运行时支持,则允许穿透",
"USE_SKYBOX": "启用天空盒",
"USE_SKYBOX_HELP": "如果没有场景应用或穿透,则显示天空盒",
"XR_CLICK_SENSITIVITY": "XR 点击灵敏度",
"XR_CLICK_SENSITIVITY_HELP": "模拟扳机灵敏度",
"XR_CLICK_SENSITIVITY_RELEASE": "XR 释放灵敏度",
"XR_CLICK_SENSITIVITY_RELEASE_HELP": "必须低于点击灵敏度",
"XWAYLAND_BY_DEFAULT": "默认以兼容模式运行应用",
"AUTOSTART_APPS": "开机启动应用",
"HANDSFREE_POINTER": "免提模式",
"HANDSFREE_POINTER_HELP": "当运动控制器不可用时使用的输入。\n左手捏合为抓取,右手为点击。",
"UI_GRADIENT_INTENSITY": "UI 渐变强度",
"RESET_PLAYSPACE": "重置游戏空间",
"RESET_PLAYSPACE_HELP": "清除舞台空间偏移。",
"BLOCK_POSES_ON_KBD_INTERACTION": "与键盘交互时阻止姿势",
"BLOCK_POSES_ON_KBD_INTERACTION_HELP": "当键盘悬停且启用“阻止游戏输入”时,阻止游戏接收姿势",
"LANGUAGE": "语言",
"REQUIRES_RESTART": "需要重启",
"GRID_OPACITY": "地面网格不透明度",
"GRID_OPACITY_HELP": "启用天空盒时地板网格的不透明度"
},
"APPLICATION_LAUNCHER": "应用启动器",
"APPLICATION_STARTED": "应用已启动",
"APPLICATIONS": "应用",
"AUDIO": {
"AUTO_SWITCH_TO_VR_AUDIO": "自动切换到 VR 音频",
"CARDS": "声卡",
"FAILED_TO_SWITCH_MICROPHONE": "切换麦克风失败",
"MICROPHONE_SET_SUCCESSFULLY": "麦克风设置成功",
"MICROPHONES": "麦克风",
"NO_VR_MICROPHONE_SWITCH_MANUALLY": "未找到 VR 麦克风。请手动切换。",
"NO_VR_SPEAKERS_FOUND_SWITCH_MANUALLY": "未找到 VR 扬声器。请手动切换。",
"SELECT_AUDIO_CARD_PROFILE": "选择声卡配置",
"SETTINGS": "音频设置",
"SPEAKERS": "扬声器",
"SPEAKERS_SET_SUCCESSFULLY": "扬声器设置成功",
"VOLUME": "音量"
},
"CLOSE_WINDOW": "关闭窗口",
"DISPLAY_BRIGHTNESS": "显示亮度",
"FAILED_TO_LAUNCH_APPLICATION": "启动应用失败:",
"GAME_LAUNCHED": "游戏已启动",
"GAME_LIST": {
"NO_GAMES_FOUND": "未找到游戏",
"RUNNING_GAMES_LIST": "正在运行的游戏列表"
},
"GAMES": "游戏",
"GENERAL_SETTINGS": "通用设置",
"HEIGHT": "高度",
"HELLO": "你好!",
"HELLO_USER": "你好,{USER}!",
"HIDE": "隐藏",
"HOME_SCREEN": "主页",
"MONADO_RUNTIME": "Monado 运行时",
"POPUP_ADD_DISPLAY": {
"RESOLUTION": "分辨率"
},
"REMOVE": "移除",
"SETTINGS": "设置",
"SHOW": "显示",
"TERMINATE_PROCESS": "终止进程",
"WIDTH": "宽度",
"PROCESS_LIST": "进程列表",
"REFRESH": "刷新",
"PROCESS": {
"STOP": "停止",
"FORCE_KILL": "强制关闭"
}
}
+88 -29
View File
@@ -10,18 +10,22 @@ use wgui::{
i18n::Translation,
layout::{Layout, LayoutParams, LayoutUpdateParams, LayoutUpdateResult, WidgetID},
parser::{Fetchable, ParseDocumentParams, ParserState},
renderer_vk::text::custom_glyph::CustomGlyphData,
task::Tasks,
widget::{label::WidgetLabel, rectangle::WidgetRectangle},
theme::WguiTheme,
widget::{label::WidgetLabel, rectangle::WidgetRectangle, sprite::WidgetSprite},
windowing::window::{WguiWindow, WguiWindowParams, WguiWindowParamsExtra, WguiWindowPlacement},
};
use wlx_common::{audio, dash_interface::BoxDashInterface, timestep::Timestep};
use wlx_common::{
audio,
dash_interface::{BoxDashInterface, RecenterMode},
locale::WayVRLangProvider,
timestep::{self, Timestep},
};
use crate::{
assets,
tab::{
apps::TabApps, games::TabGames, home::TabHome, monado::TabMonado, processes::TabProcesses, settings::TabSettings,
Tab, TabType,
},
tab::{Tab, TabType, apps::TabApps, games::TabGames, home::TabHome, monado::TabMonado, settings::TabSettings},
util::{
popup_manager::{MountPopupParams, PopupManager, PopupManagerParams},
toast_manager::ToastManager,
@@ -31,8 +35,10 @@ use crate::{
};
pub struct FrontendWidgets {
pub id_label_time: WidgetID,
pub id_rect_content: WidgetID,
id_label_time: WidgetID,
id_rect_content: WidgetID,
id_sprite_titlebar_icon: WidgetID,
id_label_titlebar_title: WidgetID,
}
pub type FrontendTasks = Tasks<FrontendTask>;
@@ -77,9 +83,11 @@ pub struct FrontendUpdateResult {
pub sounds_to_play: Vec<SoundType>,
}
pub struct InitParams<T> {
pub struct InitParams<'a, T> {
pub interface: BoxDashInterface<T>,
pub lang_provider: &'a WayVRLangProvider,
pub has_monado: bool,
pub theme: Rc<WguiTheme>,
}
#[derive(Clone)]
@@ -104,7 +112,7 @@ pub enum FrontendTask {
}
impl<T: 'static> Frontend<T> {
pub fn new(params: InitParams<T>, data: &mut T) -> anyhow::Result<Frontend<T>> {
pub fn new(params: InitParams<T>) -> anyhow::Result<Frontend<T>> {
let mut assets = Box::new(assets::Asset {});
let font_binary_bold = assets.load_from_path_gzip("Quicksand-Bold.ttf.gz")?;
@@ -113,7 +121,7 @@ impl<T: 'static> Frontend<T> {
let globals = WguiGlobals::new(
assets,
wgui::globals::Defaults::default(),
params.lang_provider,
&WguiFontConfig {
binaries: vec![&font_binary_regular, &font_binary_bold, &font_binary_light],
family_name_sans_serif: "Quicksand",
@@ -129,7 +137,10 @@ impl<T: 'static> Frontend<T> {
path: AssetPath::BuiltIn("gui/dashboard.xml"),
extra: Default::default(),
},
&LayoutParams { resize_to_parent: true },
LayoutParams {
resize_to_parent: true,
theme: params.theme,
},
)?;
let id_popup_manager = state.get_widget_id("popup_manager")?;
@@ -144,6 +155,8 @@ impl<T: 'static> Frontend<T> {
let id_label_time = state.get_widget_id("label_time")?;
let id_rect_content = state.get_widget_id("rect_content")?;
let id_sprite_titlebar_icon = state.get_widget_id("sprite_titlebar_icon")?;
let id_label_titlebar_title = state.get_widget_id("label_titlebar_title")?;
let timestep = Timestep::new(60.0);
@@ -157,6 +170,8 @@ impl<T: 'static> Frontend<T> {
widgets: FrontendWidgets {
id_label_time,
id_rect_content,
id_sprite_titlebar_icon,
id_label_titlebar_title,
},
timestep,
interface: params.interface,
@@ -169,8 +184,8 @@ impl<T: 'static> Frontend<T> {
};
// init some things first
frontend.update_background(data)?;
frontend.update_time(data)?;
frontend.tasks.push(FrontendTask::RefreshBackground);
frontend.tasks.push(FrontendTask::RefreshClock);
Frontend::register_widgets(&mut frontend)?;
@@ -183,10 +198,19 @@ impl<T: 'static> Frontend<T> {
fn play_sound(&mut self, audio_system: &mut audio::AudioSystem, sound_type: SoundType) -> anyhow::Result<()> {
let mut assets = self.globals.assets_builtin();
let sample = audio::AudioSample::from_mp3(&assets.load_from_path(match sound_type {
let path = match sound_type {
SoundType::Startup => "sound/startup.mp3",
SoundType::Launch => "sound/app_start.mp3",
})?)?;
};
// try loading a custom sound; if one doesn't exist (or it failed to load), use the built-in asset
let sound_bytes = match audio::AudioSample::try_bytes_from_config(path) {
Ok(bytes) => bytes,
Err(_) => assets.load_from_path(path)?.into(),
};
let sample = audio::AudioSample::from_mp3(&sound_bytes)?;
audio_system.play_sample(&sample);
Ok(())
}
@@ -198,8 +222,10 @@ impl<T: 'static> Frontend<T> {
self.process_task(&mut params, task)?;
}
let time_ms = timestep::get_micros() / 1000;
if let Some(mut tab) = self.current_tab.take() {
tab.update(self, params.data)?;
tab.update(self, time_ms as u32, params.data)?;
self.current_tab = Some(tab);
}
@@ -237,7 +263,7 @@ impl<T: 'static> Frontend<T> {
{
// always 30 times per second
while self.timestep.on_tick() {
self.toast_manager.tick(&self.globals, &mut self.layout)?;
self.toast_manager.tick(&mut self.layout)?;
}
}
@@ -257,9 +283,10 @@ impl<T: 'static> Frontend<T> {
let mut common = c.common();
{
let Some(mut label) = common.state.widgets.get_as::<WidgetLabel>(self.widgets.id_label_time) else {
anyhow::bail!("");
};
let mut label = common
.state
.widgets
.cast_as::<WidgetLabel>(self.widgets.id_label_time)?;
let now = chrono::Local::now();
let hours = now.hour();
@@ -301,6 +328,8 @@ impl<T: 'static> Frontend<T> {
}
fn update_background(&mut self, data: &mut T) -> anyhow::Result<()> {
self.layout.mark_redraw();
let Some(mut rect) = self
.layout
.state
@@ -339,17 +368,53 @@ impl<T: 'static> Frontend<T> {
Ok(())
}
fn set_tab_title(&mut self, translation: &str, icon: &str) -> anyhow::Result<()> {
let mut c = self.layout.start_common();
let mut common = c.common();
{
let mut label = common
.state
.widgets
.cast_as::<WidgetLabel>(self.widgets.id_label_titlebar_title)?;
label.set_text(&mut common, Translation::from_translation_key(translation));
}
{
let mut sprite = common
.state
.widgets
.cast_as::<WidgetSprite>(self.widgets.id_sprite_titlebar_icon)?;
sprite.set_content(
&mut common,
Some(CustomGlyphData::from_assets(&self.globals, AssetPath::BuiltIn(icon))?),
);
}
c.finish()?;
Ok(())
}
fn set_tab(&mut self, data: &mut T, tab_type: TabType) -> anyhow::Result<()> {
log::info!("Setting tab to {tab_type:?}");
let widget_content = self.state.fetch_widget(&self.layout.state, "content")?;
self.layout.remove_children(widget_content.id);
let (tab_translation, icon_path) = match tab_type {
TabType::Home => ("HOME_SCREEN", "dashboard/home.svg"),
TabType::Apps => ("APPLICATIONS", "dashboard/apps.svg"),
TabType::Games => ("GAMES", "dashboard/games.svg"),
TabType::Monado => ("MONADO_RUNTIME", "dashboard/monado.svg"),
TabType::Settings => ("SETTINGS", "dashboard/settings.svg"),
};
self.set_tab_title(tab_translation, icon_path)?;
let tab: Box<dyn Tab<T>> = match tab_type {
TabType::Home => Box::new(TabHome::new(self, widget_content.id, data)?),
TabType::Apps => Box::new(TabApps::new(self, widget_content.id, data)?),
TabType::Games => Box::new(TabGames::new(self, widget_content.id)?),
TabType::Monado => Box::new(TabMonado::new(self, widget_content.id)?),
TabType::Processes => Box::new(TabProcesses::new(self, widget_content.id)?),
TabType::Settings => Box::new(TabSettings::new(self, widget_content.id, data)?),
};
@@ -393,12 +458,6 @@ impl<T: 'static> Frontend<T> {
FrontendTask::SetTab(TabType::Monado),
);
// "Processes" side button
// self.tasks.handle_button(
// &self.state.fetch_component_as::<ComponentButton>("btn_side_processes")?,
// FrontendTask::SetTab(TabType::Processes),
// );
// "Settings" side button
self.tasks.handle_button(
&self.state.fetch_component_as::<ComponentButton>("btn_side_settings")?,
@@ -466,7 +525,7 @@ impl<T: 'static> Frontend<T> {
}
fn action_recenter_playspace(&mut self, data: &mut T) -> anyhow::Result<()> {
self.interface.recenter_playspace(data)?;
self.interface.recenter_playspace(data, RecenterMode::Recenter)?;
Ok(())
}
+2 -2
View File
@@ -46,7 +46,7 @@ impl<T> Tab<T> for TabApps<T> {
TabType::Apps
}
fn update(&mut self, frontend: &mut Frontend<T>, data: &mut T) -> anyhow::Result<()> {
fn update(&mut self, frontend: &mut Frontend<T>, _time_ms: u32, data: &mut T) -> anyhow::Result<()> {
let mut state = self.state.borrow_mut();
for task in self.tasks.drain() {
@@ -81,7 +81,7 @@ fn on_app_click(
state: Rc<RefCell<State>>,
tasks: Tasks<Task>,
) -> ButtonClickCallback {
Box::new(move |_common, _evt| {
Rc::new(move |_common, _evt| {
frontend_tasks.push(FrontendTask::MountPopup(MountPopupParams {
title: Translation::from_raw_text(&entry.app_name),
on_content: {
+26 -5
View File
@@ -9,7 +9,8 @@ use wgui::{
use crate::{
frontend::Frontend,
tab::{Tab, TabType},
views::game_list,
util::steam_utils::SteamUtils,
views::{game_list, running_games_list},
};
pub struct TabGames<T> {
@@ -17,6 +18,8 @@ pub struct TabGames<T> {
pub state: ParserState,
view_game_list: game_list::View,
view_running_games_list: running_games_list::View,
steam_utils: SteamUtils,
marker: PhantomData<T>,
}
@@ -25,17 +28,22 @@ impl<T> Tab<T> for TabGames<T> {
TabType::Games
}
fn update(&mut self, frontend: &mut Frontend<T>, _data: &mut T) -> anyhow::Result<()> {
self.view_game_list.update(&mut frontend.layout, &frontend.executor)?;
fn update(&mut self, frontend: &mut Frontend<T>, time_ms: u32, _data: &mut T) -> anyhow::Result<()> {
self
.view_game_list
.update(&mut frontend.layout, &mut self.steam_utils, &frontend.executor)?;
self.view_running_games_list.update(&mut frontend.layout, time_ms)?;
Ok(())
}
}
impl<T> TabGames<T> {
pub fn new(frontend: &mut Frontend<T>, parent_id: WidgetID) -> anyhow::Result<Self> {
let globals = frontend.layout.state.globals.clone();
let state = wgui::parser::parse_from_assets(
&ParseDocumentParams {
globals: frontend.layout.state.globals.clone(),
globals: globals.clone(),
path: AssetPath::BuiltIn("gui/tab/games.xml"),
extra: Default::default(),
},
@@ -44,19 +52,32 @@ impl<T> TabGames<T> {
)?;
let game_list_parent = state.get_widget_id("game_list_parent")?;
let id_running_games_list_parent = state.get_widget_id("running_games_list_parent")?;
let view_game_list = game_list::View::new(game_list::Params {
executor: frontend.executor.clone(),
frontend_tasks: frontend.tasks.clone(),
globals: frontend.layout.state.globals.clone(),
globals: globals.clone(),
layout: &mut frontend.layout,
parent_id: game_list_parent,
})?;
let mut steam_utils = SteamUtils::new()?;
let view_running_games_list = running_games_list::View::new(running_games_list::Params {
globals: globals.clone(),
layout: &mut frontend.layout,
parent_id: id_running_games_list_parent,
steam_utils: &mut steam_utils,
frontend_tasks: frontend.tasks.clone(),
})?;
Ok(Self {
state,
view_game_list,
view_running_games_list,
marker: PhantomData,
steam_utils,
})
}
}
+1 -3
View File
@@ -4,7 +4,6 @@ pub mod apps;
pub mod games;
pub mod home;
pub mod monado;
pub mod processes;
pub mod settings;
#[derive(Clone, Copy, Debug)]
@@ -13,7 +12,6 @@ pub enum TabType {
Apps,
Games,
Monado,
Processes,
Settings,
}
@@ -21,7 +19,7 @@ pub trait Tab<T> {
#[allow(dead_code)]
fn get_type(&self) -> TabType;
fn update(&mut self, _: &mut Frontend<T>, _: &mut T) -> anyhow::Result<()> {
fn update(&mut self, _frontend: &mut Frontend<T>, _time_ms: u32, _user_data: &mut T) -> anyhow::Result<()> {
Ok(())
}
}
+1 -1
View File
@@ -42,7 +42,7 @@ impl<T> Tab<T> for TabMonado<T> {
TabType::Games
}
fn update(&mut self, frontend: &mut Frontend<T>, data: &mut T) -> anyhow::Result<()> {
fn update(&mut self, frontend: &mut Frontend<T>, _time_ms: u32, data: &mut T) -> anyhow::Result<()> {
for task in self.tasks.drain() {
match task {
Task::Refresh => self.refresh(frontend, data)?,
-70
View File
@@ -1,70 +0,0 @@
use std::marker::PhantomData;
use wgui::{
assets::AssetPath,
layout::WidgetID,
parser::{Fetchable, ParseDocumentParams, ParserState},
};
use crate::{
frontend::Frontend,
tab::{Tab, TabType},
views::{process_list, window_list},
};
pub struct TabProcesses<T> {
#[allow(dead_code)]
pub state: ParserState,
view_window_list: window_list::View,
view_process_list: process_list::View,
marker: PhantomData<T>,
}
impl<T> Tab<T> for TabProcesses<T> {
fn get_type(&self) -> TabType {
TabType::Games
}
fn update(&mut self, frontend: &mut Frontend<T>, data: &mut T) -> anyhow::Result<()> {
self
.view_window_list
.update(&mut frontend.layout, &mut frontend.interface, data)?;
self
.view_process_list
.update(&mut frontend.layout, &mut frontend.interface, data)?;
Ok(())
}
}
impl<T> TabProcesses<T> {
pub fn new(frontend: &mut Frontend<T>, parent_id: WidgetID) -> anyhow::Result<Self> {
let globals = frontend.layout.state.globals.clone();
let state = wgui::parser::parse_from_assets(
&ParseDocumentParams {
globals: globals.clone(),
path: AssetPath::BuiltIn("gui/tab/processes.xml"),
extra: Default::default(),
},
&mut frontend.layout,
parent_id,
)?;
Ok(Self {
view_window_list: window_list::View::new(window_list::Params {
layout: &mut frontend.layout,
parent_id: state.get_widget_id("window_list_parent")?,
globals: globals.clone(),
frontend_tasks: frontend.tasks.clone(),
on_click: None,
})?,
view_process_list: process_list::View::new(process_list::Params {
layout: &mut frontend.layout,
parent_id: state.get_widget_id("process_list_parent")?,
globals,
})?,
state,
marker: PhantomData,
})
}
}
+428 -222
View File
@@ -4,33 +4,72 @@ use glam::Vec2;
use strum::{AsRefStr, EnumProperty, EnumString, VariantArray};
use wgui::{
assets::AssetPath,
components::{button::ComponentButton, checkbox::ComponentCheckbox, slider::ComponentSlider},
components::{
button::{ButtonClickEvent, ComponentButton},
checkbox::ComponentCheckbox,
slider::ComponentSlider,
tabs::ComponentTabs,
},
drawing,
event::{CallbackDataCommon, EventAlterables},
globals::WguiGlobals,
i18n::Translation,
layout::{Layout, WidgetID},
log::LogErr,
parser::{Fetchable, ParseDocumentParams, ParserState},
renderer_vk::text::{FontWeight, TextStyle},
taffy::{self, prelude::length},
task::Tasks,
widget::label::WidgetLabel,
widget::{
div::WidgetDiv,
label::{WidgetLabel, WidgetLabelParams},
},
windowing::context_menu::{self, Blueprint, ContextMenu, TickResult},
};
use wlx_common::{config::GeneralConfig, config_io::ConfigRoot};
use wlx_common::{config::GeneralConfig, config_io::ConfigRoot, dash_interface::RecenterMode};
use crate::{
frontend::{Frontend, FrontendTask},
tab::{Tab, TabType},
};
#[derive(Clone)]
enum TabNameEnum {
LookAndFeel,
Features,
Controls,
Misc,
AutostartApps,
Troubleshooting,
}
impl TabNameEnum {
fn from_string(s: &str) -> Option<Self> {
match s {
"look_and_feel" => Some(TabNameEnum::LookAndFeel),
"features" => Some(TabNameEnum::Features),
"controls" => Some(TabNameEnum::Controls),
"misc" => Some(TabNameEnum::Misc),
"autostart_apps" => Some(TabNameEnum::AutostartApps),
"troubleshooting" => Some(TabNameEnum::Troubleshooting),
_ => None,
}
}
}
enum Task {
UpdateBool(SettingType, bool),
UpdateFloat(SettingType, f32),
UpdateInt(SettingType, i32),
SettingUpdated(SettingType),
OpenContextMenu(Vec2, Vec<context_menu::Cell>),
ClearPipewireTokens,
ClearSavedState,
DeleteAllConfigs,
ResetPlayspace,
RestartSoftware,
RemoveAutostartApp(Rc<str>),
SetTab(TabNameEnum),
}
pub struct TabSettings<T> {
@@ -48,23 +87,37 @@ impl<T> Tab<T> for TabSettings<T> {
TabType::Settings
}
fn update(&mut self, frontend: &mut Frontend<T>, data: &mut T) -> anyhow::Result<()> {
let config = frontend.interface.general_config(data);
fn update(&mut self, frontend: &mut Frontend<T>, _time_ms: u32, data: &mut T) -> anyhow::Result<()> {
let mut changed = false;
for task in self.tasks.drain() {
match task {
Task::SetTab(tab) => {
self.set_tab(frontend, data, tab)?;
}
Task::UpdateBool(setting, n) => {
setting.get_frontend_task().map(|task| frontend.tasks.push(task));
self.tasks.push(Task::SettingUpdated(setting));
if let Some(task) = setting.get_frontend_task() {
frontend.tasks.push(task)
}
let config = frontend.interface.general_config(data);
*setting.mut_bool(config) = n;
changed = true;
}
Task::UpdateFloat(setting, n) => {
setting.get_frontend_task().map(|task| frontend.tasks.push(task));
self.tasks.push(Task::SettingUpdated(setting));
if let Some(task) = setting.get_frontend_task() {
frontend.tasks.push(task)
}
let config = frontend.interface.general_config(data);
*setting.mut_f32(config) = n;
changed = true;
}
Task::UpdateInt(setting, n) => {
setting.get_frontend_task().map(|task| frontend.tasks.push(task));
self.tasks.push(Task::SettingUpdated(setting));
if let Some(task) = setting.get_frontend_task() {
frontend.tasks.push(task)
}
let config = frontend.interface.general_config(data);
*setting.mut_i32(config) = n;
changed = true;
}
@@ -81,6 +134,10 @@ impl<T> Tab<T> for TabSettings<T> {
std::fs::remove_dir_all(&path)?;
std::fs::create_dir(&path)?;
}
Task::ResetPlayspace => {
frontend.interface.recenter_playspace(data, RecenterMode::Reset)?;
return Ok(());
}
Task::RestartSoftware => {
frontend.interface.restart(data);
return Ok(());
@@ -98,41 +155,48 @@ impl<T> Tab<T> for TabSettings<T> {
self.state.get_widget_id(&format!("{button_id}_root")),
) {
self.app_button_ids.remove(idx);
let config = frontend.interface.general_config(data);
config.autostart_apps.remove(idx);
frontend.layout.remove_widget(widget);
changed = true;
}
}
Task::SettingUpdated(setting) => match setting {
SettingType::UiAnimationSpeed | SettingType::UiGradientIntensity | SettingType::UiRoundMultiplier => {
// todo: currently, wayvr restart is required to apply these changes (WguiTheme is Rc)
}
_ => { /* do nothing */ }
},
}
}
// Dropdown handling
if let TickResult::Action(name) = self.context_menu.tick(&mut frontend.layout, &mut self.state)? {
if let (Some(setting), Some(id), Some(value), Some(text), Some(translated)) = {
if let TickResult::Action(name) = self.context_menu.tick(&mut frontend.layout, &mut self.state)?
&& let (Some(setting), Some(id), Some(value), Some(text), Some(translated)) = {
let mut s = name.splitn(5, ';');
(s.next(), s.next(), s.next(), s.next(), s.next())
} {
let mut label = self
.state
.fetch_widget_as::<WidgetLabel>(&frontend.layout.state, &format!("{id}_value"))?;
let mut label = self
.state
.fetch_widget_as::<WidgetLabel>(&frontend.layout.state, &format!("{id}_value"))?;
let mut alterables = EventAlterables::default();
let mut common = CallbackDataCommon {
alterables: &mut alterables,
state: &frontend.layout.state,
};
let mut alterables = EventAlterables::default();
let mut common = CallbackDataCommon {
alterables: &mut alterables,
state: &frontend.layout.state,
};
let translation = Translation {
text: text.into(),
translated: translated == "1",
};
let translation = Translation {
text: text.into(),
translated: translated == "1",
};
label.set_text(&mut common, translation);
label.set_text(&mut common, translation);
let setting = SettingType::from_str(setting).expect("Invalid Enum string");
setting.set_enum(config, value);
changed = true;
}
let setting = SettingType::from_str(setting).expect("Invalid Enum string");
let config = frontend.interface.general_config(data);
setting.set_enum(config, value);
changed = true;
}
// Notify overlays of the change
@@ -144,47 +208,53 @@ impl<T> Tab<T> for TabSettings<T> {
}
}
// Sorted alphabetically
#[allow(clippy::enum_variant_names)]
#[derive(Clone, Copy, AsRefStr, EnumString)]
enum SettingType {
AnimationSpeed,
RoundMultiplier,
AllowSliding,
BlockGameInput,
BlockGameInputIgnoreWatch,
BlockPosesOnKbdInteraction,
CaptureMethod,
ClickFreezeTimeMs,
Clock12h,
DoubleCursorFix,
FocusFollowsMouseMode,
HandsfreePointer,
HideGrabHelp,
HideUsername,
InvertScrollDirectionX,
InvertScrollDirectionY,
ScrollSpeed,
KeyboardMiddleClick,
KeyboardSoundEnabled,
Language,
LeftHandedMouse,
LongPressDuration,
NotificationsEnabled,
NotificationsSoundEnabled,
KeyboardSoundEnabled,
UprightScreenFix,
DoubleCursorFix,
SetsOnWatch,
HideGrabHelp,
XrClickSensitivity,
XrClickSensitivityRelease,
AllowSliding,
ClickFreezeTimeMs,
FocusFollowsMouseMode,
LeftHandedMouse,
BlockGameInput,
BlockGameInputIgnoreWatch,
SpaceDragMultiplier,
UseSkybox,
UsePassthrough,
ScreenRenderDown,
OpaqueBackground,
PointerLerpFactor,
ScreenRenderDown,
ScrollSpeed,
SetsOnWatch,
SpaceDragMultiplier,
SpaceDragUnlocked,
SpaceRotateUnlocked,
Clock12h,
HideUsername,
OpaqueBackground,
UiAnimationSpeed,
UiGradientIntensity,
UiRoundMultiplier,
UprightScreenFix,
UsePassthrough,
UseSkybox,
GridOpacity,
XrClickSensitivity,
XrClickSensitivityRelease,
XwaylandByDefault,
CaptureMethod,
KeyboardMiddleClick,
}
impl SettingType {
pub fn mut_bool<'a>(self, config: &'a mut GeneralConfig) -> &'a mut bool {
pub fn mut_bool(self, config: &mut GeneralConfig) -> &mut bool {
match self {
Self::InvertScrollDirectionX => &mut config.invert_scroll_direction_x,
Self::InvertScrollDirectionY => &mut config.invert_scroll_direction_y,
@@ -200,6 +270,7 @@ impl SettingType {
Self::LeftHandedMouse => &mut config.left_handed_mouse,
Self::BlockGameInput => &mut config.block_game_input,
Self::BlockGameInputIgnoreWatch => &mut config.block_game_input_ignore_watch,
Self::BlockPosesOnKbdInteraction => &mut config.block_poses_on_kbd_interaction,
Self::UseSkybox => &mut config.use_skybox,
Self::UsePassthrough => &mut config.use_passthrough,
Self::ScreenRenderDown => &mut config.screen_render_down,
@@ -213,28 +284,30 @@ impl SettingType {
}
}
pub fn mut_f32<'a>(self, config: &'a mut GeneralConfig) -> &'a mut f32 {
pub fn mut_f32(self, config: &mut GeneralConfig) -> &mut f32 {
match self {
Self::AnimationSpeed => &mut config.animation_speed,
Self::RoundMultiplier => &mut config.round_multiplier,
Self::UiAnimationSpeed => &mut config.ui_animation_speed,
Self::UiGradientIntensity => &mut config.ui_gradient_intensity,
Self::UiRoundMultiplier => &mut config.ui_round_multiplier,
Self::ScrollSpeed => &mut config.scroll_speed,
Self::LongPressDuration => &mut config.long_press_duration,
Self::XrClickSensitivity => &mut config.xr_click_sensitivity,
Self::XrClickSensitivityRelease => &mut config.xr_click_sensitivity_release,
Self::SpaceDragMultiplier => &mut config.space_drag_multiplier,
Self::PointerLerpFactor => &mut config.pointer_lerp_factor,
Self::GridOpacity => &mut config.grid_opacity,
_ => panic!("Requested f32 for non-f32 SettingType"),
}
}
pub fn mut_i32<'a>(self, config: &'a mut GeneralConfig) -> &'a mut i32 {
pub fn mut_i32(self, config: &mut GeneralConfig) -> &mut i32 {
match self {
Self::ClickFreezeTimeMs => &mut config.click_freeze_time_ms,
_ => panic!("Requested i32 for non-i32 SettingType"),
}
}
pub fn set_enum<'a>(self, config: &'a mut GeneralConfig, value: &str) {
pub fn set_enum(self, config: &mut GeneralConfig, value: &str) {
match self {
Self::CaptureMethod => {
config.capture_method = wlx_common::config::CaptureMethod::from_str(value).expect("Invalid enum value!")
@@ -243,14 +316,25 @@ impl SettingType {
config.keyboard_middle_click_mode =
wlx_common::config::AltModifier::from_str(value).expect("Invalid enum value!")
}
Self::HandsfreePointer => {
config.handsfree_pointer = wlx_common::config::HandsfreePointer::from_str(value).expect("Invalid enum value!")
}
Self::Language => {
config.language = Some(wlx_common::locale::Language::from_str(value).expect("Invalid enum value!"))
}
_ => panic!("Requested enum for non-enum SettingType"),
}
}
fn get_enum_title<'a>(self, config: &'a mut GeneralConfig) -> Translation {
fn get_enum_title(self, config: &mut GeneralConfig) -> Translation {
match self {
Self::CaptureMethod => Self::get_enum_title_inner(config.capture_method),
Self::KeyboardMiddleClick => Self::get_enum_title_inner(config.keyboard_middle_click_mode),
Self::HandsfreePointer => Self::get_enum_title_inner(config.handsfree_pointer),
Self::Language => match &config.language {
Some(lang) => Self::get_enum_title_inner(*lang),
None => Translation::from_translation_key("APP_SETTINGS.OPTION.AUTO"),
},
_ => panic!("Requested enum for non-enum SettingType"),
}
}
@@ -261,8 +345,8 @@ impl SettingType {
{
value
.get_str("Translation")
.map(|x| Translation::from_translation_key(x))
.or_else(|| value.get_str("Text").map(|x| Translation::from_raw_text(x)))
.map(Translation::from_translation_key)
.or_else(|| value.get_str("Text").map(Translation::from_raw_text))
.unwrap_or_else(|| Translation::from_raw_text(value.as_ref()))
}
@@ -270,81 +354,89 @@ impl SettingType {
where
E: EnumProperty + AsRef<str>,
{
value.get_str("Tooltip").map(|x| Translation::from_translation_key(x))
value.get_str("Tooltip").map(Translation::from_translation_key)
}
/// Ok is translation, Err is raw text
/// `match` sorted alphabetically
fn get_translation(self) -> Result<&'static str, &'static str> {
match self {
Self::AnimationSpeed => Ok("APP_SETTINGS.ANIMATION_SPEED"),
Self::RoundMultiplier => Ok("APP_SETTINGS.ROUND_MULTIPLIER"),
Self::AllowSliding => Ok("APP_SETTINGS.ALLOW_SLIDING"),
Self::BlockGameInput => Ok("APP_SETTINGS.BLOCK_GAME_INPUT"),
Self::BlockGameInputIgnoreWatch => Ok("APP_SETTINGS.BLOCK_GAME_INPUT_IGNORE_WATCH"),
Self::BlockPosesOnKbdInteraction => Ok("APP_SETTINGS.BLOCK_POSES_ON_KBD_INTERACTION"),
Self::CaptureMethod => Ok("APP_SETTINGS.CAPTURE_METHOD"),
Self::ClickFreezeTimeMs => Ok("APP_SETTINGS.CLICK_FREEZE_TIME_MS"),
Self::Clock12h => Ok("APP_SETTINGS.CLOCK_12H"),
Self::DoubleCursorFix => Ok("APP_SETTINGS.DOUBLE_CURSOR_FIX"),
Self::FocusFollowsMouseMode => Ok("APP_SETTINGS.FOCUS_FOLLOWS_MOUSE_MODE"),
Self::GridOpacity => Ok("APP_SETTINGS.GRID_OPACITY"),
Self::HandsfreePointer => Ok("APP_SETTINGS.HANDSFREE_POINTER"),
Self::HideGrabHelp => Ok("APP_SETTINGS.HIDE_GRAB_HELP"),
Self::HideUsername => Ok("APP_SETTINGS.HIDE_USERNAME"),
Self::InvertScrollDirectionX => Ok("APP_SETTINGS.INVERT_SCROLL_DIRECTION_X"),
Self::InvertScrollDirectionY => Ok("APP_SETTINGS.INVERT_SCROLL_DIRECTION_Y"),
Self::ScrollSpeed => Ok("APP_SETTINGS.SCROLL_SPEED"),
Self::KeyboardMiddleClick => Ok("APP_SETTINGS.KEYBOARD_MIDDLE_CLICK"),
Self::KeyboardSoundEnabled => Ok("APP_SETTINGS.KEYBOARD_SOUND_ENABLED"),
Self::Language => Ok("APP_SETTINGS.LANGUAGE"),
Self::LeftHandedMouse => Ok("APP_SETTINGS.LEFT_HANDED_MOUSE"),
Self::LongPressDuration => Ok("APP_SETTINGS.LONG_PRESS_DURATION"),
Self::NotificationsEnabled => Ok("APP_SETTINGS.NOTIFICATIONS_ENABLED"),
Self::NotificationsSoundEnabled => Ok("APP_SETTINGS.NOTIFICATIONS_SOUND_ENABLED"),
Self::KeyboardSoundEnabled => Ok("APP_SETTINGS.KEYBOARD_SOUND_ENABLED"),
Self::UprightScreenFix => Ok("APP_SETTINGS.UPRIGHT_SCREEN_FIX"),
Self::DoubleCursorFix => Ok("APP_SETTINGS.DOUBLE_CURSOR_FIX"),
Self::SetsOnWatch => Ok("APP_SETTINGS.SETS_ON_WATCH"),
Self::HideGrabHelp => Ok("APP_SETTINGS.HIDE_GRAB_HELP"),
Self::XrClickSensitivity => Ok("APP_SETTINGS.XR_CLICK_SENSITIVITY"),
Self::XrClickSensitivityRelease => Ok("APP_SETTINGS.XR_CLICK_SENSITIVITY_RELEASE"),
Self::AllowSliding => Ok("APP_SETTINGS.ALLOW_SLIDING"),
Self::ClickFreezeTimeMs => Ok("APP_SETTINGS.CLICK_FREEZE_TIME_MS"),
Self::FocusFollowsMouseMode => Ok("APP_SETTINGS.FOCUS_FOLLOWS_MOUSE_MODE"),
Self::LeftHandedMouse => Ok("APP_SETTINGS.LEFT_HANDED_MOUSE"),
Self::BlockGameInput => Ok("APP_SETTINGS.BLOCK_GAME_INPUT"),
Self::BlockGameInputIgnoreWatch => Ok("APP_SETTINGS.BLOCK_GAME_INPUT_IGNORE_WATCH"),
Self::SpaceDragMultiplier => Ok("APP_SETTINGS.SPACE_DRAG_MULTIPLIER"),
Self::UseSkybox => Ok("APP_SETTINGS.USE_SKYBOX"),
Self::UsePassthrough => Ok("APP_SETTINGS.USE_PASSTHROUGH"),
Self::ScreenRenderDown => Ok("APP_SETTINGS.SCREEN_RENDER_DOWN"),
Self::OpaqueBackground => Ok("APP_SETTINGS.OPAQUE_BACKGROUND"),
Self::PointerLerpFactor => Ok("APP_SETTINGS.POINTER_LERP_FACTOR"),
Self::ScreenRenderDown => Ok("APP_SETTINGS.SCREEN_RENDER_DOWN"),
Self::ScrollSpeed => Ok("APP_SETTINGS.SCROLL_SPEED"),
Self::SetsOnWatch => Ok("APP_SETTINGS.SETS_ON_WATCH"),
Self::SpaceDragMultiplier => Ok("APP_SETTINGS.SPACE_DRAG_MULTIPLIER"),
Self::SpaceDragUnlocked => Ok("APP_SETTINGS.SPACE_DRAG_UNLOCKED"),
Self::SpaceRotateUnlocked => Ok("APP_SETTINGS.SPACE_ROTATE_UNLOCKED"),
Self::Clock12h => Ok("APP_SETTINGS.CLOCK_12H"),
Self::HideUsername => Ok("APP_SETTINGS.HIDE_USERNAME"),
Self::OpaqueBackground => Ok("APP_SETTINGS.OPAQUE_BACKGROUND"),
Self::UiAnimationSpeed => Ok("APP_SETTINGS.ANIMATION_SPEED"),
Self::UiGradientIntensity => Ok("APP_SETTINGS.UI_GRADIENT_INTENSITY"),
Self::UiRoundMultiplier => Ok("APP_SETTINGS.ROUND_MULTIPLIER"),
Self::UprightScreenFix => Ok("APP_SETTINGS.UPRIGHT_SCREEN_FIX"),
Self::UsePassthrough => Ok("APP_SETTINGS.USE_PASSTHROUGH"),
Self::UseSkybox => Ok("APP_SETTINGS.USE_SKYBOX"),
Self::XrClickSensitivity => Ok("APP_SETTINGS.XR_CLICK_SENSITIVITY"),
Self::XrClickSensitivityRelease => Ok("APP_SETTINGS.XR_CLICK_SENSITIVITY_RELEASE"),
Self::XwaylandByDefault => Ok("APP_SETTINGS.XWAYLAND_BY_DEFAULT"),
Self::CaptureMethod => Ok("APP_SETTINGS.CAPTURE_METHOD"),
Self::KeyboardMiddleClick => Ok("APP_SETTINGS.KEYBOARD_MIDDLE_CLICK"),
}
}
/// `match` sorted alphabetically
fn get_tooltip(self) -> Option<&'static str> {
match self {
Self::UprightScreenFix => Some("APP_SETTINGS.UPRIGHT_SCREEN_FIX_HELP"),
Self::DoubleCursorFix => Some("APP_SETTINGS.DOUBLE_CURSOR_FIX_HELP"),
Self::XrClickSensitivity => Some("APP_SETTINGS.XR_CLICK_SENSITIVITY_HELP"),
Self::XrClickSensitivityRelease => Some("APP_SETTINGS.XR_CLICK_SENSITIVITY_RELEASE_HELP"),
Self::FocusFollowsMouseMode => Some("APP_SETTINGS.FOCUS_FOLLOWS_MOUSE_MODE_HELP"),
Self::LeftHandedMouse => Some("APP_SETTINGS.LEFT_HANDED_MOUSE_HELP"),
Self::BlockGameInput => Some("APP_SETTINGS.BLOCK_GAME_INPUT_HELP"),
Self::BlockGameInputIgnoreWatch => Some("APP_SETTINGS.BLOCK_GAME_INPUT_IGNORE_WATCH_HELP"),
Self::UseSkybox => Some("APP_SETTINGS.USE_SKYBOX_HELP"),
Self::UsePassthrough => Some("APP_SETTINGS.USE_PASSTHROUGH_HELP"),
Self::ScreenRenderDown => Some("APP_SETTINGS.SCREEN_RENDER_DOWN_HELP"),
Self::BlockPosesOnKbdInteraction => Some("APP_SETTINGS.BLOCK_POSES_ON_KBD_INTERACTION_HELP"),
Self::CaptureMethod => Some("APP_SETTINGS.CAPTURE_METHOD_HELP"),
Self::DoubleCursorFix => Some("APP_SETTINGS.DOUBLE_CURSOR_FIX_HELP"),
Self::GridOpacity => Some("APP_SETTINGS.GRID_OPACITY_HELP"),
Self::HandsfreePointer => Some("APP_SETTINGS.HANDSFREE_POINTER_HELP"),
Self::KeyboardMiddleClick => Some("APP_SETTINGS.KEYBOARD_MIDDLE_CLICK_HELP"),
Self::LeftHandedMouse => Some("APP_SETTINGS.LEFT_HANDED_MOUSE_HELP"),
Self::ScreenRenderDown => Some("APP_SETTINGS.SCREEN_RENDER_DOWN_HELP"),
Self::UprightScreenFix => Some("APP_SETTINGS.UPRIGHT_SCREEN_FIX_HELP"),
Self::UsePassthrough => Some("APP_SETTINGS.USE_PASSTHROUGH_HELP"),
Self::UseSkybox => Some("APP_SETTINGS.USE_SKYBOX_HELP"),
Self::XrClickSensitivity => Some("APP_SETTINGS.XR_CLICK_SENSITIVITY_HELP"),
Self::XrClickSensitivityRelease => Some("APP_SETTINGS.XR_CLICK_SENSITIVITY_RELEASE_HELP"),
_ => None,
}
}
//TODO: incorporate this
fn requires_restart(self) -> bool {
match self {
Self::AnimationSpeed
| Self::RoundMultiplier
| Self::UprightScreenFix
| Self::DoubleCursorFix
| Self::SetsOnWatch
| Self::UseSkybox
| Self::UsePassthrough
| Self::ScreenRenderDown => true,
_ => false,
}
matches!(
self,
Self::UiAnimationSpeed
| Self::UiRoundMultiplier
| Self::UiGradientIntensity
| Self::UprightScreenFix
| Self::DoubleCursorFix
| Self::ScreenRenderDown
| Self::Language
| Self::CaptureMethod
)
}
fn get_frontend_task(self) -> Option<FrontendTask> {
@@ -356,6 +448,42 @@ impl SettingType {
}
}
// creates a simple div with horizontal, centered flow
fn horiz_cell(layout: &mut Layout, parent: WidgetID) -> anyhow::Result<WidgetID> {
let (pair, _) = layout.add_child(
parent,
WidgetDiv::create(),
taffy::Style {
flex_direction: taffy::FlexDirection::Row,
align_items: Some(taffy::AlignItems::Center),
gap: length(8.0),
..Default::default()
},
)?;
Ok(pair.id)
}
fn mount_requires_restart(layout: &mut Layout, parent: WidgetID) -> anyhow::Result<()> {
let content = Translation::from_translation_key("APP_SETTINGS.REQUIRES_RESTART");
let label = WidgetLabel::create(
&mut layout.state,
WidgetLabelParams {
content,
style: TextStyle {
wrap: false,
color: Some(drawing::Color::new(1.0, 0.5, 0.5, 1.0)),
weight: Some(FontWeight::Bold),
size: Some(10.0),
..Default::default()
},
},
);
layout.add_child(parent, label, Default::default())?;
Ok(())
}
macro_rules! category {
($pe:expr, $root:expr, $translation:expr, $icon:expr) => {{
let id = $pe.idx.to_string();
@@ -394,9 +522,15 @@ macro_rules! checkbox {
let checked = if *$setting.mut_bool($mp.config) { "1" } else { "0" };
params.insert(Rc::from("checked"), Rc::from(checked));
let id_cell = horiz_cell($mp.layout, $root)?;
$mp
.parser_state
.instantiate_template($mp.doc_params, "CheckBoxSetting", $mp.layout, $root, params)?;
.instantiate_template($mp.doc_params, "CheckBoxSetting", $mp.layout, id_cell, params)?;
if $setting.requires_restart() {
mount_requires_restart($mp.layout, id_cell)?;
}
let checkbox = $mp.parser_state.fetch_component_as::<ComponentCheckbox>(&id)?;
checkbox.on_toggle(Box::new({
@@ -432,9 +566,15 @@ macro_rules! slider_f32 {
params.insert(Rc::from("max"), Rc::from($max.to_string()));
params.insert(Rc::from("step"), Rc::from($step.to_string()));
let id_cell = horiz_cell($mp.layout, $root)?;
$mp
.parser_state
.instantiate_template($mp.doc_params, "SliderSetting", $mp.layout, $root, params)?;
.instantiate_template($mp.doc_params, "SliderSetting", $mp.layout, id_cell, params)?;
if $setting.requires_restart() {
mount_requires_restart($mp.layout, id_cell)?;
}
let slider = $mp.parser_state.fetch_component_as::<ComponentSlider>(&id)?;
slider.on_value_changed(Box::new({
@@ -464,6 +604,8 @@ macro_rules! slider_i32 {
params.insert(Rc::from("tooltip"), Rc::from(tooltip));
}
let id_cell = horiz_cell($mp.layout, $root)?;
let value = $setting.mut_i32($mp.config).to_string();
params.insert(Rc::from("value"), Rc::from(value));
params.insert(Rc::from("min"), Rc::from($min.to_string()));
@@ -472,7 +614,11 @@ macro_rules! slider_i32 {
$mp
.parser_state
.instantiate_template($mp.doc_params, "SliderSetting", $mp.layout, $root, params)?;
.instantiate_template($mp.doc_params, "SliderSetting", $mp.layout, id_cell, params)?;
if $setting.requires_restart() {
mount_requires_restart($mp.layout, id_cell)?;
}
let slider = $mp.parser_state.fetch_component_as::<ComponentSlider>(&id)?;
slider.on_value_changed(Box::new({
@@ -486,7 +632,7 @@ macro_rules! slider_i32 {
}
macro_rules! dropdown {
($mp:expr, $root:expr, $setting:expr, $options:expr) => {
($mp:expr /* `MacroParams` struct */, $root:expr, $setting:expr, $options:expr) => {
let id = $mp.idx.to_string();
$mp.idx += 1;
@@ -502,9 +648,15 @@ macro_rules! dropdown {
params.insert(Rc::from("tooltip"), Rc::from(tooltip));
}
let id_cell = horiz_cell($mp.layout, $root)?;
$mp
.parser_state
.instantiate_template($mp.doc_params, "DropdownButton", $mp.layout, $root, params)?;
.instantiate_template($mp.doc_params, "DropdownButton", $mp.layout, id_cell, params)?;
if $setting.requires_restart() {
mount_requires_restart($mp.layout, id_cell)?;
}
let setting_str = $setting.as_ref();
let title = $setting.get_enum_title($mp.config);
@@ -517,9 +669,9 @@ macro_rules! dropdown {
}
let btn = $mp.parser_state.fetch_component_as::<ComponentButton>(&id)?;
btn.on_click(Box::new({
btn.on_click(Rc::new({
let tasks = $mp.tasks.clone();
move |_common, e| {
move |_common, e: ButtonClickEvent| {
tasks.push(Task::OpenContextMenu(
e.mouse_pos_absolute.unwrap_or_default(),
$options
@@ -566,7 +718,7 @@ macro_rules! danger_button {
.instantiate_template($mp.doc_params, "DangerButton", $mp.layout, $root, params)?;
let btn = $mp.parser_state.fetch_component_as::<ComponentButton>(&id)?;
btn.on_click(Box::new({
btn.on_click(Rc::new({
let tasks = $mp.tasks.clone();
move |_common, _e| {
tasks.push($task);
@@ -594,7 +746,7 @@ macro_rules! autostart_app {
$ids.push(id.clone());
btn.on_click(Box::new({
btn.on_click(Rc::new({
let tasks = $mp.tasks.clone();
move |_common, _e| {
tasks.push(Task::RemoveAutostartApp(id.clone()));
@@ -613,121 +765,175 @@ struct MacroParams<'a> {
idx: usize,
}
fn doc_params(globals: &'_ WguiGlobals) -> ParseDocumentParams<'_> {
ParseDocumentParams {
globals: globals.clone(),
path: AssetPath::BuiltIn("gui/tab/settings.xml"),
extra: Default::default(),
}
}
impl<T> TabSettings<T> {
pub fn new(frontend: &mut Frontend<T>, parent_id: WidgetID, data: &mut T) -> anyhow::Result<Self> {
fn set_tab(&mut self, frontend: &mut Frontend<T>, data: &mut T, name: TabNameEnum) -> anyhow::Result<()> {
let root = self.state.get_widget_id("settings_root")?;
frontend.layout.remove_children(root);
let globals = frontend.layout.state.globals.clone();
let mut mp = MacroParams {
layout: &mut frontend.layout,
parser_state: &mut self.state,
doc_params: &doc_params(&globals),
config: frontend.interface.general_config(data),
tasks: self.tasks.clone(),
idx: 9001,
};
match name {
TabNameEnum::LookAndFeel => {
let c = category!(mp, root, "APP_SETTINGS.LOOK_AND_FEEL", "dashboard/palette.svg")?;
dropdown!(mp, c, SettingType::Language, wlx_common::locale::Language::VARIANTS);
checkbox!(mp, c, SettingType::OpaqueBackground);
checkbox!(mp, c, SettingType::HideUsername);
checkbox!(mp, c, SettingType::HideGrabHelp);
slider_f32!(mp, c, SettingType::UiAnimationSpeed, 0.5, 5.0, 0.1); // min, max, step
slider_f32!(mp, c, SettingType::UiGradientIntensity, 0.0, 1.0, 0.05); // min, max, step
slider_f32!(mp, c, SettingType::UiRoundMultiplier, 0.5, 5.0, 0.1);
checkbox!(mp, c, SettingType::SetsOnWatch);
checkbox!(mp, c, SettingType::UseSkybox);
slider_f32!(mp, c, SettingType::GridOpacity, 0.0, 1.0, 0.05); // min, max, step
checkbox!(mp, c, SettingType::UsePassthrough);
checkbox!(mp, c, SettingType::Clock12h);
}
TabNameEnum::Features => {
let c = category!(mp, root, "APP_SETTINGS.FEATURES", "dashboard/options.svg")?;
checkbox!(mp, c, SettingType::NotificationsEnabled);
checkbox!(mp, c, SettingType::NotificationsSoundEnabled);
checkbox!(mp, c, SettingType::KeyboardSoundEnabled);
checkbox!(mp, c, SettingType::SpaceDragUnlocked);
checkbox!(mp, c, SettingType::SpaceRotateUnlocked);
slider_f32!(mp, c, SettingType::SpaceDragMultiplier, -10.0, 10.0, 0.5);
checkbox!(mp, c, SettingType::BlockGameInput);
checkbox!(mp, c, SettingType::BlockGameInputIgnoreWatch);
checkbox!(mp, c, SettingType::BlockPosesOnKbdInteraction);
}
TabNameEnum::Controls => {
let c = category!(mp, root, "APP_SETTINGS.CONTROLS", "dashboard/controller.svg")?;
dropdown!(
mp,
c,
SettingType::KeyboardMiddleClick,
wlx_common::config::AltModifier::VARIANTS
);
dropdown!(
mp,
c,
SettingType::HandsfreePointer,
wlx_common::config::HandsfreePointer::VARIANTS
);
checkbox!(mp, c, SettingType::FocusFollowsMouseMode);
checkbox!(mp, c, SettingType::LeftHandedMouse);
checkbox!(mp, c, SettingType::AllowSliding);
checkbox!(mp, c, SettingType::InvertScrollDirectionX);
checkbox!(mp, c, SettingType::InvertScrollDirectionY);
slider_f32!(mp, c, SettingType::ScrollSpeed, 0.1, 5.0, 0.1);
slider_f32!(mp, c, SettingType::LongPressDuration, 0.1, 2.0, 0.1);
slider_f32!(mp, c, SettingType::PointerLerpFactor, 0.1, 1.0, 0.1);
slider_f32!(mp, c, SettingType::XrClickSensitivity, 0.1, 1.0, 0.1);
slider_f32!(mp, c, SettingType::XrClickSensitivityRelease, 0.1, 1.0, 0.1);
slider_i32!(mp, c, SettingType::ClickFreezeTimeMs, 0, 500, 50);
}
TabNameEnum::Misc => {
let c = category!(mp, root, "APP_SETTINGS.MISC", "dashboard/blocks.svg")?;
dropdown!(
mp,
c,
SettingType::CaptureMethod,
wlx_common::config::CaptureMethod::VARIANTS
);
checkbox!(mp, c, SettingType::XwaylandByDefault);
checkbox!(mp, c, SettingType::UprightScreenFix);
checkbox!(mp, c, SettingType::DoubleCursorFix);
checkbox!(mp, c, SettingType::ScreenRenderDown);
}
TabNameEnum::AutostartApps => {
self.app_button_ids = vec![];
if !mp.config.autostart_apps.is_empty() {
let c = category!(mp, root, "APP_SETTINGS.AUTOSTART_APPS", "dashboard/apps.svg")?;
for app in &mp.config.autostart_apps {
autostart_app!(mp, c, app.name, self.app_button_ids);
}
}
}
TabNameEnum::Troubleshooting => {
let c = category!(mp, root, "APP_SETTINGS.TROUBLESHOOTING", "dashboard/cpu.svg")?;
danger_button!(
mp,
c,
"APP_SETTINGS.RESET_PLAYSPACE",
"dashboard/recenter.svg",
Task::ResetPlayspace
);
danger_button!(
mp,
c,
"APP_SETTINGS.CLEAR_PIPEWIRE_TOKENS",
"dashboard/display.svg",
Task::ClearPipewireTokens
);
danger_button!(
mp,
c,
"APP_SETTINGS.CLEAR_SAVED_STATE",
"dashboard/binary.svg",
Task::ClearSavedState
);
danger_button!(
mp,
c,
"APP_SETTINGS.DELETE_ALL_CONFIGS",
"dashboard/circle.svg",
Task::DeleteAllConfigs
);
danger_button!(
mp,
c,
"APP_SETTINGS.RESTART_SOFTWARE",
"dashboard/refresh.svg",
Task::RestartSoftware
);
}
}
Ok(())
}
pub fn new(frontend: &mut Frontend<T>, parent_id: WidgetID, _data: &mut T) -> anyhow::Result<Self> {
let doc_params = ParseDocumentParams {
globals: frontend.layout.state.globals.clone(),
path: AssetPath::BuiltIn("gui/tab/settings.xml"),
extra: Default::default(),
};
let mut parser_state = wgui::parser::parse_from_assets(&doc_params, &mut frontend.layout, parent_id)?;
let root = parser_state.get_widget_id("settings_root")?;
let parser_state = wgui::parser::parse_from_assets(&doc_params, &mut frontend.layout, parent_id)?;
let tasks = Tasks::default();
let tabs = parser_state.fetch_component_as::<ComponentTabs>("tabs")?;
tabs.on_select({
let tasks = tasks.clone();
Rc::new(move |_common, evt| {
if let Some(tab) = TabNameEnum::from_string(&evt.name) {
tasks.push(Task::SetTab(tab));
}
Ok(())
})
});
let mut mp = MacroParams {
layout: &mut frontend.layout,
parser_state: &mut parser_state,
doc_params: &doc_params,
config: frontend.interface.general_config(data),
tasks: Tasks::default(),
idx: 9001,
};
let c = category!(mp, root, "APP_SETTINGS.LOOK_AND_FEEL", "dashboard/palette.svg")?;
checkbox!(mp, c, SettingType::OpaqueBackground);
checkbox!(mp, c, SettingType::HideUsername);
checkbox!(mp, c, SettingType::HideGrabHelp);
slider_f32!(mp, c, SettingType::AnimationSpeed, 0.5, 5.0, 0.1); // min, max, step
slider_f32!(mp, c, SettingType::RoundMultiplier, 0.5, 5.0, 0.1);
checkbox!(mp, c, SettingType::SetsOnWatch);
checkbox!(mp, c, SettingType::UseSkybox);
checkbox!(mp, c, SettingType::UsePassthrough);
checkbox!(mp, c, SettingType::Clock12h);
let c = category!(mp, root, "APP_SETTINGS.FEATURES", "dashboard/options.svg")?;
checkbox!(mp, c, SettingType::NotificationsEnabled);
checkbox!(mp, c, SettingType::NotificationsSoundEnabled);
checkbox!(mp, c, SettingType::KeyboardSoundEnabled);
checkbox!(mp, c, SettingType::SpaceDragUnlocked);
checkbox!(mp, c, SettingType::SpaceRotateUnlocked);
slider_f32!(mp, c, SettingType::SpaceDragMultiplier, -10.0, 10.0, 0.5);
checkbox!(mp, c, SettingType::BlockGameInput);
checkbox!(mp, c, SettingType::BlockGameInputIgnoreWatch);
let c = category!(mp, root, "APP_SETTINGS.CONTROLS", "dashboard/controller.svg")?;
dropdown!(
mp,
c,
SettingType::KeyboardMiddleClick,
wlx_common::config::AltModifier::VARIANTS
);
checkbox!(mp, c, SettingType::FocusFollowsMouseMode);
checkbox!(mp, c, SettingType::LeftHandedMouse);
checkbox!(mp, c, SettingType::AllowSliding);
checkbox!(mp, c, SettingType::InvertScrollDirectionX);
checkbox!(mp, c, SettingType::InvertScrollDirectionY);
slider_f32!(mp, c, SettingType::ScrollSpeed, 0.1, 5.0, 0.1);
slider_f32!(mp, c, SettingType::LongPressDuration, 0.1, 2.0, 0.1);
slider_f32!(mp, c, SettingType::PointerLerpFactor, 0.1, 1.0, 0.1);
slider_f32!(mp, c, SettingType::XrClickSensitivity, 0.1, 1.0, 0.1);
slider_f32!(mp, c, SettingType::XrClickSensitivityRelease, 0.1, 1.0, 0.1);
slider_i32!(mp, c, SettingType::ClickFreezeTimeMs, 0, 500, 50);
let c = category!(mp, root, "APP_SETTINGS.MISC", "dashboard/blocks.svg")?;
dropdown!(
mp,
c,
SettingType::CaptureMethod,
wlx_common::config::CaptureMethod::VARIANTS
);
checkbox!(mp, c, SettingType::XwaylandByDefault);
checkbox!(mp, c, SettingType::UprightScreenFix);
checkbox!(mp, c, SettingType::DoubleCursorFix);
checkbox!(mp, c, SettingType::ScreenRenderDown);
let mut app_button_ids = vec![];
if !mp.config.autostart_apps.is_empty() {
let c = category!(mp, root, "APP_SETTINGS.AUTOSTART_APPS", "dashboard/apps.svg")?;
for app in &mp.config.autostart_apps {
autostart_app!(mp, c, app.name, app_button_ids);
}
}
let c = category!(mp, root, "APP_SETTINGS.TROUBLESHOOTING", "dashboard/cpu.svg")?;
danger_button!(
mp,
c,
"APP_SETTINGS.CLEAR_PIPEWIRE_TOKENS",
"dashboard/display.svg",
Task::ClearPipewireTokens
);
danger_button!(
mp,
c,
"APP_SETTINGS.CLEAR_SAVED_STATE",
"dashboard/binary.svg",
Task::ClearSavedState
);
danger_button!(
mp,
c,
"APP_SETTINGS.DELETE_ALL_CONFIGS",
"dashboard/circle.svg",
Task::DeleteAllConfigs
);
danger_button!(
mp,
c,
"APP_SETTINGS.RESTART_SOFTWARE",
"dashboard/refresh.svg",
Task::RestartSoftware
);
tasks.push(Task::SetTab(TabNameEnum::LookAndFeel));
Ok(Self {
app_button_ids,
tasks: mp.tasks,
app_button_ids: Vec::new(),
tasks,
state: parser_state,
marker: PhantomData,
context_menu: ContextMenu::default(),
+1
View File
@@ -5,3 +5,4 @@ pub mod popup_manager;
pub mod steam_utils;
pub mod toast_manager;
pub mod various;
pub mod wgui_simple;
+1 -1
View File
@@ -163,7 +163,7 @@ impl PopupManager {
but_back.on_click({
let popup_handle = Rc::downgrade(&popup_handle.state);
Box::new(move |_common, _evt| {
Rc::new(move |_common, _evt| {
if let Some(popup_handle) = popup_handle.upgrade() {
popup_handle.borrow_mut().mounted_popup = None; // will call Drop
}
+10 -6
View File
@@ -32,7 +32,10 @@ pub struct AppManifest {
pub last_played: Option<u64>, // unix timestamp
}
// TODO @oo8dev: game sort methods
#[allow(dead_code)]
pub enum GameSortMethod {
None,
NameAsc,
NameDesc,
PlayDateDesc,
@@ -119,6 +122,12 @@ struct AppEntry {
pub app_id: AppID,
}
pub fn launch(app_id: &AppID) -> anyhow::Result<()> {
log::info!("Launching Steam game with AppID {}", app_id);
call_steam(&format!("steam://rungameid/{}", app_id))?;
Ok(())
}
pub fn stop(app_id: AppID, force_kill: bool) -> anyhow::Result<()> {
log::info!("Stopping Steam game with AppID {}", app_id);
@@ -137,12 +146,6 @@ pub fn stop(app_id: AppID, force_kill: bool) -> anyhow::Result<()> {
Ok(())
}
pub fn launch(app_id: &AppID) -> anyhow::Result<()> {
log::info!("Launching Steam game with AppID {}", app_id);
call_steam(&format!("steam://rungameid/{}", app_id))?;
Ok(())
}
#[derive(Serialize)]
pub struct RunningGame {
pub app_id: AppID,
@@ -281,6 +284,7 @@ impl SteamUtils {
.collect();
match sort_method {
GameSortMethod::None => {}
GameSortMethod::NameAsc => {
games.sort_by(|a, b| a.name.cmp(&b.name));
}
+16 -28
View File
@@ -5,7 +5,6 @@ use wgui::{
animation::{Animation, AnimationEasing},
components::tooltip::{TOOLTIP_BORDER_COLOR, TOOLTIP_COLOR},
drawing::Color,
globals::WguiGlobals,
i18n::Translation,
layout::{Layout, LayoutTask, LayoutTasks, WidgetID},
renderer_vk::{
@@ -61,15 +60,7 @@ impl ToastManager {
}
}
fn mount_toast(
&self,
globals: &WguiGlobals,
layout: &mut Layout,
state: &mut State,
content: Translation,
) -> anyhow::Result<()> {
let mut globals = globals.get();
fn mount_toast(&self, layout: &mut Layout, state: &mut State, content: Translation) -> anyhow::Result<()> {
let (root, _) = layout.add_topmost_child(
WidgetDiv::create(),
taffy::Style {
@@ -110,27 +101,24 @@ impl ToastManager {
},
)?;
let (label, _) = layout.add_child(
rect.id,
WidgetLabel::create(
&mut globals,
WidgetLabelParams {
content,
style: TextStyle {
weight: Some(FontWeight::Bold),
align: Some(HorizontalAlign::Center),
wrap: true,
..Default::default()
},
let label = WidgetLabel::create(
&mut layout.state,
WidgetLabelParams {
content,
style: TextStyle {
weight: Some(FontWeight::Bold),
align: Some(HorizontalAlign::Center),
wrap: true,
..Default::default()
},
),
taffy::Style { ..Default::default() },
)?;
},
);
let (label, _) = layout.add_child(rect.id, label, taffy::Style { ..Default::default() })?;
// show-up animation
layout.animations.add(Animation::new(
rect.id,
(TOAST_DURATION_TICKS as f32 * globals.defaults.animation_mult) as u32,
(TOAST_DURATION_TICKS as f32 * layout.state.theme.animation_mult) as u32,
AnimationEasing::Linear,
Box::new(move |common, data| {
let pos_showup = AnimationEasing::OutQuint.interpolate((data.pos * 4.0).min(1.0));
@@ -161,7 +149,7 @@ impl ToastManager {
Ok(())
}
pub fn tick(&mut self, globals: &WguiGlobals, layout: &mut Layout) -> anyhow::Result<()> {
pub fn tick(&mut self, layout: &mut Layout) -> anyhow::Result<()> {
let mut state = self.state.borrow_mut();
if state.timeout > 0 {
state.timeout -= 1;
@@ -176,7 +164,7 @@ impl ToastManager {
state.timeout = TOAST_DURATION_TICKS;
// mount next
if let Some(content) = state.queue.pop_front() {
self.mount_toast(globals, layout, &mut state, content)?;
self.mount_toast(layout, &mut state, content)?;
}
}
+1 -75
View File
@@ -1,77 +1,3 @@
use std::{path::PathBuf, rc::Rc, str::FromStr};
use wgui::{
assets::{AssetPath, AssetPathOwned},
globals::WguiGlobals,
i18n::Translation,
layout::{Layout, WidgetID},
renderer_vk::text::custom_glyph::CustomGlyphData,
taffy::{self, prelude::length},
widget::{
label::{WidgetLabel, WidgetLabelParams},
sprite::{WidgetSprite, WidgetSpriteParams},
},
};
use wlx_common::desktop_finder;
use std::rc::Rc;
pub type AsyncExecutor = Rc<smol::LocalExecutor<'static>>;
// the compiler wants to scream
#[allow(irrefutable_let_patterns)]
pub fn get_desktop_file_icon_path(desktop_file: &desktop_finder::DesktopEntry) -> AssetPathOwned {
/*
FIXME: why is the compiler complaining about trailing irrefutable patterns there?!?!
looking at the PathBuf::from_str implementation, it always returns Ok() and it's inline, maybe that's why.
*/
if let Some(icon) = &desktop_file.icon_path
&& let Ok(path) = PathBuf::from_str(icon)
{
return AssetPathOwned::File(path);
}
AssetPathOwned::BuiltIn(PathBuf::from_str("dashboard/terminal.svg").unwrap())
}
pub fn mount_simple_label(
globals: &WguiGlobals,
layout: &mut Layout,
parent_id: WidgetID,
translation: Translation,
) -> anyhow::Result<()> {
layout.add_child(
parent_id,
WidgetLabel::create(
&mut globals.get(),
WidgetLabelParams {
content: translation,
..Default::default()
},
),
taffy::Style::default(),
)?;
Ok(())
}
pub fn mount_simple_sprite_square(
globals: &WguiGlobals,
layout: &mut Layout,
parent_id: WidgetID,
size_px: f32,
path: AssetPath,
) -> anyhow::Result<()> {
layout.add_child(
parent_id,
WidgetSprite::create(WidgetSpriteParams {
glyph_data: Some(CustomGlyphData::from_assets(globals, path)?),
..Default::default()
}),
taffy::Style {
size: taffy::Size {
width: length(size_px),
height: length(size_px),
},
..Default::default()
},
)?;
Ok(())
}
+24
View File
@@ -0,0 +1,24 @@
use wgui::{
i18n::Translation,
layout::{Layout, WidgetID},
renderer_vk::text::TextStyle,
widget::label::{WidgetLabel, WidgetLabelParams},
};
#[allow(dead_code)]
pub fn create_label(layout: &mut Layout, parent: WidgetID, content: Translation) -> anyhow::Result<()> {
let label = WidgetLabel::create(
&mut layout.state,
WidgetLabelParams {
content,
style: TextStyle {
wrap: true,
..Default::default()
},
},
);
layout.add_child(parent, label, Default::default())?;
Ok(())
}
+4 -6
View File
@@ -50,7 +50,6 @@ enum CompositorMode {
enum Task {
SetCompositor(CompositorMode),
SetRes(ResMode),
SetPos(PosMode),
SetOrientation(OrientationMode),
SetAutoStart(bool),
Launch,
@@ -156,7 +155,7 @@ impl View {
} else {
CompositorMode::Native
};
radio_compositor.set_value(compositor_mode.as_ref())?;
radio_compositor.set_value_simple(compositor_mode.as_ref())?;
tasks.push(Task::SetCompositor(compositor_mode));
let res_mode = ResMode::Res1080;
@@ -180,7 +179,7 @@ impl View {
let tasks = tasks.clone();
Box::new(move |_, ev| {
if let Some(mode) = ev.value.and_then(|v| {
CompositorMode::from_str(&*v)
CompositorMode::from_str(&v)
.inspect_err(|_| {
log::error!(
"Invalid value for compositor: '{v}'. Valid values are: {:?}",
@@ -199,7 +198,7 @@ impl View {
let tasks = tasks.clone();
Box::new(move |_, ev| {
if let Some(mode) = ev.value.and_then(|v| {
ResMode::from_str(&*v)
ResMode::from_str(&v)
.inspect_err(|_| {
log::error!(
"Invalid value for resolution: '{v}'. Valid values are: {:?}",
@@ -237,7 +236,7 @@ impl View {
let tasks = tasks.clone();
Box::new(move |_, ev| {
if let Some(mode) = ev.value.and_then(|v| {
OrientationMode::from_str(&*v)
OrientationMode::from_str(&v)
.inspect_err(|_| {
log::error!(
"Invalid value for orientation: '{v}'. Valid values are: {:?}",
@@ -295,7 +294,6 @@ impl View {
match task {
Task::SetCompositor(mode) => self.compositor_mode = mode,
Task::SetRes(mode) => self.res_mode = mode,
Task::SetPos(mode) => self.pos_mode = mode,
Task::SetOrientation(mode) => self.orientation_mode = mode,
Task::SetAutoStart(auto_start) => self.auto_start = auto_start,
Task::Launch => self.action_launch(interface, data),
+12 -17
View File
@@ -110,8 +110,7 @@ struct MultiSelectorParams<'a> {
}
fn mount_multi_selector(params: MultiSelectorParams) -> anyhow::Result<()> {
let globals = params.ess.layout.state.globals.clone();
let accent_color = globals.get().defaults.accent_color;
let accent_color = params.ess.layout.state.theme.accent_color;
for cell in params.cells {
let highlighted = cell.key == params.def_cell;
@@ -131,7 +130,7 @@ fn mount_multi_selector(params: MultiSelectorParams) -> anyhow::Result<()> {
button.on_click({
let on_click = params.on_click.clone();
let key = cell.key.clone();
Box::new(move |_, _| {
Rc::new(move |_, _| {
(*on_click)(key.as_str());
Ok(())
})
@@ -610,7 +609,7 @@ impl View {
fn handle_func_button_click(&self, task: ViewTask) -> ButtonClickCallback {
let tasks = self.tasks.clone();
let on_update = self.on_update.clone();
Box::new(move |_common, _evt| {
Rc::new(move |_common, _evt| {
tasks.push(task.clone());
(*on_update)();
Ok(())
@@ -654,8 +653,6 @@ impl View {
}
fn update_button_highlights(&self, layout: &mut Layout) -> anyhow::Result<()> {
let defaults = self.globals.defaults();
let mut c = layout.start_common();
let mut common = c.common();
@@ -667,14 +664,12 @@ impl View {
};
let mut perform = |btn_num: u8, btn: &Rc<ComponentButton>| {
btn.set_color(
&mut common,
if num == btn_num {
defaults.accent_color
} else {
defaults.button_color
},
);
let color = if num == btn_num {
common.state.theme.accent_color
} else {
common.state.theme.button_color
};
btn.set_color(&mut common, color);
};
perform(0, &self.btn_sinks);
@@ -762,7 +757,7 @@ impl View {
let tasks = self.tasks.clone();
let card = params.card.clone();
let on_update = self.on_update.clone();
Box::new(move |_common, _evt| {
Rc::new(move |_common, _evt| {
tasks.push(ViewTask::SetMode(CurrentMode::CardProfileSelector(card.clone())));
(*on_update)();
Ok(())
@@ -836,7 +831,7 @@ impl View {
btn_mute.on_click({
let control = params.control.clone();
Box::new(move |_common, _event| {
Rc::new(move |_common, _event| {
control.on_mute_toggle()?;
Ok(())
})
@@ -957,7 +952,7 @@ impl View {
btn_back.on_click({
let tasks = self.tasks.clone();
let on_update = self.on_update.clone();
Box::new(move |_, _| {
Rc::new(move |_, _| {
tasks.push(ViewTask::SetMode(CurrentMode::Cards));
(*on_update)();
Ok(())
+4 -12
View File
@@ -10,7 +10,7 @@ use wgui::{
drawing::{self, GradientMode},
globals::WguiGlobals,
i18n::Translation,
layout::{Layout, WidgetID, WidgetPair},
layout::{Layout, WidgetID},
renderer_vk::text::{FontWeight, HorizontalAlign, TextShadow, TextStyle, custom_glyph::CustomGlyphData},
taffy::{
self, AlignItems, AlignSelf, JustifyContent, JustifySelf,
@@ -47,7 +47,6 @@ pub struct Params<'a, 'b> {
pub struct View {
pub button: Rc<ComponentButton>,
pair: WidgetPair,
id_image_parent: WidgetID,
app_name: String,
app_id: AppID,
@@ -99,15 +98,9 @@ impl View {
Ok(())
}
fn mount_placeholder_text(
&self,
globals: &WguiGlobals,
layout: &mut Layout,
parent: WidgetID,
text: &str,
) -> anyhow::Result<()> {
fn mount_placeholder_text(&self, layout: &mut Layout, parent: WidgetID, text: &str) -> anyhow::Result<()> {
let label = WidgetLabel::create(
&mut globals.get(),
&mut layout.state,
WidgetLabelParams {
content: Translation::from_raw_text(text),
style: TextStyle {
@@ -154,7 +147,7 @@ impl View {
// mount placeholder
let img = view_common.get_placeholder_image()?.clone();
self.mount_image(layout, &img)?;
self.mount_placeholder_text(&view_common.globals, layout, self.id_image_parent, &self.app_name)?;
self.mount_placeholder_text(layout, self.id_image_parent, &self.app_name)?;
} else {
// mount image
let path = format!("app:{:?}", self.app_id);
@@ -289,7 +282,6 @@ impl View {
.detach();
Ok(View {
pair: widget_button,
button,
id_image_parent: image_parent.id,
app_name: params.manifest.name.clone(),
+119 -69
View File
@@ -2,6 +2,7 @@ use std::{cell::RefCell, collections::HashMap, rc::Rc};
use wgui::{
assets::AssetPath,
components::button::ComponentButton,
globals::WguiGlobals,
i18n::Translation,
layout::{Layout, WidgetID},
@@ -18,7 +19,7 @@ use crate::{
util::{
cached_fetcher::CoverArt,
popup_manager::{MountPopupParams, PopupHandle},
steam_utils::{self, AppID, AppManifest, SteamUtils},
steam_utils::{self, AppID, SteamUtils},
various::AsyncExecutor,
},
views::{self, game_cover, game_launcher},
@@ -29,7 +30,10 @@ enum Task {
AppManifestClicked(steam_utils::AppManifest),
SetCoverArt(AppID, Rc<CoverArt>),
CloseLauncher,
Refresh,
LoadManifests,
FillPage(u32),
PrevPage,
NextPage,
}
pub struct Params<'a> {
@@ -40,9 +44,10 @@ pub struct Params<'a> {
pub parent_id: WidgetID,
}
pub struct Cell {
const MAX_GAMES_PER_PAGE: u32 = 30;
pub struct GameCoverCell {
view_cover: game_cover::View,
manifest: AppManifest,
}
struct State {
@@ -56,11 +61,14 @@ pub struct View {
frontend_tasks: FrontendTasks,
globals: WguiGlobals,
id_list_parent: WidgetID,
steam_utils: steam_utils::SteamUtils,
cells: HashMap<AppID, Cell>,
game_cover_view_common: game_cover::ViewCommon,
executor: AsyncExecutor,
state: Rc<RefCell<State>>,
mounted_game_covers: HashMap<AppID, GameCoverCell>,
all_manifests: Vec<steam_utils::AppManifest>,
cur_page: u32,
page_count: u32,
id_label_page: WidgetID,
}
impl View {
@@ -73,12 +81,21 @@ impl View {
let parser_state = wgui::parser::parse_from_assets(doc_params, params.layout, params.parent_id)?;
let list_parent = parser_state.fetch_widget(&params.layout.state, "list_parent")?;
let id_label_page = parser_state.get_widget_id("label_page")?;
let tasks = Tasks::new();
let steam_utils = SteamUtils::new()?;
tasks.handle_button(
&parser_state.fetch_component_as::<ComponentButton>("btn_prev")?,
Task::PrevPage,
);
tasks.push(Task::Refresh);
tasks.handle_button(
&parser_state.fetch_component_as::<ComponentButton>("btn_next")?,
Task::NextPage,
);
tasks.push(Task::LoadManifests);
Ok(Self {
parser_state,
@@ -86,15 +103,23 @@ impl View {
frontend_tasks: params.frontend_tasks,
globals: params.globals.clone(),
id_list_parent: list_parent.id,
steam_utils,
cells: HashMap::new(),
mounted_game_covers: HashMap::new(),
game_cover_view_common: game_cover::ViewCommon::new(params.globals.clone()),
state: Rc::new(RefCell::new(State { view_launcher: None })),
executor: params.executor,
all_manifests: Vec::new(),
cur_page: 0,
page_count: 0,
id_label_page,
})
}
pub fn update(&mut self, layout: &mut Layout, executor: &AsyncExecutor) -> anyhow::Result<()> {
pub fn update(
&mut self,
layout: &mut Layout,
steam_utils: &mut SteamUtils,
executor: &AsyncExecutor,
) -> anyhow::Result<()> {
loop {
let tasks = self.tasks.drain();
if tasks.is_empty() {
@@ -102,10 +127,13 @@ impl View {
}
for task in tasks {
match task {
Task::Refresh => self.refresh(layout, executor)?,
Task::LoadManifests => self.load_manifests(steam_utils),
Task::FillPage(page_idx) => self.fill_page(layout, executor, page_idx)?,
Task::AppManifestClicked(manifest) => self.action_app_manifest_clicked(manifest)?,
Task::SetCoverArt(app_id, cover_art) => self.set_cover_art(layout, app_id, cover_art),
Task::CloseLauncher => self.state.borrow_mut().view_launcher = None,
Task::PrevPage => self.page_prev(),
Task::NextPage => self.page_next(),
}
}
}
@@ -119,18 +147,14 @@ impl View {
}
}
pub struct Games {
manifests: Vec<steam_utils::AppManifest>,
}
fn fill_game_list(
ess: &mut ConstructEssentials,
executor: &AsyncExecutor,
cells: &mut HashMap<AppID, Cell>,
games: &Games,
mounted_game_covers: &mut HashMap<AppID, GameCoverCell>,
manifests: &[steam_utils::AppManifest],
tasks: &Tasks<Task>,
) -> anyhow::Result<()> {
for manifest in &games.manifests {
for manifest in manifests {
let on_loaded = {
let app_id = manifest.app_id.clone();
let tasks = tasks.clone();
@@ -150,81 +174,107 @@ fn fill_game_list(
view_cover.button.on_click({
let tasks = tasks.clone();
let manifest = manifest.clone();
Box::new(move |_, _| {
Rc::new(move |_, _| {
tasks.push(Task::AppManifestClicked(manifest.clone()));
Ok(())
})
});
cells.insert(
manifest.app_id.clone(),
Cell {
view_cover,
manifest: manifest.clone(),
},
);
mounted_game_covers.insert(manifest.app_id.clone(), GameCoverCell { view_cover });
}
Ok(())
}
impl View {
fn game_list(&self) -> anyhow::Result<Games> {
let manifests = self
.steam_utils
.list_installed_games(steam_utils::GameSortMethod::PlayDateDesc)?;
Ok(Games { manifests })
fn load_manifests(&mut self, steam_utils: &mut SteamUtils) {
match steam_utils.list_installed_games(steam_utils::GameSortMethod::PlayDateDesc) {
Ok(manifests) => {
self.page_count = (manifests.len() as u32 + MAX_GAMES_PER_PAGE) / MAX_GAMES_PER_PAGE;
self.all_manifests = manifests;
self.tasks.push(Task::FillPage(0));
}
Err(e) => {
log::error!("Failed to list installed games: {e:?}");
}
}
}
fn refresh(&mut self, layout: &mut Layout, executor: &AsyncExecutor) -> anyhow::Result<()> {
layout.remove_children(self.id_list_parent);
self.cells.clear();
let mut text: Option<Translation> = None;
match self.game_list() {
Ok(list) => {
if list.manifests.is_empty() {
text = Some(Translation::from_translation_key("GAME_LIST.NO_GAMES_FOUND"))
} else {
fill_game_list(
&mut ConstructEssentials {
layout,
parent: self.id_list_parent,
},
executor,
&mut self.cells,
&list,
&self.tasks,
)?
}
}
Err(e) => text = Some(Translation::from_raw_text(&format!("Error: {:?}", e))),
fn page_prev(&mut self) {
if self.cur_page == 0 {
return;
}
self.cur_page -= 1;
self.tasks.push(Task::FillPage(self.cur_page));
}
fn page_next(&mut self) {
if self.cur_page >= self.page_count - 1 {
return;
}
self.cur_page += 1;
self.tasks.push(Task::FillPage(self.cur_page));
}
fn fill_page(&mut self, layout: &mut Layout, executor: &AsyncExecutor, page_idx: u32) -> anyhow::Result<()> {
layout.remove_children(self.id_list_parent);
self.mounted_game_covers.clear();
let idx_from = (page_idx * MAX_GAMES_PER_PAGE).min(self.all_manifests.len() as u32);
let idx_to = ((page_idx + 1) * MAX_GAMES_PER_PAGE).min(self.all_manifests.len() as u32);
let page_manifests = &self.all_manifests[idx_from as usize..idx_to as usize];
let mut text: Option<Translation> = None;
if page_manifests.is_empty() {
text = Some(Translation::from_translation_key("GAME_LIST.NO_GAMES_FOUND"))
}
// set page text
let mut c = layout.start_common();
{
let mut common = c.common();
let mut widget = common.state.widgets.cast_as::<WidgetLabel>(self.id_label_page)?;
widget.set_text(
&mut common,
Translation::from_raw_text_string(format!("{}/{}", self.cur_page + 1, self.page_count)),
);
}
c.finish()?;
fill_game_list(
&mut ConstructEssentials {
layout,
parent: self.id_list_parent,
},
executor,
&mut self.mounted_game_covers,
page_manifests,
&self.tasks,
)?;
if let Some(text) = text.take() {
layout.add_child(
self.id_list_parent,
WidgetLabel::create(
&mut self.globals.get(),
WidgetLabelParams {
content: text,
..Default::default()
},
),
Default::default(),
)?;
let label = WidgetLabel::create(
&mut layout.state,
WidgetLabelParams {
content: text,
..Default::default()
},
);
layout.add_child(self.id_list_parent, label, Default::default())?;
}
Ok(())
}
fn set_cover_art(&mut self, layout: &mut Layout, app_id: AppID, cover_art: Rc<CoverArt>) {
let Some(cell) = &mut self.cells.get_mut(&app_id) else {
let Some(cover) = &mut self.mounted_game_covers.get_mut(&app_id) else {
return;
};
if let Err(e) = cell
if let Err(e) = cover
.view_cover
.set_cover_art(&mut self.game_cover_view_common, layout, &cover_art)
{
+1 -3
View File
@@ -3,6 +3,4 @@ pub mod audio_settings;
pub mod game_cover;
pub mod game_launcher;
pub mod game_list;
pub mod process_list;
pub mod window_list;
pub mod window_options;
pub mod running_games_list;
-255
View File
@@ -1,255 +0,0 @@
use std::rc::Rc;
use wayvr_ipc::packet_server::{self};
use wgui::{
assets::AssetPath,
components::{
self,
button::ComponentButton,
tooltip::{TooltipInfo, TooltipSide},
},
globals::WguiGlobals,
i18n::Translation,
layout::{Layout, WidgetID},
parser::{Fetchable, ParseDocumentParams, ParserState},
taffy::{self, prelude::length},
task::Tasks,
widget::{
ConstructEssentials,
div::WidgetDiv,
label::{WidgetLabel, WidgetLabelParams},
},
};
use wlx_common::{dash_interface::BoxDashInterface, desktop_finder::DesktopEntry};
use crate::util::{self, various::get_desktop_file_icon_path};
#[derive(Clone)]
enum Task {
Refresh,
TerminateProcess(packet_server::WvrProcess),
}
pub struct Params<'a> {
pub globals: WguiGlobals,
pub layout: &'a mut Layout,
pub parent_id: WidgetID,
}
pub struct View {
#[allow(dead_code)]
pub parser_state: ParserState,
tasks: Tasks<Task>,
globals: WguiGlobals,
id_list_parent: WidgetID,
}
impl View {
pub fn new(params: Params) -> anyhow::Result<Self> {
let doc_params = &ParseDocumentParams {
globals: params.globals.clone(),
path: AssetPath::BuiltIn("gui/view/process_list.xml"),
extra: Default::default(),
};
let parser_state = wgui::parser::parse_from_assets(doc_params, params.layout, params.parent_id)?;
let list_parent = parser_state.fetch_widget(&params.layout.state, "list_parent")?;
let tasks = Tasks::new();
tasks.push(Task::Refresh);
Ok(Self {
parser_state,
tasks,
globals: params.globals,
id_list_parent: list_parent.id,
})
}
pub fn update<T>(
&mut self,
layout: &mut Layout,
interface: &mut BoxDashInterface<T>,
data: &mut T,
) -> anyhow::Result<()> {
loop {
let tasks = self.tasks.drain();
if tasks.is_empty() {
break;
}
for task in tasks {
match task {
Task::Refresh => self.refresh(layout, interface, data)?,
Task::TerminateProcess(process) => self.action_terminate_process(interface, data, process)?,
}
}
}
Ok(())
}
}
fn get_desktop_entry_from_process(process: &packet_server::WvrProcess) -> Option<DesktopEntry> {
// TODO: refactor this after we ditch old wayvr-dashboard completely
let Some(dfile_str) = process.userdata.get("desktop-entry") else {
return None;
};
let Ok(desktop_file) = serde_json::from_str::<DesktopEntry>(dfile_str) else {
debug_assert!(false); // invalid json???
return None;
};
Some(desktop_file)
}
struct ProcessEntryResult {
btn_terminate: Rc<ComponentButton>,
}
fn construct_process_entry(
ess: &mut ConstructEssentials,
globals: &WguiGlobals,
process: &packet_server::WvrProcess,
) -> anyhow::Result<ProcessEntryResult> {
let (cell, _) = ess.layout.add_child(
ess.parent,
WidgetDiv::create(),
taffy::Style {
flex_direction: taffy::FlexDirection::Row,
align_items: Some(taffy::AlignItems::Center),
gap: length(8.0),
..Default::default()
},
)?;
let text_terminate_process = Translation::from_raw_text_string(globals.i18n().translate_and_replace(
"PROCESS_LIST.TERMINATE_PROCESS_NAMED_X",
("{PROCESS_NAME}", &process.name),
));
//"Terminate process" button
let (_, btn_terminate) = components::button::construct(
&mut ConstructEssentials {
layout: ess.layout,
parent: cell.id,
},
components::button::Params {
sprite_src: Some(AssetPath::BuiltIn("dashboard/remove_circle.svg")),
tooltip: Some(TooltipInfo {
text: text_terminate_process,
side: TooltipSide::Right,
}),
..Default::default()
},
)?;
if let Some(desktop_file) = get_desktop_entry_from_process(process) {
// desktop file icon and process name
util::various::mount_simple_sprite_square(
globals,
ess.layout,
cell.id,
24.0,
get_desktop_file_icon_path(&desktop_file).as_ref(),
)?;
util::various::mount_simple_label(
globals,
ess.layout,
cell.id,
Translation::from_raw_text_rc(desktop_file.app_name.clone()),
)?;
} else {
// just show a process name
util::various::mount_simple_label(
globals,
ess.layout,
cell.id,
Translation::from_raw_text_string(process.name.clone()),
)?;
}
Ok(ProcessEntryResult { btn_terminate })
}
fn fill_process_list(
globals: &WguiGlobals,
ess: &mut ConstructEssentials,
tasks: &Tasks<Task>,
list: &Vec<packet_server::WvrProcess>,
) -> anyhow::Result<()> {
for process_entry in list {
let entry_res = construct_process_entry(ess, globals, process_entry)?;
entry_res.btn_terminate.on_click({
let tasks = tasks.clone();
let entry = process_entry.clone();
Box::new(move |_, _| {
tasks.push(Task::TerminateProcess(entry.clone()));
Ok(())
})
});
}
Ok(())
}
impl View {
fn refresh<T>(
&mut self,
layout: &mut Layout,
interface: &mut BoxDashInterface<T>,
data: &mut T,
) -> anyhow::Result<()> {
layout.remove_children(self.id_list_parent);
let mut text: Option<Translation> = None;
match interface.process_list(data) {
Ok(list) => {
if list.is_empty() {
text = Some(Translation::from_translation_key("PROCESS_LIST.NO_PROCESSES_FOUND"))
} else {
fill_process_list(
&self.globals,
&mut ConstructEssentials {
layout,
parent: self.id_list_parent,
},
&self.tasks,
&list,
)?;
}
}
Err(e) => text = Some(Translation::from_raw_text(&format!("Error: {:?}", e))),
}
if let Some(text) = text.take() {
layout.add_child(
self.id_list_parent,
WidgetLabel::create(
&mut self.globals.get(),
WidgetLabelParams {
content: text,
..Default::default()
},
),
Default::default(),
)?;
}
Ok(())
}
fn action_terminate_process<T>(
&mut self,
interface: &mut BoxDashInterface<T>,
data: &mut T,
process: packet_server::WvrProcess,
) -> anyhow::Result<()> {
interface.process_terminate(data, process.handle)?;
self.tasks.push(Task::Refresh);
Ok(())
}
}
@@ -0,0 +1,184 @@
use wgui::{
assets::AssetPath,
components::button::ComponentButton,
event::StyleSetRequest,
globals::WguiGlobals,
i18n::Translation,
layout::{Layout, LayoutTask, WidgetID},
parser::{Fetchable, ParseDocumentParams, ParserState},
taffy::Display,
task::Tasks,
widget::label::WidgetLabel,
};
use crate::{
frontend::{FrontendTask, FrontendTasks},
util::steam_utils::{self, AppID, AppManifest, GameSortMethod, SteamUtils},
};
#[derive(Clone)]
enum Task {
Refresh,
StopGame(AppID, bool /* kill */),
}
pub struct Params<'a> {
pub globals: WguiGlobals,
pub layout: &'a mut Layout,
pub parent_id: WidgetID,
pub steam_utils: &'a mut SteamUtils,
pub frontend_tasks: FrontendTasks,
}
pub struct View {
#[allow(dead_code)]
state: ParserState,
tasks: Tasks<Task>,
last_update_ms: u32,
id_list_parent: WidgetID,
installed_games: Vec<AppManifest>,
frontend_tasks: FrontendTasks,
parent_id: WidgetID,
}
fn doc_params(globals: WguiGlobals) -> ParseDocumentParams<'static> {
ParseDocumentParams {
globals,
path: AssetPath::BuiltIn("gui/view/running_games_list.xml"),
extra: Default::default(),
}
}
impl View {
pub fn new(params: Params) -> anyhow::Result<Self> {
let state = wgui::parser::parse_from_assets(&doc_params(params.globals.clone()), params.layout, params.parent_id)?;
let btn_refresh = state.fetch_component_as::<ComponentButton>("btn_refresh")?;
let id_list_parent = state.get_widget_id("list_parent")?;
let installed_games = params
.steam_utils
.list_installed_games(GameSortMethod::None)
.unwrap_or_default();
let tasks = Tasks::<Task>::new();
tasks.handle_button(&btn_refresh, Task::Refresh);
tasks.push(Task::Refresh);
Ok(Self {
state,
tasks,
last_update_ms: 0,
id_list_parent,
installed_games,
frontend_tasks: params.frontend_tasks,
parent_id: params.parent_id,
})
}
pub fn update(&mut self, layout: &mut Layout, time_ms: u32) -> anyhow::Result<()> {
loop {
let tasks = self.tasks.drain();
if tasks.is_empty() {
break;
}
for task in tasks {
match task {
Task::Refresh => self.refresh(layout)?,
Task::StopGame(app_id, kill) => self.stop_game(app_id, kill),
}
}
}
if self.last_update_ms + 5000 < time_ms {
self.last_update_ms = time_ms;
self.tasks.push(Task::Refresh);
}
Ok(())
}
fn extract_name_from_appid(app_id: &AppID, manifests: &[AppManifest]) -> String {
for manifest in manifests {
if manifest.app_id == *app_id {
return manifest.name.clone();
}
}
format!("Unknown AppID {}", app_id)
}
fn fill_list(&mut self, layout: &mut Layout, games: Vec<steam_utils::RunningGame>) -> anyhow::Result<()> {
if games.is_empty() {
// hide self
layout.tasks.push(LayoutTask::SetWidgetStyle(
self.parent_id,
StyleSetRequest::Display(Display::None),
));
return Ok(());
}
layout.tasks.push(LayoutTask::SetWidgetStyle(
self.parent_id,
StyleSetRequest::Display(Display::DEFAULT),
));
for game in games {
let game_name = View::extract_name_from_appid(&game.app_id, &self.installed_games);
let t = self.state.parse_template(
&doc_params(layout.state.globals.clone()),
"RunningGameCell",
layout,
self.id_list_parent,
Default::default(),
)?;
let mut label_name = t.fetch_widget_as::<WidgetLabel>(&layout.state, "label_name")?;
self.tasks.handle_button(
&t.fetch_component_as::<ComponentButton>("btn_stop")?,
Task::StopGame(game.app_id.clone(), false),
);
self.tasks.handle_button(
&t.fetch_component_as::<ComponentButton>("btn_kill")?,
Task::StopGame(game.app_id, true),
);
label_name.set_text_simple(
&mut layout.state.globals.get(),
Translation::from_raw_text_string(game_name),
);
}
Ok(())
}
fn refresh(&mut self, layout: &mut Layout) -> anyhow::Result<()> {
log::debug!("refreshing running games list");
layout.remove_children(self.id_list_parent);
match steam_utils::list_running_games() {
Ok(games) => self.fill_list(layout, games)?,
Err(e) => {
log::error!("failed to list games: {}", e);
}
}
Ok(())
}
fn stop_game(&mut self, app_id: AppID, kill: bool) {
if let Err(e) = steam_utils::stop(app_id, kill) {
self
.frontend_tasks
.push(FrontendTask::PushToast(Translation::from_raw_text_string(format!(
"Error: {}",
e
))));
}
}
}
-290
View File
@@ -1,290 +0,0 @@
use std::{cell::RefCell, rc::Rc};
use wayvr_ipc::packet_server::{self, WvrWindowHandle};
use wgui::{
assets::AssetPath,
components::{self, button::ComponentButton},
globals::WguiGlobals,
i18n::Translation,
layout::{Layout, WidgetID, WidgetPair},
parser::{Fetchable, ParseDocumentParams, ParserState},
renderer_vk::text::{FontWeight, HorizontalAlign, TextStyle},
taffy::{self, prelude::length},
task::Tasks,
widget::{
ConstructEssentials,
label::{WidgetLabel, WidgetLabelParams},
},
};
use wlx_common::dash_interface::BoxDashInterface;
use crate::{
frontend::{FrontendTask, FrontendTasks},
util::popup_manager::{MountPopupParams, PopupHandle},
views::window_options,
};
#[derive(Clone)]
enum Task {
WindowClicked(packet_server::WvrWindow),
WindowOptionsFinish,
Refresh,
}
pub struct Params<'a> {
pub globals: WguiGlobals,
pub frontend_tasks: FrontendTasks,
pub layout: &'a mut Layout,
pub parent_id: WidgetID,
pub on_click: Option<Box<dyn Fn(WvrWindowHandle)>>,
}
struct State {
view_window_options: Option<(PopupHandle, window_options::View)>,
}
pub struct View {
#[allow(dead_code)]
pub parser_state: ParserState,
tasks: Tasks<Task>,
frontend_tasks: FrontendTasks,
globals: WguiGlobals,
state: Rc<RefCell<State>>,
id_list_parent: WidgetID,
on_click: Option<Box<dyn Fn(WvrWindowHandle)>>,
}
impl View {
pub fn new(params: Params) -> anyhow::Result<Self> {
let doc_params = &ParseDocumentParams {
globals: params.globals.clone(),
path: AssetPath::BuiltIn("gui/view/window_list.xml"),
extra: Default::default(),
};
let parser_state = wgui::parser::parse_from_assets(doc_params, params.layout, params.parent_id)?;
let list_parent = parser_state.fetch_widget(&params.layout.state, "list_parent")?;
let tasks = Tasks::new();
tasks.push(Task::Refresh);
let state = Rc::new(RefCell::new(State {
view_window_options: None,
}));
Ok(Self {
parser_state,
tasks,
frontend_tasks: params.frontend_tasks,
globals: params.globals.clone(),
state,
id_list_parent: list_parent.id,
on_click: params.on_click,
})
}
pub fn update<T>(
&mut self,
layout: &mut Layout,
interface: &mut BoxDashInterface<T>,
data: &mut T,
) -> anyhow::Result<()> {
loop {
let tasks = self.tasks.drain();
if tasks.is_empty() {
break;
}
for task in tasks {
match task {
Task::WindowClicked(display) => self.action_window_clicked(display)?,
Task::WindowOptionsFinish => self.action_window_options_finish(),
Task::Refresh => self.refresh(layout, interface, data)?,
}
}
}
let mut state = self.state.borrow_mut();
if let Some((_, view)) = &mut state.view_window_options {
view.update(layout, interface, data)?;
}
Ok(())
}
}
pub fn construct_window_button<T>(
ess: &mut ConstructEssentials,
interface: &mut BoxDashInterface<T>,
data: &mut T,
globals: &WguiGlobals,
window: &packet_server::WvrWindow,
) -> anyhow::Result<(WidgetPair, Rc<ComponentButton>)> {
let aspect = window.size_x as f32 / window.size_y as f32;
let height = 96.0;
let width = height * aspect;
let accent_color = globals.defaults().accent_color;
let (widget_button, button) = components::button::construct(
ess,
components::button::Params {
color: Some(accent_color.with_alpha(0.2)),
border_color: Some(accent_color),
style: taffy::Style {
align_items: Some(taffy::AlignItems::Center),
justify_content: Some(taffy::JustifyContent::Center),
size: taffy::Size {
width: length(width),
height: length(height),
},
..Default::default()
},
..Default::default()
},
)?;
let process_name = match interface.process_get(data, window.process_handle.clone()) {
Some(process) => process.name.clone(),
None => String::from("Unknown"),
};
let label_name = WidgetLabel::create(
&mut globals.get(),
WidgetLabelParams {
content: Translation::from_raw_text(&process_name),
style: TextStyle {
weight: Some(FontWeight::Bold),
wrap: true,
align: Some(HorizontalAlign::Center),
..Default::default()
},
},
);
let label_resolution = WidgetLabel::create(
&mut globals.get(),
WidgetLabelParams {
content: Translation::from_raw_text(""),
..Default::default()
},
);
ess.layout.add_child(widget_button.id, label_name, Default::default())?;
ess
.layout
.add_child(widget_button.id, label_resolution, Default::default())?;
Ok((widget_button, button))
}
fn fill_window_list<T>(
globals: &WguiGlobals,
ess: &mut ConstructEssentials,
interface: &mut BoxDashInterface<T>,
data: &mut T,
list: Vec<packet_server::WvrWindow>,
tasks: &Tasks<Task>,
) -> anyhow::Result<()> {
for entry in list {
let (_, button) = construct_window_button(ess, interface, data, globals, &entry)?;
button.on_click({
let tasks = tasks.clone();
Box::new(move |_, _| {
tasks.push(Task::WindowClicked(entry.clone()));
Ok(())
})
});
}
Ok(())
}
impl View {
fn action_window_options_finish(&mut self) {
self.state.borrow_mut().view_window_options = None;
self.tasks.push(Task::Refresh);
}
fn refresh<T>(
&mut self,
layout: &mut Layout,
interface: &mut BoxDashInterface<T>,
data: &mut T,
) -> anyhow::Result<()> {
layout.remove_children(self.id_list_parent);
let mut text: Option<Translation> = None;
match interface.window_list(data) {
Ok(list) => {
if list.is_empty() {
text = Some(Translation::from_translation_key("NO_WINDOWS_FOUND"))
} else {
fill_window_list(
&self.globals,
&mut ConstructEssentials {
layout,
parent: self.id_list_parent,
},
interface,
data,
list,
&self.tasks,
)?
}
}
Err(e) => text = Some(Translation::from_raw_text(&format!("Error: {:?}", e))),
}
if let Some(text) = text.take() {
layout.add_child(
self.id_list_parent,
WidgetLabel::create(
&mut self.globals.get(),
WidgetLabelParams {
content: text,
..Default::default()
},
),
Default::default(),
)?;
}
Ok(())
}
fn action_window_clicked(&mut self, window: packet_server::WvrWindow) -> anyhow::Result<()> {
if let Some(on_click) = &mut self.on_click {
(*on_click)(window.handle);
} else {
self.frontend_tasks.push(FrontendTask::MountPopup(MountPopupParams {
title: Translation::from_translation_key("WINDOW_OPTIONS"),
on_content: {
let frontend_tasks = self.frontend_tasks.clone();
let globals = self.globals.clone();
let state = self.state.clone();
let tasks = self.tasks.clone();
//TODO
Rc::new(move |data| {
// state.borrow_mut().view_window_options = Some((
// data.handle,
// window_options::View::new(window_options::Params {
// globals: globals.clone(),
// layout: data.layout,
// parent_id: data.id_content,
// on_submit: tasks.make_callback(Task::WindowOptionsFinish),
// window: window.clone(),
// frontend_tasks: frontend_tasks.clone(),
// })?,
// ));
Ok(())
})
},
}));
}
Ok(())
}
}
-162
View File
@@ -1,162 +0,0 @@
use anyhow::Context;
use std::rc::Rc;
use wayvr_ipc::packet_server;
use wgui::{
assets::AssetPath,
components::button::ComponentButton,
globals::WguiGlobals,
i18n::Translation,
layout::{Layout, WidgetID},
parser::{Fetchable, ParseDocumentParams, ParserState},
task::Tasks,
widget::ConstructEssentials,
};
use wlx_common::dash_interface::BoxDashInterface;
use crate::{
frontend::{FrontendTask, FrontendTasks},
views::window_list::construct_window_button,
};
#[derive(Clone)]
enum Task {
SetVisible(bool),
Kill,
Close,
}
pub struct View {
#[allow(dead_code)]
pub state: ParserState,
tasks: Tasks<Task>,
frontend_tasks: FrontendTasks,
window: packet_server::WvrWindow,
on_submit: Rc<dyn Fn()>,
}
pub struct Params<'a, T> {
pub globals: WguiGlobals,
pub frontend_tasks: FrontendTasks,
pub layout: &'a mut Layout,
pub parent_id: WidgetID,
pub on_submit: Rc<dyn Fn()>,
pub window: packet_server::WvrWindow,
pub interface: &'a mut BoxDashInterface<T>,
pub data: &'a mut T,
}
impl View {
pub fn new<T>(params: Params<T>) -> anyhow::Result<Self> {
let doc_params = &ParseDocumentParams {
globals: params.globals.clone(),
path: AssetPath::BuiltIn("gui/view/window_options.xml"),
extra: Default::default(),
};
let state = wgui::parser::parse_from_assets(doc_params, params.layout, params.parent_id)?;
let tasks = Tasks::new();
let window_parent = state.get_widget_id("window_parent")?;
let btn_close = state.fetch_component_as::<ComponentButton>("btn_close")?;
let btn_kill = state.fetch_component_as::<ComponentButton>("btn_kill")?;
let btn_show_hide = state.fetch_component_as::<ComponentButton>("btn_show_hide")?;
construct_window_button(
&mut ConstructEssentials {
layout: params.layout,
parent: window_parent,
},
params.interface,
params.data,
&params.globals,
&params.window,
)?;
{
let mut c = params.layout.start_common();
btn_show_hide.set_text(
&mut c.common(),
Translation::from_translation_key(if params.window.visible { "HIDE" } else { "SHOW" }),
);
c.finish()?;
}
tasks.handle_button(&btn_close, Task::Close);
tasks.handle_button(&btn_kill, Task::Kill);
tasks.handle_button(&btn_show_hide, Task::SetVisible(!params.window.visible));
Ok(Self {
state,
tasks,
window: params.window,
frontend_tasks: params.frontend_tasks,
on_submit: params.on_submit,
})
}
pub fn update<T>(
&mut self,
_layout: &mut Layout,
interface: &mut BoxDashInterface<T>,
data: &mut T,
) -> anyhow::Result<()> {
for task in self.tasks.drain() {
match task {
Task::SetVisible(v) => self.action_set_visible(interface, data, v),
Task::Close => self.action_close(interface, data),
Task::Kill => self.action_kill(interface, data),
}
}
Ok(())
}
}
impl View {
fn action_set_visible<T>(&mut self, interface: &mut BoxDashInterface<T>, data: &mut T, visible: bool) {
if let Err(e) = interface.window_set_visible(data, self.window.handle.clone(), visible) {
self
.frontend_tasks
.push(FrontendTask::PushToast(Translation::from_raw_text_string(format!(
"Failed to set window visibility: {:?}",
e
))));
};
(*self.on_submit)();
}
fn action_close<T>(&mut self, interface: &mut BoxDashInterface<T>, data: &mut T) {
if let Err(e) = interface.window_request_close(data, self.window.handle.clone()) {
self
.frontend_tasks
.push(FrontendTask::PushToast(Translation::from_raw_text_string(format!(
"Failed to close window: {:?}",
e
))));
};
(*self.on_submit)();
}
fn action_kill_process<T>(&mut self, interface: &mut BoxDashInterface<T>, data: &mut T) -> anyhow::Result<()> {
let process = interface
.process_get(data, self.window.process_handle.clone())
.context("Process not found")?;
interface.process_terminate(data, process.handle)?;
Ok(())
}
fn action_kill<T>(&mut self, interface: &mut BoxDashInterface<T>, data: &mut T) {
if let Err(e) = self.action_kill_process(interface, data) {
self
.frontend_tasks
.push(FrontendTask::PushToast(Translation::from_raw_text_string(format!(
"Failed to kill process: {:?}",
e
))));
};
(*self.on_submit)();
}
}
+1
View File
@@ -1,5 +1,6 @@
{
"lockfileVersion": 1,
"configVersion": 0,
"workspaces": {
"": {
"name": "llm_translator",
+116 -121
View File
@@ -9,186 +9,181 @@ const template_name = process.env["TEMPLATE"] as string;
let lang_path = process.env["LANG_PATH"] as string;
if (model_name === undefined) {
console.log("MODEL not set");
exit(-1);
console.log("MODEL not set");
exit(-1);
}
if (template_name === undefined) {
console.log("TEMPLATE not set");
exit(-1);
console.log("TEMPLATE not set");
exit(-1);
}
if (lang_path === undefined) {
console.log(
`LANG_PATH is not set.
console.log(
`LANG_PATH is not set.
Try one of these:
LANG_PATH=../../uidev/assets/lang/ ./run.sh
LANG_PATH=../../dash-frontend/assets/lang/ ./run.sh
LANG_PATH=../../wayvr/src/assets/lang/ ./run.sh`);
exit(-1);
exit(-1);
}
lang_path = path.resolve(__dirname + "/" + lang_path);
if (lang_path === undefined || !fs.existsSync(lang_path)) {
console.log("Invalid or non-existent LANG_PATH");
exit(-1);
console.log("Invalid or non-existent LANG_PATH");
exit(-1);
}
const current_path = path.resolve(__dirname);
const templates_path = path.resolve(__dirname + "/templates");
async function loop_object(obj: any, initial_str: string, callback: (key: string, value: string) => Promise<void>) {
for (var key in obj) {
let full_key = initial_str + key;
if (typeof obj[key] === "object" && obj[key] !== null) {
await loop_object(obj[key], full_key + ".", callback)
} else if (obj.hasOwnProperty(key)) {
await callback(full_key, obj[key])
}
}
for (var key in obj) {
let full_key = initial_str + key;
if (typeof obj[key] === "object" && obj[key] !== null) {
await loop_object(obj[key], full_key + ".", callback)
} else if (obj.hasOwnProperty(key)) {
await callback(full_key, obj[key])
}
}
}
function extract_backticks(str: string) {
const regex = /`([^`]+)`/g;
return str.match(regex)?.map(match => match.slice(1, -1).trim());
const regex = /`([^`]+)`/g;
return str.match(regex)?.map(match => match.slice(1, -1).trim());
}
function set_i18n_key(obj: any, key: string, value: string | undefined) {
const parts = key.split('.');
let cur_level = obj;
for (let i = 0; i < parts.length - 1; i++) {
const part = parts[i]!;
if (!cur_level[part]) {
cur_level[part] = {};
}
cur_level = cur_level[part];
}
cur_level[parts[parts.length - 1]!] = value;
const parts = key.split('.');
let cur_level = obj;
for (let i = 0; i < parts.length - 1; i++) {
const part = parts[i]!;
if (!cur_level[part]) {
cur_level[part] = {};
}
cur_level = cur_level[part];
}
cur_level[parts[parts.length - 1]!] = value;
}
function key_exists(obj: any, key: string) {
const parts = key.split('.');
let level = obj;
const parts = key.split('.');
let level = obj;
for (let i = 0; i < parts.length; i++) {
const part = parts[i]!;
if (!level || !level[part]) {
return false;
}
level = level[part];
}
for (let i = 0; i < parts.length; i++) {
const part = parts[i]!;
if (!level || !level[part]) {
return false;
}
level = level[part];
}
return true;
return true;
};
interface Example {
key: string;
en: string;
translated: string;
key: string;
en: string;
translated: string;
}
interface Template {
full_name: string; // "Polish"
examples: Example[]
full_name: string; // "Polish"
examples: Example[]
}
function gen_prompt(description: string, template: Template, key: string, english_translation: string) {
let num = 1;
for (const example of template.examples) {
description += "\nExample " + num + ":\n\n";
description += "Translate key `" + example.key + "` from English to " + template.full_name + ":\n\n";
description += "```\n";
description += example.en + "\n";
description += "```\n\n";
description += "Result:\n\n";
description += "```\n";
description += example.translated + "\n";
description += "```\n";
num += 1;
}
description += "\nEnd of examples.\n\n";
description += "Translate key `" + key + "` from English to " + template.full_name + ":\n\n";
description += "```\n";
description += english_translation + "\n";
description += "```\n";
return description;
let num = 1;
for (const example of template.examples) {
description += "\nExample " + num + ":\n\n";
description += "Translate key `" + example.key + "` from English to " + template.full_name + ":\n\n";
description += "```\n";
description += example.en + "\n";
description += "```\n\n";
description += "Result:\n\n";
description += "```\n";
description += example.translated + "\n";
description += "```\n";
num += 1;
}
description += "\nEnd of examples.\n\n";
description += "Translate key `" + key + "` from English to " + template.full_name + ":\n\n";
description += "```\n";
description += english_translation + "\n";
description += "```\n";
return description;
}
async function run() {
const template = JSON.parse(await fsp.readFile(templates_path + "/" + template_name + ".json", "utf-8")) as Template;
const template = JSON.parse(await fsp.readFile(templates_path + "/" + template_name + ".json", "utf-8")) as Template;
let description_txt = await fsp.readFile(current_path + "/description.txt", "utf-8");
description_txt = description_txt.replaceAll("{TARGET_LANG}", template.full_name);
let description_txt = await fsp.readFile(current_path + "/description.txt", "utf-8");
description_txt = description_txt.replaceAll("{TARGET_LANG}", template.full_name);
const orig_english_json = JSON.parse(await fsp.readFile(lang_path + "/en.json") as any);
const orig_english_json = JSON.parse(await fsp.readFile(lang_path + "/en.json") as any);
let orig_translated_json = {};
try {
orig_translated_json = JSON.parse((await fsp.readFile(lang_path + "/" + template_name + ".json")).toString());
}
catch (_e) { }
let orig_translated_json = {};
try {
orig_translated_json = JSON.parse((await fsp.readFile(lang_path + "/" + template_name + ".json")).toString());
}
catch (_e) { }
let llm_translated_json = {};
const translated_json_path = lang_path + "/" + template_name + ".json";
if (await fsp.exists(translated_json_path)) {
llm_translated_json = JSON.parse((await fsp.readFile(translated_json_path)).toString());
}
let llm_translated_json = {};
const translated_json_path = lang_path + "/" + template_name + ".json";
if (await fsp.exists(translated_json_path)) {
console.log("Loading file", translated_json_path);
llm_translated_json = JSON.parse((await fsp.readFile(translated_json_path)).toString());
}
let human = 0;
let llm = 0;
let total_count = 0;
await loop_object(orig_english_json, "", async () => {
total_count += 1;
});
let total_count = 0;
await loop_object(orig_english_json, "", async () => {
total_count += 1;
});
await loop_object(llm_translated_json, "", async (key, _) => {
if (!key_exists(orig_english_json, key)) {
console.log("Removing key", key);
set_i18n_key(llm_translated_json, key, undefined);
fsp.writeFile(translated_json_path, JSON.stringify(llm_translated_json, undefined, 2));
}
});
await loop_object(llm_translated_json, "", async (key, _) => {
if (!key_exists(orig_english_json, key)) {
console.log("Removing key", key);
set_i18n_key(llm_translated_json, key, undefined);
fsp.writeFile(translated_json_path, JSON.stringify(llm_translated_json, undefined, 2));
}
});
await loop_object(orig_english_json, "", async (key, english_translation) => {
if (key_exists(orig_translated_json, key)) {
return;
}
await loop_object(orig_english_json, "", async (key, english_translation) => {
if (key_exists(orig_translated_json, key)) {
human += 1;
return;
}
if (key_exists(llm_translated_json, key)) {
return;
}
if (key_exists(llm_translated_json, key)) {
llm += 1;
return;
}
console.log("Translating", key, "...");
console.log("Translating", key, "...");
llm++;
const prompt = gen_prompt(description_txt, template, key, english_translation);
const prompt = gen_prompt(description_txt, template, key, english_translation);
const response = await ollama.chat({
model: model_name,
messages: [{ role: "user", content: prompt }],
options: {
seed: 12345,
}
})
const response = await ollama.chat({
model: model_name,
messages: [{ role: "user", content: prompt }],
options: {
seed: 12345,
}
})
const msg = extract_backticks(response.message.content);
if (msg === undefined || msg[0] === undefined) {
throw new Error("backticks failed. Raw content: " + response.message.content);
}
const msg = extract_backticks(response.message.content);
if (msg === undefined || msg[0] === undefined) {
throw new Error("backticks failed. Raw content: " + response.message.content);
}
console.log(" >>>", msg);
console.log(" >>>", msg);
set_i18n_key(llm_translated_json, key, msg[0]);
fsp.writeFile(translated_json_path, JSON.stringify(llm_translated_json, undefined, 2));
});
set_i18n_key(llm_translated_json, key, msg[0]);
fsp.writeFile(translated_json_path, JSON.stringify(llm_translated_json, undefined, 2));
});
console.log("\"" + template_name + "\" translation finished,", human, "were already human translated,", llm, "llm-translated (" + Math.round((llm / total_count) * 100.0) + "% machine-translated)");
console.log("Translation", template_name, "finished");
}
run().catch((e) => {
console.log("Fatal error:", e);
exit(-1);
console.log("Fatal error:", e);
exit(-1);
});
+11
View File
@@ -1,4 +1,13 @@
#!/bin/bash
# Do not run this script if you don’t have at least 32 GiB of system memory,
# unless you have enabled the mmap option in the Ollama startup settings.
# Submitting PRs that lack translated strings is okay if you don’t meet the
# system requirements to run this script, or if you simply prefer not to; we are
# regularly updating the missing translation strings anyway.
#
# Base language: English (en.json)
set -e
cd "$(dirname "$0")"
@@ -10,3 +19,5 @@ TEMPLATE="pl" bun main.ts
TEMPLATE="de" bun main.ts
TEMPLATE="ja" bun main.ts
TEMPLATE="es" bun main.ts
TEMPLATE="it" bun main.ts
TEMPLATE="zh_CN" bun main.ts
+20
View File
@@ -0,0 +1,20 @@
{
"full_name": "Italian",
"examples": [
{
"key": "BAR.OPACITY",
"en": "Opacity",
"translated": "Opacità"
},
{
"key": "PANEL.CLOSE",
"en": "Close panel",
"translated": "Chiudi pannello"
},
{
"key": "SETTINGS.LEFT_HANDED_MODE",
"en": "Left-handed mode",
"translated": "Modalità mancino"
}
]
}
+20
View File
@@ -0,0 +1,20 @@
{
"full_name": "Chinese (Simplified)",
"examples": [
{
"key": "BAR.OPACITY",
"en": "Opacity",
"translated": "不透明度"
},
{
"key": "PANEL.CLOSE",
"en": "Close panel",
"translated": "关闭面板"
},
{
"key": "SETTINGS.LEFT_HANDED_MODE",
"en": "Left-handed mode",
"translated": "左手模式"
}
]
}
-1
View File
@@ -34,7 +34,6 @@
<!-- Embed sprites -->
<sprite width="64" height="64" src="raster.png" />
<sprite width="64" height="64" src="dashboard/wayvr_dashboard.svg" />
</rectangle>
<!-- 2/3 green rects -->
<div flex_direction="column">
+13 -5
View File
@@ -36,7 +36,7 @@
<div gap="4">
<Button id="button_red" text="Red button" width="150" height="32" color="#FF0000" tooltip_str="I'm at the top" tooltip_side="top" />
<Button id="button_aqua" text="Aqua button" width="150" height="32" color="#00FFFF" tooltip_str="I'm at the bottom" tooltip_side="bottom" />
<Button id="button_yellow" text="Yellow button" width="150" height="32" color="#FFFF00" tooltip="TESTBED.HELLO_WORLD" tooltip_side="right" />
<Button id="button_yellow" text="Yellow button" width="150" height="32" color="#FFFF00" tooltip="TESTBED.HELLO_WORLD" tooltip_side="left" />
</div>
<div gap="4">
<Button id="button_click_me" text="Click me" width="128" height="24" color="#FFFFFF" />
@@ -59,10 +59,18 @@
</div>
</rectangle>
<rectangle macro="rect">
<label text="Context menu test" />
<Button id="button_context_menu" text="Show context menu" />
</rectangle>
<div>
<rectangle macro="rect">
<label text="Context menu test" />
<Button id="button_context_menu" text="Show context menu" />
</rectangle>
<rectangle macro="rect">
<label text="Editbox test" />
<EditBox text="Initial text. Test, abcdef." width="400" />
<EditBox margin_left="42" margin_top="42" margin_bottom="40" width="200" />
</rectangle>
</div>
<rectangle macro="rect">
<label text="visibility test" weight="bold" />
+9
View File
@@ -0,0 +1,9 @@
{
"BAR": {
"OPACITY": "Opacità",
"ADDITIVE": "Additivo"
},
"TESTBED": {
"HELLO_WORLD": "Ciao, mondo! Questo è un testo I18n tradotto."
}
}
+9
View File
@@ -0,0 +1,9 @@
{
"BAR": {
"OPACITY": "不透明度",
"ADDITIVE": "加法"
},
"TESTBED": {
"HELLO_WORLD": "你好,世界!这是一段翻译后的国际化文本。"
}
}
+57 -33
View File
@@ -1,5 +1,5 @@
use glam::{Vec2, vec2};
use std::sync::Arc;
use std::{rc::Rc, sync::Arc};
use testbed::{Testbed, testbed_any::TestbedAny};
use tracing_subscriber::EnvFilter;
use tracing_subscriber::filter::LevelFilter;
@@ -12,13 +12,13 @@ use vulkano::{
format::Format,
image::{ImageUsage, view::ImageView},
swapchain::{
CompositeAlpha, PresentMode, Surface, SurfaceInfo, Swapchain, SwapchainCreateInfo,
ColorSpace, CompositeAlpha, PresentMode, Surface, SurfaceInfo, Swapchain, SwapchainCreateInfo,
SwapchainPresentInfo, acquire_next_image,
},
sync::GpuFuture,
};
use wgui::{
event::{MouseButtonIndex, MouseDownEvent, MouseMotionEvent, MouseUpEvent, MouseWheelEvent},
event::{MouseButtonEvent, MouseButtonIndex, MouseMotionEvent, MouseWheelEvent},
gfx::{WGfx, cmd::WGfxClearMode},
renderer_vk::{self},
};
@@ -74,13 +74,18 @@ fn load_testbed(audio_sample_player: &mut audio::SamplePlayer) -> anyhow::Result
fn main() -> Result<(), Box<dyn std::error::Error>> {
init_logging();
let (gfx, event_loop, window, surface) =
let (gfx, event_loop, window, surface, color_space) =
init_window("[-/=]: gui scale, F10: debug draw, F11: print tree")?;
let inner_size = window.inner_size();
let mut swapchain_size = [inner_size.width, inner_size.height];
let mut swapchain_create_info =
swapchain_create_info(&gfx, gfx.surface_format, surface.clone(), swapchain_size);
let mut swapchain_create_info = swapchain_create_info(
&gfx,
gfx.surface_format,
color_space,
surface.clone(),
swapchain_size,
);
let (mut swapchain, mut images) = {
let (swapchain, images) = Swapchain::new(
@@ -169,7 +174,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
testbed
.layout()
.push_event(
&wgui::event::Event::MouseDown(MouseDownEvent {
&wgui::event::Event::MouseDown(MouseButtonEvent {
pos: mouse / scale,
index: MouseButtonIndex::Left,
device: 0,
@@ -182,7 +187,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
testbed
.layout()
.push_event(
&wgui::event::Event::MouseUp(MouseUpEvent {
&wgui::event::Event::MouseUp(MouseButtonEvent {
pos: mouse / scale,
index: MouseButtonIndex::Left,
device: 0,
@@ -216,33 +221,46 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
..
} => {
if event.state == ElementState::Pressed {
if event.physical_key == PhysicalKey::Code(KeyCode::F10) {
debug_draw_enabled = !debug_draw_enabled;
if debug_draw_enabled {
log::info!(
"Debug draw enabled\n\tAqua: widget boundary\n\tMagenta: Scissoring (separate render pass)"
);
if !event.repeat {
if event.physical_key == PhysicalKey::Code(KeyCode::F10) {
debug_draw_enabled = !debug_draw_enabled;
if debug_draw_enabled {
log::info!(
"Debug draw enabled\n\tAqua: widget boundary\n\tMagenta: Scissoring (separate render pass)"
);
}
testbed.layout().mark_redraw();
}
if event.physical_key == PhysicalKey::Code(KeyCode::F11) {
testbed.layout().print_tree();
}
if event.physical_key == PhysicalKey::Code(KeyCode::Equal) {
scale *= 1.25;
render_context
.update_viewport(&mut shared_context, swapchain_size, scale)
.unwrap();
}
if event.physical_key == PhysicalKey::Code(KeyCode::Minus) {
scale *= 0.75;
render_context
.update_viewport(&mut shared_context, swapchain_size, scale)
.unwrap();
}
testbed.layout().mark_redraw();
}
if event.physical_key == PhysicalKey::Code(KeyCode::F11) {
testbed.layout().print_tree();
}
if event.physical_key == PhysicalKey::Code(KeyCode::Equal) {
scale *= 1.25;
render_context
.update_viewport(&mut shared_context, swapchain_size, scale)
.unwrap();
}
if event.physical_key == PhysicalKey::Code(KeyCode::Minus) {
scale *= 0.75;
render_context
.update_viewport(&mut shared_context, swapchain_size, scale)
.unwrap();
}
testbed
.layout()
.push_event(
&wgui::event::Event::TextInput(wgui::event::TextInputEvent {
text: event.text.map(|text| Rc::from(text.as_str())),
}),
&mut (),
&mut (),
)
.unwrap();
}
}
Event::WindowEvent {
@@ -359,7 +377,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.unwrap();
if debug_draw_enabled {
log::debug!("pass count: {}", draw_result.pass_count);
log::debug!(
"pass count: {}, primitive commands count: {}",
draw_result.pass_count,
draw_result.primitive_commands_count
);
}
cmd_buf.end_rendering().unwrap();
@@ -396,6 +418,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
fn swapchain_create_info(
graphics: &WGfx,
format: Format,
color_space: ColorSpace,
surface: Arc<Surface>,
extent: [u32; 2],
) -> SwapchainCreateInfo {
@@ -449,6 +472,7 @@ fn swapchain_create_info(
image_format: format,
image_extent: extent,
image_usage: ImageUsage::COLOR_ATTACHMENT,
image_color_space: color_space,
composite_alpha,
..Default::default()
}
+5 -2
View File
@@ -12,6 +12,7 @@ use wgui::{
layout::{Layout, LayoutParams, LayoutUpdateParams},
parser::{ParseDocumentParams, ParserState},
};
use wlx_common::locale::WayVRLangProvider;
pub struct TestbedAny {
pub layout: Layout,
@@ -28,9 +29,11 @@ impl TestbedAny {
AssetPath::BuiltIn(&format!("gui/{name}.xml"))
};
let lang_provider = WayVRLangProvider::default();
let globals = WguiGlobals::new(
assets,
wgui::globals::Defaults::default(),
&lang_provider,
&WguiFontConfig::default(),
PathBuf::new(), // cwd
)?;
@@ -41,7 +44,7 @@ impl TestbedAny {
path,
extra: Default::default(),
},
&LayoutParams::default(),
LayoutParams::default(),
)?;
Ok(Self { layout, state })
}
+11 -9
View File
@@ -1,7 +1,9 @@
use std::rc::Rc;
use crate::testbed::{Testbed, TestbedUpdateParams};
use dash_frontend::frontend::{self, FrontendUpdateParams};
use wgui::layout::Layout;
use wlx_common::dash_interface_emulated::DashInterfaceEmulated;
use wgui::{layout::Layout, theme::WguiTheme};
use wlx_common::{dash_interface_emulated::DashInterfaceEmulated, locale::WayVRLangProvider};
pub struct TestbedDashboard {
frontend: frontend::Frontend<()>,
@@ -10,14 +12,14 @@ pub struct TestbedDashboard {
impl TestbedDashboard {
pub fn new() -> anyhow::Result<Self> {
let interface = DashInterfaceEmulated::new();
let lang_provider = WayVRLangProvider::default();
let frontend = frontend::Frontend::new(
frontend::InitParams {
interface: Box::new(interface),
has_monado: true,
},
&mut (),
)?;
let frontend = frontend::Frontend::new(frontend::InitParams {
interface: Box::new(interface),
has_monado: true,
lang_provider: &lang_provider,
theme: Rc::new(WguiTheme::default()),
})?;
Ok(Self { frontend })
}
}
+13 -9
View File
@@ -21,12 +21,14 @@ use wgui::{
parser::{Fetchable, ParseDocumentExtra, ParseDocumentParams, ParserState},
taffy::{self, prelude::length},
task::Tasks,
theme::WguiTheme,
widget::{div::WidgetDiv, label::WidgetLabel, rectangle::WidgetRectangle},
windowing::{
context_menu::{self, TickResult},
window::{WguiWindow, WguiWindowParams, WguiWindowParamsExtra},
},
};
use wlx_common::locale::WayVRLangProvider;
#[derive(Clone)]
pub enum TestbedTask {
@@ -53,10 +55,9 @@ fn button_click_callback(
label: Widget,
text: &'static str,
) -> ButtonClickCallback {
Box::new(move |common, _e| {
Rc::new(move |common, _e| {
label
.get_as::<WidgetLabel>()
.unwrap()
.cast::<WidgetLabel>()?
.set_text(common, Translation::from_raw_text(text));
button.try_cast::<ComponentButton>()?.set_text(
@@ -86,9 +87,11 @@ impl TestbedGeneric {
}
pub fn new(assets: Box<assets::Asset>) -> anyhow::Result<Self> {
let lang_provider = WayVRLangProvider::default();
let globals = WguiGlobals::new(
assets,
wgui::globals::Defaults::default(),
&lang_provider,
&WguiFontConfig::default(),
PathBuf::new(), // cwd
)?;
@@ -122,8 +125,9 @@ impl TestbedGeneric {
let (layout, parser_state) = wgui::parser::new_layout_from_assets(
&TestbedGeneric::doc_params(&globals, extra),
&LayoutParams {
LayoutParams {
resize_to_parent: true,
theme: Rc::new(WguiTheme::default()),
},
)?;
@@ -148,7 +152,7 @@ impl TestbedGeneric {
parser_state.fetch_component_as::<ComponentButton>("button_context_menu")?;
let button_click_me = parser_state.fetch_component_as::<ComponentButton>("button_click_me")?;
let button = button_click_me.clone();
button_click_me.on_click(Box::new(move |common, _e| {
button_click_me.on_click(Rc::new(move |common, _e| {
button.set_text(common, Translation::from_raw_text("congrats!"));
Ok(())
}));
@@ -169,7 +173,7 @@ impl TestbedGeneric {
let cb_first = parser_state.fetch_component_as::<ComponentCheckbox>("cb_first")?;
let label = label_cur_option.widget.clone();
cb_first.on_toggle(Box::new(move |common, e| {
let mut widget = label.get_as::<WidgetLabel>().unwrap();
let mut widget = label.cast::<WidgetLabel>()?;
let text = format!("checkbox toggle: {}", e.checked);
widget.set_text(common, Translation::from_raw_text(&text));
Ok(())
@@ -188,7 +192,7 @@ impl TestbedGeneric {
button_popup.on_click({
let tasks = testbed.tasks.clone();
Box::new(move |_, _| {
Rc::new(move |_, _| {
tasks.push(TestbedTask::ShowPopup);
Ok(())
})
@@ -196,7 +200,7 @@ impl TestbedGeneric {
button_context_menu.on_click({
let tasks = testbed.tasks.clone();
Box::new(move |_common, m| {
Rc::new(move |_common, m| {
tasks.push(TestbedTask::ShowContextMenu(m.boundary.bottom_left()));
Ok(())
})
+11 -8
View File
@@ -1,3 +1,4 @@
use anyhow::Context;
use std::sync::{Arc, OnceLock};
use vulkano::{
device::{
@@ -5,6 +6,7 @@ use vulkano::{
physical::{PhysicalDevice, PhysicalDeviceType},
},
instance::{Instance, InstanceCreateInfo},
swapchain::ColorSpace,
};
use wgui::gfx::WGfx;
@@ -21,6 +23,7 @@ pub fn init_window(
winit::event_loop::EventLoop<()>,
Arc<winit::window::Window>,
Arc<vulkano::swapchain::Surface>,
ColorSpace,
)> {
use vulkano::{instance::InstanceCreateFlags, swapchain::Surface};
use winit::{event_loop::EventLoop, window::Window};
@@ -90,6 +93,12 @@ pub fn init_window(
log::info!("img_filter_cubic!");
}
let (format, color_space) = physical_device
.surface_formats(&surface, vulkano::swapchain::SurfaceInfo::default())?
.into_iter()
.find(|(format, _)| !format.components().iter().any(|b| *b > 8))
.context("Could not read or no suitable surface formats for PhysicalDevice")?;
let (device, queues) = Device::new(
physical_device,
DeviceCreateInfo {
@@ -113,14 +122,8 @@ pub fn init_window(
let (queue_gfx, queue_xfer, _) = unwrap_queues(queues.collect());
let me = WGfx::new_from_raw(
instance,
device,
queue_gfx,
queue_xfer,
vulkano::format::Format::R8G8B8A8_SRGB,
);
Ok((me, event_loop, window, surface))
let me = WGfx::new_from_raw(instance, device, queue_gfx, queue_xfer, format);
Ok((me, event_loop, window, surface, color_space))
}
#[derive(Debug)]
+1 -1
View File
@@ -8,7 +8,7 @@ authors = ["galister", "oo8dev"]
repository = "https://github.com/wlx-team/wayvr"
[dependencies]
bytes = "1.9.0"
bytes = "1.11.1"
smallvec = "1.13.2"
serde.workspace = true
anyhow = "1.0.93"
+1 -5
View File
@@ -2,8 +2,4 @@
This repository contains the IPC specification and client implementation for the WayVR protocol. The primary purpose is to enable communication between applications and the WayVR server, offering a range of API functions.
[WayVR Server README](https://github.com/galister/wlx-overlay-s/tree/main/contrib/wayvr)
## Usage
[Example WayVR IPC Client usage in WayVR Dashboard (Legacy)](https://github.com/olekolek1000/wayvr-dashboard/blob/master/src-tauri/src/frontend_ipc.rs)
[Wayvrctl Documentation](https://wayvr.org/docs/various/integrations/wayvr-ipc/)
+6 -1
View File
@@ -410,11 +410,16 @@ impl WayVRClient {
Ok(())
}
pub async fn fn_wlx_overlay_show_hide(client: WayVRClientMutex) -> anyhow::Result<()> {
pub async fn fn_wlx_show_hide(client: WayVRClientMutex) -> anyhow::Result<()> {
send_only!(client, &PacketClient::WlxShowHide);
Ok(())
}
pub async fn fn_wlx_switch_set(client: WayVRClientMutex, set: Option<usize>) -> anyhow::Result<()> {
send_only!(client, &PacketClient::WlxSwitchSet(set));
Ok(())
}
pub async fn fn_wlx_modify_panel(
client: WayVRClientMutex,
params: packet_client::WlxModifyPanelParams,
+1
View File
@@ -68,4 +68,5 @@ pub enum PacketClient {
WlxModifyPanel(WlxModifyPanelParams),
WlxDeviceHaptics(usize, WlxHapticsParams),
WlxShowHide,
WlxSwitchSet(Option<usize>),
}
+9 -11
View File
@@ -1,6 +1,6 @@
[package]
name = "wayvr"
version = "26.1.2"
version = "26.2.1"
edition = "2024"
license = "GPL-3.0-only"
authors = ["galister", "oo8dev"]
@@ -43,8 +43,9 @@ vulkano-shaders.workspace = true
xdg.workspace = true
ash = "^0.38.0" # must match vulkano
bytes = { version = "1.11.0" }
chrono = "0.4.42"
bytes = { version = "1.11.1" }
chrono = { version = "0.4.42", features = [ "unstable-locales"]}
pure-rust-locales = "0.8.2"
chrono-tz = "0.10.4"
config = "0.15.19"
dbus = { version = "0.9.9" }
@@ -57,17 +58,14 @@ interprocess = { version = "2.2.3" }
json = { version = "0.12.4", optional = true }
json5 = "1.3.0"
libc = "0.2.178"
libmonado = { git = "https://github.com/technobaboo/libmonado-rs.git", rev = "26292e5b14663ee2f089f66f0851438a0c00ee67", optional = true }
libmonado = { version = "1.6.0", optional = true }
log-panics = { version = "2.1.0", features = ["with-backtrace"] }
mint = "0.5.9"
openxr = { version = "0.21.0", features = [
"linked",
"mint",
], optional = true }
openxr = { version = "0.21.0", features = ["linked", "mint"], optional = true }
ovr_overlay = { features = [
"ovr_input",
"ovr_system",
], git = "https://github.com/galister/ovr_overlay_oyasumi", rev = "8d62c73d5f17e4210d6d0cd52e7f3953eb9b481a", optional = true }
], git = "https://github.com/galister/ovr_overlay_oyasumi", rev = "e477bd2a9e04293ea68c1e7529ef2cb131f32acc", optional = true }
rosc = { version = "0.11.4", optional = true }
serde_json5 = "0.2.1"
serde_yaml = "0.9.34"
@@ -78,7 +76,7 @@ smithay = { version = "0.7.0", default-features = false, features = [
"desktop",
"xwayland",
"wayland_frontend",
]}
] }
sysinfo = { version = "0.37" }
thiserror = "2.0"
tracing-subscriber = { version = "0.3.22", features = ["env-filter"] }
@@ -95,7 +93,7 @@ xkbcommon = { version = "0.8.0" } # 0.9.0 breaks keymap import on some distros
regex.workspace = true
[features]
default = ["openvr", "openxr", "osc", "x11", "wayland" ]
default = ["openvr", "openxr", "osc", "x11", "wayland"]
openvr = ["dep:ovr_overlay", "dep:json"]
openxr = ["dep:openxr", "dep:libmonado"]
osc = ["dep:rosc"]
-42
View File
@@ -1,42 +0,0 @@
<p align="center">
<img src="https://raw.githubusercontent.com/galister/wlx-overlay-s/refs/heads/guide/wayvr/logo.svg" height="120"/>
</p>
# Overview
### Features
- Display Wayland applications without GPU overhead (zero-copy via dma-buf)
- Mouse and keyboard input, with precision scrolling support
- Tested on AMD and Nvidia
### Supported software
- Basically all Qt and GTK applications (they work out of the box)
- Most XWayland applications via `cage`
### Launching external apps inside WayVR
To launch your app externally:
```sh
DISPLAY= WAYLAND_DISPLAY=wayland-$(cat $XDG_RUNTIME_DIR/wayvr.disp) yourapp
```
or (in the most cases):
```
DISPLAY= WAYLAND_DISPLAY=wayland-20 yourapp
```
Setting `DISPLAY` to an empty string forces various apps to use Wayland instead of X11.
# Troubleshooting
### My application doesn't launch but others do!
Even though some applications support Wayland, some still check for the `DISPLAY` environment variable and an available X11 server, throwing an error. This can also be fixed by running `cage` on top of them.
### Floating windows
Context menus are not functional in most cases yet, including drag & drop support.
+9
View File
@@ -72,6 +72,10 @@
<div id="pos_align_to_hmd" >
<CheckBox id="align_box" translation="EDIT_MODE.ALIGN_TO_HMD" tooltip_side="bottom" />
</div>
<div id="pos_global" gap="16" justify_content="center" align_items="center">
<CheckBox id="global_box" translation="EDIT_MODE.GLOBAL" tooltip_side="bottom" />
<CheckBox id="block_input_box" translation="EDIT_MODE.BLOCK_INPUT" tooltip_side="bottom" />
</div>
</div>
</div>
<div id="tab_stereo" display="none" height="100" flex_direction="column">
@@ -82,6 +86,10 @@
<PosButton id="stereo_topbottom" src="edit/3d_topbottom.svg" tooltip="EDIT_MODE.STEREO_3D_MODE.SPLIT_TOP_BOTTOM" press="::EditModeSetStereo topbottom" />
<PosButton id="stereo_bottomtop" src="edit/3d_bottomtop.svg" tooltip="EDIT_MODE.STEREO_3D_MODE.SPLIT_BOTTOM_TOP" press="::EditModeSetStereo bottomtop" />
</div>
<div justify_content="center" align_items="center" flex_direction="row" gap="16">
<CheckBox id="stereo_full_frame_box" translation="EDIT_MODE.STEREO_3D_MODE.FULL_FRAME" tooltip_side="top" />
<CheckBox id="stereo_adjust_mouse_box" translation="EDIT_MODE.STEREO_3D_MODE.ADJUST_MOUSE" tooltip_side="top" />
</div>
</div>
<div id="tab_mouse" display="none" height="100" flex_direction="column">
<div padding_left="8" padding_right="8" gap="8" justify_content="center" align_items="center">
@@ -106,6 +114,7 @@
</div>
<div width="100%" padding="8" gap="8" justify_content="center" align_items="center">
<CheckBox id="additive_box" translation="EDIT_MODE.BLENDING_ADDITIVE" tooltip="EDIT_MODE.ALPHA_BLEND_MODE" tooltip_side="bottom" />
<CheckBox id="angle_fade_box" translation="EDIT_MODE.ANGLE_FADE" tooltip="EDIT_MODE.ANGLE_FADE_HELP" tooltip_side="bottom" />
</div>
</div>
<div id="tab_curve" display="none" height="100" flex_direction="column">
+27 -10
View File
@@ -55,7 +55,7 @@
<template name="KeySymbol">
<div macro="keycap_div">
<rectangle id="${id}" macro="keycap_rect" gap="3">
<label color="~color_text_translucent" text="${text_shift}" size="1" />
<label color="~color_text_translucent" text="${text_shift}" size="18" />
<label text="${text}" size="18" />
</rectangle>
</div>
@@ -107,7 +107,7 @@
<!-- An app with a single icon. -->
<template name="App">
<Button macro="button_style" id="overlay_${idx}" tooltip_str="${name}" _context_name="${name}" _press="::ContextMenuOpen menu_app">
<Button macro="button_style" id="overlay_${idx}" tooltip_str="${name}" _context_name="${name}" _press_left="::ContextMenuOpen menu_app" _press_right="::OverlayToggle ${name}">
<sprite width="38" height="38" color="~color_text" src_ext="${icon}" />
</Button>
</template>
@@ -122,7 +122,7 @@
<!-- A screen with a shortened connector name, e.g. "H1" for HDMI-A-1 or "D2" for DP-2 -->
<template name="Screen">
<Button macro="button_style" id="overlay_${idx}" tooltip_str="${name}" _context_name="${name}" _press="::ContextMenuOpen menu_screen">
<Button macro="button_style" id="overlay_${idx}" tooltip_str="${name}" _context_name="${name}" _press_left="::ContextMenuOpen menu_screen" _press_right="::OverlayToggle ${name}">
<sprite width="38" height="38" color="~color_text" src_builtin="edit/screen.svg" />
<div position="absolute" margin_top="-7" margin_left="-1">
<label text="${display}" size="18" color="~color_faded_20" weight="bold" />
@@ -140,7 +140,7 @@
</blueprint>
<template name="Panel">
<Button macro="button_style" id="overlay_${idx}" tooltip_str="${name}" _context_name="${name}" _press="::ContextMenuOpen menu_panel">
<Button macro="button_style" id="overlay_${idx}" tooltip_str="${name}" _context_name="${name}" _press_left="::ContextMenuOpen menu_panel" _press_right="::OverlayToggle ${name}">
<sprite width="38" height="38" color="~color_text" src="${icon}" />
</Button>
</template>
@@ -155,7 +155,7 @@
</blueprint>
<template name="Mirror">
<Button macro="button_style" id="overlay_${idx}" tooltip_str="${name}" _context_name="${name}" _press="::ContextMenuOpen menu_mirror">
<Button macro="button_style" id="overlay_${idx}" tooltip_str="${name}" _context_name="${name}" _press_left="::ContextMenuOpen menu_mirror" _press_right="::OverlayToggle ${name}">
<sprite width="38" height="38" color="~color_text" src_builtin="edit/mirror.svg" />
<div position="absolute" margin_top="5" margin_left="13">
<label text="${display}" size="20" color="~color_faded_20" weight="bold" />
@@ -163,10 +163,21 @@
</Button>
</template>
<blueprint name="menu_handsfree">
<context_menu >
<cell translation="BAR.HANDSFREE.NONE" _press="::HandsfreeMode None" _press2="::ContextMenuClose" />
<cell translation="BAR.HANDSFREE.HMD" _press="::HandsfreeMode Hmd" _press2="::ContextMenuClose" />
<cell translation="BAR.HANDSFREE.HMD_ONLY" _press="::HandsfreeMode HmdOnly" _press2="::ContextMenuClose" />
<cell translation="BAR.HANDSFREE.EYE_TRACKING" _press="::HandsfreeMode EyeTracking" _press2="::ContextMenuClose" />
<cell translation="BAR.HANDSFREE.EYE_ONLY" _press="::HandsfreeMode EyeTrackingOnly" _press2="::ContextMenuClose" />
</context_menu>
</blueprint>
<blueprint name="menu_burger">
<context_menu >
<cell translation="BAR.EDIT_MODE_TOGGLE" _press="::EditToggle" _press2="::ContextMenuClose" />
<cell translation="BAR.HANDSFREE.TITLE" _press="::ContextMenuOpen menu_handsfree" />
<cell translation="BAR.ADD_MIRROR" _press="::NewMirror" />
<cell translation="BAR.EDIT_MODE_TOGGLE" _press="::EditToggle" />
<cell translation="BAR.ADD_NEW_SET" _press="::AddSet" />
<cell translation="BAR.DELETE_CURRENT_SET" _press="::DeleteSet" />
</context_menu>
@@ -181,6 +192,14 @@
</Button>
</template>
<template name="Clock">
<div flex_direction="column" gap="3" align_items="center">
<label text="23:59" _source="clock" _display="time" size="21" weight="bold" />
<label text="Tuesday" _source="clock" _display="dow" size="15" />
<label text="22/2/2022" _source="clock" _display="date" size="15" />
</div>
</template>
<elements>
<div flex_direction="column" interactable="0">
<rectangle macro="bg_rect" padding="10" align_items="center" justify_content="space_between">
@@ -207,10 +226,8 @@
<VerticalSeparator />
<div flex_direction="column" gap="3" align_items="center">
<label text="23:59" _source="clock" _display="time" size="21" weight="bold" />
<label text="Tuesday" _source="clock" _display="dow" size="15" />
<label text="22/2/2022" _source="clock" _display="date" size="15" />
<div id="clock_root">
<Clock />
</div>
</div>
</rectangle>
+1 -1
View File
@@ -67,7 +67,7 @@
<template name="Set">
<Button macro="button_style" id="set_${idx}" _press="::SetToggle ${idx}" tooltip="WATCH.SWITCH_TO_SET" tooltip_side="top">
<sprite width="40" height="40" color="~color_text" src_builtin="watch/set2.svg" />
<sprite width="38" height="38" color="~color_text" src_builtin="watch/set2.svg" />
<div position="absolute" margin_top="9">
<label text="${display}" size="24" color="#00050F" weight="bold" />
</div>
+24 -6
View File
@@ -12,7 +12,15 @@
"RELOAD_FROM_DISK": "XML-Datei von der Festplatte neu laden",
"CLOSE_MIRROR": "Spiegel schließen",
"CLOSE_APP": "App schließen",
"FORCE_CLOSE_APP": "App zwangsweise schließen"
"FORCE_CLOSE_APP": "App zwangsweise schließen",
"HANDSFREE": {
"TITLE": "Freihändig-Modus",
"NONE": "Aus",
"HMD": "HMD + Kneifen",
"EYE_TRACKING": "Auge + Kneifen",
"HMD_ONLY": "Nur HMD",
"EYE_ONLY": "Nur Augen"
}
},
"WATCH": {
"RECENTER": "Spielbereich neu zentrieren",
@@ -54,7 +62,12 @@
"SPLIT_LEFT_RIGHT": "LINKS→RECHTS",
"SPLIT_RIGHT_LEFT": "RECHTS→LINKS",
"SPLIT_TOP_BOTTOM": "OBEN→UNTEN",
"SPLIT_BOTTOM_TOP": "UNTEN→OBEN"
"SPLIT_BOTTOM_TOP": "UNTEN→OBEN",
"FULL_FRAME": "Voll 3D",
"FULL_FRAME_SBS": "Full-SBS",
"FULL_FRAME_TAB": "Full-TAB",
"FULL_FRAME_BAT": "Full-BAT",
"ADJUST_MOUSE": "Maus anpassen"
},
"STEREO_3D_MODE_": {},
"ALIGN_TO_HMD": "An HMD ausrichten",
@@ -69,7 +82,11 @@
"ROTATE90": "90° gedreht",
"ROTATE180": "180° gedreht",
"ROTATE270": "270° gedreht"
}
},
"GLOBAL": "Immer sichtbar",
"ANGLE_FADE": "Winkelübergang",
"ANGLE_FADE_HELP": "Ausblenden, wenn nicht auf das Headset gerichtet",
"BLOCK_INPUT": "Blockiere Spieleingabe"
},
"DISABLED": "Deaktiviert",
"DEFAULT": "Standard",
@@ -92,9 +109,10 @@
"LAST_EXISTING_SET": "Dies ist das letzte vorhandene Set.",
"EMPTY_SET": "Leeres Set!",
"LETS_ADD_OVERLAYS": "Lass uns ein paar Overlays von der Uhr hinzufügen!",
"FIXING_FLOOR": "Boden wird in 5 Sekunden fixiert...",
"ONE_CONTROLLER_ON_FLOOR": "Lege einen Controller auf den Boden!",
"CANNOT_ADD_SET": "Satz kann nicht hinzugefügt werden!",
"MAXIMUM_SETS_REACHED": "Maximale Anzahl an Sets erreicht."
}
"MAXIMUM_SETS_REACHED": "Maximale Anzahl an Sets erreicht.",
"FIXING_FLOOR_IN_X_SECS": "Boden wird in {SECONDS} Sekunde(n) repariert..."
},
"DONE": "Erledigt"
}
+48 -30
View File
@@ -4,31 +4,56 @@
},
"BAR": {
"ADD_MIRROR": "Add a new mirror overlay",
"EDIT_MODE_TOGGLE": "Toggle edit mode",
"ADD_NEW_SET": "Add new set",
"DELETE_CURRENT_SET": "Delete current set",
"TOGGLE_VISIBILITY": "Toggle visibility",
"RESET_POSITION": "Reset position",
"RELOAD_FROM_DISK": "Reload XML from disk",
"CLOSE_MIRROR": "Close mirror",
"CLOSE_APP": "Close app",
"FORCE_CLOSE_APP": "Force close app"
"CLOSE_MIRROR": "Close mirror",
"DELETE_CURRENT_SET": "Delete current set",
"EDIT_MODE_TOGGLE": "Toggle edit mode",
"FORCE_CLOSE_APP": "Force close app",
"HANDSFREE": {
"EYE_ONLY": "Eye only",
"EYE_TRACKING": "Eye + pinch",
"HMD": "HMD + pinch",
"HMD_ONLY": "HMD only",
"NONE": "Off",
"TITLE": "Handsfree mode"
},
"RELOAD_FROM_DISK": "Reload XML from disk",
"RESET_POSITION": "Reset position",
"TOGGLE_VISIBILITY": "Toggle visibility"
},
"DEFAULT": "Default",
"DISABLED": "Disabled",
"DONE": "Done",
"EDIT_MODE": {
"ADJUST_CURVATURE": "Adjust curvature",
"ALIGN_TO_HMD": "Align to HMD",
"ALPHA_BLEND_MODE": "Alpha blend mode",
"ANGLE_FADE": "Angle fade",
"ANGLE_FADE_HELP": "Fade when not facing HMD",
"BLENDING_ADDITIVE": "Additive blending",
"BLOCK_INPUT": "Block game input",
"CURVATURE": "Curvature",
"DELETE": "Long press to remove from current set",
"DISABLE_GRAB": "Disable grab",
"GLOBAL": "Always visible",
"HINT_POINT_WINDOW": "Point at a window to change its parameters.\nOnce done, leave edit mode using the button on the right.",
"INTERPOLATION": "Interpolation",
"ALIGN_TO_HMD": "Align to HMD",
"KEYBOARD": "Keyboard",
"LEAVE": "Leave edit mode",
"LOCK_INTERACTION": "Lock interaction",
"MOUSE": {
"FLIP180": "Flipped 180°",
"FLIP270": "Flipped 270°",
"FLIP90": "Flipped 90°",
"FLIPPED": "Flipped",
"NORMAL": "Normal",
"ROTATE180": "Rotated 180°",
"ROTATE270": "Rotated 270°",
"ROTATE90": "Rotated 90°",
"TITLE": "Mouse fixes",
"WRONG_SCREEN_SELECTION_HELP": "If the cursor moves on a completely different screen,\nthe screens were likely selected wrong. See readme."
},
"MOVE_PRESS_AND_DRAG": "Move (press & drag)",
"OPACITY": "Opacity",
"POS_ANCHORED": "Anchored: Moves with center marker. Default.",
@@ -40,47 +65,40 @@
"POSITIONING": "Positioning",
"RESIZE_PRESS_AND_DRAG": "Resize (press & drag)",
"STEREO_3D_MODE": {
"ADJUST_MOUSE": "Adjust mouse",
"FULL_FRAME": "Full 3D",
"FULL_FRAME_BAT": "Full-BAT",
"FULL_FRAME_SBS": "Full-SBS",
"FULL_FRAME_TAB": "Full-TAB",
"SPLIT_BOTTOM_TOP": "BOTTOM→TOP",
"SPLIT_LEFT_RIGHT": "LEFT→RIGHT",
"SPLIT_RIGHT_LEFT": "RIGHT→LEFT",
"SPLIT_TOP_BOTTOM": "TOP→BOTTOM",
"TITLE": "3D Stereo Mode"
},
"MOUSE": {
"TITLE": "Mouse fixes",
"WRONG_SCREEN_SELECTION_HELP": "If the cursor moves on a completely different screen,\nthe screens were likely selected wrong. See readme.",
"NORMAL": "Normal",
"ROTATE90": "Rotated 90°",
"ROTATE180": "Rotated 180°",
"ROTATE270": "Rotated 270°",
"FLIPPED": "Flipped",
"FLIP90": "Flipped 90°",
"FLIP180": "Flipped 180°",
"FLIP270": "Flipped 270°"
}
},
"GRAB": {
"ADJUST_DISTANCE": "Adjust distance",
"ADJUST_SIZE": "Adjust size",
"UNRESTRICTED_MOVEMENT": "Unrestricted movement",
"GRABBING_WATCH": "To swap hands, move the watch in front and grab it with the other hand.",
"GRABBING_STATIC": "This overlay is Static and will stay in place, ignoring recenter.",
"GRABBING_ANCHORED": "Anchored overlays all move together. Separate a single window by grabbing it with the other hand while still grabbing the anchor.",
"GRABBING_ANCHORED_EDIT": "This overlay will stay anchored to the center marker.",
"GRABBING_FLOATING": "This overlay is Floating and will stay in place, unless recentered.",
"GRABBING_FOLLOW": "This overlay will follow the device it is attached to."
"GRABBING_FOLLOW": "This overlay will follow the device it is attached to.",
"GRABBING_STATIC": "This overlay is Static and will stay in place, ignoring recenter.",
"GRABBING_WATCH": "To swap hands, move the watch in front and grab it with the other hand.",
"UNRESTRICTED_MOVEMENT": "Unrestricted movement"
},
"TOAST": {
"DEFAULT_TITLE": "Notification",
"ERROR": "Error",
"CANNOT_ADD_SET": "Cannot add set!",
"MAXIMUM_SETS_REACHED": "Maximum number of sets reached.",
"CANNOT_REMOVE_SET": "Cannot remove set!",
"NO_SET_SELECTED": "No set is selected.",
"LAST_EXISTING_SET": "This is the last existing set.",
"DEFAULT_TITLE": "Notification",
"EMPTY_SET": "Empty set!",
"ERROR": "Error",
"FIXING_FLOOR_IN_X_SECS": "Fixing floor in {SECONDS} second(s)...",
"LAST_EXISTING_SET": "This is the last existing set.",
"LETS_ADD_OVERLAYS": "Let's add some overlays from the watch!",
"FIXING_FLOOR": "Fixing floor in 5 seconds...",
"MAXIMUM_SETS_REACHED": "Maximum number of sets reached.",
"NO_SET_SELECTED": "No set is selected.",
"ONE_CONTROLLER_ON_FLOOR": "Place one controller on the floor!"
},
"WATCH": {
+24 -6
View File
@@ -12,7 +12,15 @@
"RELOAD_FROM_DISK": "Volver a cargar XML desde el disco",
"CLOSE_MIRROR": "Cerrar espejo",
"CLOSE_APP": "Cerrar aplicación",
"FORCE_CLOSE_APP": "Forzar cierre de la aplicación"
"FORCE_CLOSE_APP": "Forzar cierre de la aplicación",
"HANDSFREE": {
"TITLE": "Modo manos libres",
"NONE": "Desactivado",
"HMD": "HMD + pellizco",
"EYE_TRACKING": "Ojo + pellizco",
"HMD_ONLY": "Solo HMD",
"EYE_ONLY": "Solo ojos"
}
},
"WATCH": {
"RECENTER": "Recentrar el área de juego",
@@ -54,7 +62,12 @@
"SPLIT_LEFT_RIGHT": "IZQ→DER",
"SPLIT_RIGHT_LEFT": "DERECHA→IZQUIERDA",
"SPLIT_TOP_BOTTOM": "ARRIBA→ABAJO",
"SPLIT_BOTTOM_TOP": "ABAJO→ARRIBA"
"SPLIT_BOTTOM_TOP": "ABAJO→ARRIBA",
"FULL_FRAME": "3D completo",
"FULL_FRAME_SBS": "Full-SBS",
"FULL_FRAME_TAB": "Full-TAB",
"FULL_FRAME_BAT": "Full-BAT",
"ADJUST_MOUSE": "Ajustar ratón"
},
"STEREO_3D_MODE_": {},
"ALIGN_TO_HMD": "Alinear al HMD",
@@ -69,7 +82,11 @@
"ROTATE90": "Rotado 90°",
"ROTATE180": "Rotado 180°",
"ROTATE270": "Rotado 270°"
}
},
"GLOBAL": "Siempre visible",
"ANGLE_FADE": "Atenuación angular",
"ANGLE_FADE_HELP": "Desvanecer cuando no se mira el HMD",
"BLOCK_INPUT": "Bloquear entrada del juego"
},
"DISABLED": "Deshabilitado",
"DEFAULT": "Por defecto",
@@ -92,9 +109,10 @@
"LAST_EXISTING_SET": "Este es el último conjunto existente.",
"EMPTY_SET": "¡Conjunto vacío!",
"LETS_ADD_OVERLAYS": "¡Añadamos algunos overlays desde el reloj!",
"FIXING_FLOOR": "Fijando el suelo en 5 segundos...",
"ONE_CONTROLLER_ON_FLOOR": "¡Coloca un mando en el suelo!",
"CANNOT_ADD_SET": "¡No se puede agregar el conjunto!",
"MAXIMUM_SETS_REACHED": "Se ha alcanzado el número máximo de sets."
}
"MAXIMUM_SETS_REACHED": "Se ha alcanzado el número máximo de sets.",
"FIXING_FLOOR_IN_X_SECS": "Corrigiendo el suelo en {SECONDS} segundo(s)..."
},
"DONE": "Hecho"
}
+116
View File
@@ -0,0 +1,116 @@
{
"ANCHOR": {
"CENTER": "Centro"
},
"BAR": {
"ADD_MIRROR": "Aggiungi un nuovo overlay specchio",
"EDIT_MODE_TOGGLE": "Attiva/disattiva modalità modifica",
"ADD_NEW_SET": "Aggiungi nuovo set",
"DELETE_CURRENT_SET": "Elimina set attuale",
"TOGGLE_VISIBILITY": "Alterna visibilità",
"RESET_POSITION": "Ripristina posizione",
"RELOAD_FROM_DISK": "Ricarica XML dal disco",
"CLOSE_MIRROR": "Chiudi mirror",
"CLOSE_APP": "Chiudi app",
"FORCE_CLOSE_APP": "Chiudi forzatamente l'app",
"HANDSFREE": {
"TITLE": "Modalità a mani libere",
"NONE": "Disattivato",
"HMD": "HMD + pizzico",
"EYE_TRACKING": "Occhio + pizzico",
"HMD_ONLY": "Solo HMD",
"EYE_ONLY": "Solo occhi"
}
},
"DEFAULT": "Predefinito",
"DISABLED": "Disabilitato",
"EDIT_MODE": {
"ADJUST_CURVATURE": "Regola curvatura",
"ALPHA_BLEND_MODE": "Modalità di fusione Alpha",
"BLENDING_ADDITIVE": "Blending additivo",
"CURVATURE": "Curvatura",
"DELETE": "Tenere premuto per rimuovere dal set corrente",
"DISABLE_GRAB": "Disabilita l'afferra",
"HINT_POINT_WINDOW": "Punta a una finestra per modificarne i parametri.\nUna volta fatto, esci dalla modalità di modifica usando il pulsante a destra.",
"INTERPOLATION": "Interpolazione",
"ALIGN_TO_HMD": "Allinea all'HMD",
"KEYBOARD": "Tastiera",
"LEAVE": "Esci dalla modalità di modifica",
"LOCK_INTERACTION": "Blocca interazione",
"MOVE_PRESS_AND_DRAG": "Muovi (premi e trascina)",
"OPACITY": "Opacità",
"POS_ANCHORED": "Ancorato: si muove con il marker centrale. Predefinito.",
"POS_FLOATING": "Galleggiante: si muove indipendentemente, si recentra quando viene visualizzato.",
"POS_HAND_L": "Segui la mano sinistra.",
"POS_HAND_R": "Segui la mano destra.",
"POS_HMD": "Segui l'HMD.",
"POS_STATIC": "Statico: non fa parte di alcun set, senza recentratura.",
"POSITIONING": "Posizionamento",
"RESIZE_PRESS_AND_DRAG": "Ridimensiona (premi e trascina)",
"STEREO_3D_MODE": {
"SPLIT_BOTTOM_TOP": "DAL BASSO→IN ALTO",
"SPLIT_LEFT_RIGHT": "SINISTRA→DESTRA",
"SPLIT_RIGHT_LEFT": "DESTRA→SINISTRA",
"SPLIT_TOP_BOTTOM": "TOP→BOTTOM",
"TITLE": "Modalità Stereo 3D",
"FULL_FRAME": "3D Completo",
"FULL_FRAME_SBS": "Full-SBS",
"FULL_FRAME_TAB": "Full-TAB",
"FULL_FRAME_BAT": "Full-BAT",
"ADJUST_MOUSE": "Regola il mouse"
},
"MOUSE": {
"TITLE": "Correzioni del mouse",
"WRONG_SCREEN_SELECTION_HELP": "Se il cursore si sposta su uno schermo completamente diverso,\nprobabilmente gli schermi sono stati selezionati in modo errato. Consulta il file readme.",
"NORMAL": "Normale",
"ROTATE90": "Ruotato di 90°",
"ROTATE180": "Ruotato di 180°",
"ROTATE270": "Ruotato di 270°",
"FLIPPED": "Capovolto",
"FLIP90": "Ruotato di 90°",
"FLIP180": "Ruotato di 180°",
"FLIP270": "Ruotato di 270°"
},
"GLOBAL": "Sempre visibile",
"ANGLE_FADE": "Dissolvenza angolare",
"ANGLE_FADE_HELP": "Sfumatura quando non si guarda l'HMD",
"BLOCK_INPUT": "Blocca l'input del gioco"
},
"GRAB": {
"ADJUST_DISTANCE": "Regola la distanza",
"ADJUST_SIZE": "Regola dimensione",
"UNRESTRICTED_MOVEMENT": "Movimento libero",
"GRABBING_WATCH": "Per cambiare mano, sposta il watch davanti a te e afferralo con l'altra mano.",
"GRABBING_STATIC": "Questo overlay è Statico e rimarrà in posizione, ignorando il recenter.",
"GRABBING_ANCHORED": "Gli overlay ancorati si muovono tutti insieme. Separa una singola finestra afferrandola con l'altra mano mentre tieni ancora l'ancora.",
"GRABBING_ANCHORED_EDIT": "Questo overlay rimarrà ancorato al marcatore centrale.",
"GRABBING_FLOATING": "Questo overlay è mobile e rimarrà in posizione, a meno che non venga recentrato.",
"GRABBING_FOLLOW": "Questo overlay seguirà il dispositivo a cui è collegato."
},
"TOAST": {
"DEFAULT_TITLE": "Notifica",
"ERROR": "Errore",
"CANNOT_ADD_SET": "Impossibile aggiungere il set!",
"MAXIMUM_SETS_REACHED": "Numero massimo di set raggiunto.",
"CANNOT_REMOVE_SET": "Impossibile rimuovere il set!",
"NO_SET_SELECTED": "Nessun set è selezionato.",
"LAST_EXISTING_SET": "Questo è l'ultimo set esistente.",
"EMPTY_SET": "Set vuoto!",
"LETS_ADD_OVERLAYS": "Aggiungiamo degli overlay dal Watch!",
"ONE_CONTROLLER_ON_FLOOR": "Posiziona un controller a terra!",
"FIXING_FLOOR_IN_X_SECS": "Correzione del pavimento in {SECONDS} secondo/i..."
},
"WATCH": {
"ADD_NEW_SET": "Aggiungi un nuovo set",
"CLEANUP_MIRRORS": "Rimuovi gli specchi che\nnon sono attualmente visibili",
"DASHBOARD": "Pannello di controllo",
"EDIT_MODE": "Modalità modifica",
"EDIT_MODE_EXPLANATION": "Gli overlay possono ora essere spostati e regolati individualmente.\nControlla quali overlay sono visibili in questo set:",
"FIX_FLOOR": "Fissa il livello del pavimento",
"LONG_PRESS_TO_DELETE_SET": "Tenere premuto per eliminare",
"RECENTER": "Recentra l'area di gioco",
"SWITCH_TO_SET": "Passa a set",
"TOGGLE_FOR_CURRENT_SET": "Attiva/disattiva per il set corrente"
},
"DONE": "Fatto"
}
+25 -7
View File
@@ -12,7 +12,15 @@
"RELOAD_FROM_DISK": "ディスクからXMLを再読み込み",
"CLOSE_MIRROR": "ミラーを閉じる",
"CLOSE_APP": "アプリを閉じる",
"FORCE_CLOSE_APP": "アプリを強制終了"
"FORCE_CLOSE_APP": "アプリを強制終了",
"HANDSFREE": {
"TITLE": "ハンズフリーモード",
"NONE": "オフ",
"HMD": "HMD + ピンチ",
"EYE_TRACKING": "視線 + ピンチ",
"HMD_ONLY": "HMDのみ",
"EYE_ONLY": "目のみ"
}
},
"WATCH": {
"RECENTER": "プレイスペースをリセンター",
@@ -53,7 +61,12 @@
"SPLIT_LEFT_RIGHT": "左→右",
"SPLIT_RIGHT_LEFT": "右→左",
"SPLIT_TOP_BOTTOM": "上→下",
"SPLIT_BOTTOM_TOP": "下→上"
"SPLIT_BOTTOM_TOP": "下→上",
"FULL_FRAME": "フル3D",
"FULL_FRAME_SBS": "フルSBS",
"FULL_FRAME_TAB": "フルTAB",
"FULL_FRAME_BAT": "フルBAT",
"ADJUST_MOUSE": "マウス調整"
},
"ALIGN_TO_HMD": "常にHMDの方を向く",
"MOUSE": {
@@ -67,7 +80,11 @@
"ROTATE90": "回転 90°",
"ROTATE180": "回転 180°",
"ROTATE270": "回転 270°"
}
},
"GLOBAL": "常に表示",
"ANGLE_FADE": "角度フェード",
"ANGLE_FADE_HELP": "HMDに向いていない時にフェード",
"BLOCK_INPUT": "ゲーム入力をブロック"
},
"DISABLED": "無効",
"DEFAULT": "デフォルト",
@@ -90,9 +107,10 @@
"LAST_EXISTING_SET": "これが最後の設定です。",
"EMPTY_SET": "空のセットです!",
"LETS_ADD_OVERLAYS": "ウォッチからオーバーレイを追加しましょう!",
"FIXING_FLOOR": "5秒後にフロアを固定します...",
"ONE_CONTROLLER_ON_FLOOR": "コントローラーを床に置いてください!",
"CANNOT_ADD_SET": "セットを追加できません!",
"MAXIMUM_SETS_REACHED": "最大セット数に達しました。"
}
}
"MAXIMUM_SETS_REACHED": "最大セット数に達しました。",
"FIXING_FLOOR_IN_X_SECS": "{SECONDS}秒で床を固定中..."
},
"DONE": "完了"
}
+24 -6
View File
@@ -12,7 +12,15 @@
"RELOAD_FROM_DISK": "Przeładuj XML z dysku",
"CLOSE_MIRROR": "Zamknij lustro",
"CLOSE_APP": "Zamknij aplikację",
"FORCE_CLOSE_APP": "Wymuś zamknięcie aplikacji"
"FORCE_CLOSE_APP": "Wymuś zamknięcie aplikacji",
"HANDSFREE": {
"TITLE": "Tryb wolnych rąk",
"NONE": "Wyłączone",
"HMD": "HMD + uszczypnięcie",
"EYE_TRACKING": "Oko + uszczypnięcie",
"HMD_ONLY": "Tylko HMD",
"EYE_ONLY": "Tylko oczy"
}
},
"WATCH": {
"RECENTER": "Wyśrodkuj przestrzeń gry",
@@ -39,6 +47,7 @@
"MOVE_PRESS_AND_DRAG": "Przesuń (naciśnij i przeciągnij)",
"OPACITY": "Przezroczystość",
"POSITIONING": "Pozycjonowanie",
"BLOCK_INPUT": "Blokuj input z gry",
"RESIZE_PRESS_AND_DRAG": "Zmień rozmiar (naciśnij i przeciągnij)",
"POS_STATIC": "Statyczne: Pozostaje w miejscu i nigdy nie jest ponownie wyśrodkowywane.",
"POS_ANCHORED": "Zakotwiczone: Porusza się razem z resztą zestawu. Domyślne.",
@@ -53,7 +62,12 @@
"SPLIT_LEFT_RIGHT": "LEWO→PRAWO",
"SPLIT_RIGHT_LEFT": "PRAWO→LEWO",
"SPLIT_TOP_BOTTOM": "GÓRA→DÓŁ",
"TITLE": "Tryb stereoskopowy 3D"
"TITLE": "Tryb stereoskopowy 3D",
"FULL_FRAME": "Pełny 3D",
"FULL_FRAME_SBS": "Full-SBS",
"FULL_FRAME_TAB": "Full-TAB",
"FULL_FRAME_BAT": "Full-BAT",
"ADJUST_MOUSE": "Dostosuj mysz"
},
"ALIGN_TO_HMD": "Dopasuj do HMD",
"MOUSE": {
@@ -67,7 +81,10 @@
"FLIP90": "Odwrócony o 90°",
"FLIP180": "Odwrócony o 180°",
"FLIP270": "Odwrócony o 270°"
}
},
"GLOBAL": "Zawsze widoczne",
"ANGLE_FADE": "Zanik kątowy",
"ANGLE_FADE_HELP": "Wyblaknij, gdy nie patrzysz na HMD"
},
"DISABLED": "Wyłączone",
"DEFAULT": "Domyślny",
@@ -90,9 +107,10 @@
"LAST_EXISTING_SET": "To jest ostatni istniejący zestaw.",
"EMPTY_SET": "Pusty zestaw!",
"LETS_ADD_OVERLAYS": "Dodajmy kilka nakładek z zegarka!",
"FIXING_FLOOR": "Naprawianie podłogi za 5 sekund...",
"ONE_CONTROLLER_ON_FLOOR": "Umieść jeden kontroler na podłodze!",
"CANNOT_ADD_SET": "Nie można dodać zestawu!",
"MAXIMUM_SETS_REACHED": "Osiągnięto maksymalną liczbę zestawów."
}
"MAXIMUM_SETS_REACHED": "Osiągnięto maksymalną liczbę zestawów.",
"FIXING_FLOOR_IN_X_SECS": "Naprawianie podłogi za {SECONDS} sekund(y)..."
},
"DONE": "Gotowe"
}
+116
View File
@@ -0,0 +1,116 @@
{
"ANCHOR": {
"CENTER": "中心"
},
"BAR": {
"ADD_MIRROR": "添加新的镜像覆盖层",
"EDIT_MODE_TOGGLE": "切换编辑模式",
"ADD_NEW_SET": "添加新集合",
"DELETE_CURRENT_SET": "删除当前集合",
"TOGGLE_VISIBILITY": "切换可见性",
"RESET_POSITION": "重置位置",
"RELOAD_FROM_DISK": "从磁盘重新加载 XML",
"CLOSE_MIRROR": "关闭镜像",
"CLOSE_APP": "关闭应用",
"FORCE_CLOSE_APP": "强制关闭应用",
"HANDSFREE": {
"TITLE": "免提模式",
"NONE": "关闭",
"HMD": "HMD + 捏合",
"EYE_TRACKING": "眼动 + 捏合",
"HMD_ONLY": "仅 HMD",
"EYE_ONLY": "仅限眼睛"
}
},
"DEFAULT": "默认",
"DISABLED": "已禁用",
"EDIT_MODE": {
"ADJUST_CURVATURE": "调整曲率",
"ALPHA_BLEND_MODE": "Alpha 混合模式",
"BLENDING_ADDITIVE": "叠加混合",
"CURVATURE": "曲率",
"DELETE": "长按以从当前集合中移除",
"DISABLE_GRAB": "禁用抓取",
"HINT_POINT_WINDOW": "指向窗口以更改其参数。\n完成后,使用右侧按钮退出编辑模式。",
"INTERPOLATION": "插值",
"ALIGN_TO_HMD": "对齐到头显 (HMD)",
"KEYBOARD": "键盘",
"LEAVE": "离开编辑模式",
"LOCK_INTERACTION": "锁定交互",
"MOVE_PRESS_AND_DRAG": "移动 (按住并拖拽)",
"OPACITY": "不透明度",
"POS_ANCHORED": "锚定:随中心标记移动。默认。",
"POS_FLOATING": "悬浮:独立移动,显示时重新居中。",
"POS_HAND_L": "跟随左手。",
"POS_HAND_R": "跟随右手。",
"POS_HMD": "跟随头显 (HMD)。",
"POS_STATIC": "静态:不属于任何集合,不重新居中。",
"POSITIONING": "定位",
"RESIZE_PRESS_AND_DRAG": "调整大小 (按住并拖拽)",
"STEREO_3D_MODE": {
"SPLIT_BOTTOM_TOP": "下→上",
"SPLIT_LEFT_RIGHT": "左→右",
"SPLIT_RIGHT_LEFT": "右→左",
"SPLIT_TOP_BOTTOM": "上→下",
"TITLE": "3D 立体模式",
"FULL_FRAME": "完整 3D",
"FULL_FRAME_SBS": "完整左右 (Full-SBS)",
"FULL_FRAME_TAB": "完整上下 (Full-TAB)",
"FULL_FRAME_BAT": "完整下上 (Full-BAT)",
"ADJUST_MOUSE": "调整鼠标"
},
"MOUSE": {
"TITLE": "鼠标修复",
"WRONG_SCREEN_SELECTION_HELP": "如果光标在完全不同的屏幕上移动,\n可能是屏幕选择错误。请参阅 readme。",
"NORMAL": "正常",
"ROTATE90": "旋转 90°",
"ROTATE180": "旋转 180°",
"ROTATE270": "旋转 270°",
"FLIPPED": "镜像",
"FLIP90": "镜像旋转 90°",
"FLIP180": "镜像旋转 180°",
"FLIP270": "镜像旋转 270°"
},
"GLOBAL": "始终可见",
"ANGLE_FADE": "角度淡出",
"ANGLE_FADE_HELP": "未朝向HMD时淡出",
"BLOCK_INPUT": "阻止游戏输入"
},
"GRAB": {
"ADJUST_DISTANCE": "调整距离",
"ADJUST_SIZE": "调整大小",
"UNRESTRICTED_MOVEMENT": "无限制移动",
"GRABBING_WATCH": "若要更换手,请将手表移至前方并用另一只手抓取。",
"GRABBING_STATIC": "此覆盖层是静态的,将固定在原位,忽略重新居中。",
"GRABBING_ANCHORED": "锚定覆盖层将一起移动。通过用另一只手抓取单个窗口,同时仍抓取锚点来分离它。",
"GRABBING_ANCHORED_EDIT": "此覆盖层将保持锚定在中心标记上。",
"GRABBING_FLOATING": "此覆盖层是悬浮的,将固定在原位,除非重新居中。",
"GRABBING_FOLLOW": "此覆盖层将跟随它所连接的设备。"
},
"TOAST": {
"DEFAULT_TITLE": "通知",
"ERROR": "错误",
"CANNOT_ADD_SET": "无法添加集合!",
"MAXIMUM_SETS_REACHED": "已达到集合数量上限。",
"CANNOT_REMOVE_SET": "无法移除集合!",
"NO_SET_SELECTED": "未选择集合。",
"LAST_EXISTING_SET": "这是最后一个现有的集合。",
"EMPTY_SET": "空集合!",
"LETS_ADD_OVERLAYS": "让我们从手表添加一些覆盖层吧!",
"ONE_CONTROLLER_ON_FLOOR": "请将一个控制器放在地面上!",
"FIXING_FLOOR_IN_X_SECS": "{SECONDS}秒内固定地面..."
},
"WATCH": {
"ADD_NEW_SET": "添加新集合",
"CLEANUP_MIRRORS": "移除当前不可见的镜像",
"DASHBOARD": "控制面板 (Dashboard)",
"EDIT_MODE": "编辑模式",
"EDIT_MODE_EXPLANATION": "覆盖层现在可以单独移动和调整。\n控制此集合中哪些覆盖层可见:",
"FIX_FLOOR": "修复地面水平",
"LONG_PRESS_TO_DELETE_SET": "按住以删除",
"RECENTER": "重置游玩区中心 (Recenter)",
"SWITCH_TO_SET": "切换到集合",
"TOGGLE_FOR_CURRENT_SET": "切换当前集合"
},
"DONE": "完成"
}
+101 -16
View File
@@ -13,6 +13,7 @@ use wlx_common::windowing::{OverlayWindowState, Positioning};
use crate::backend::task::{InputTask, OverlayTask};
use crate::overlays::anchor::{ANCHOR_NAME, GRAB_HELP_NAME};
use crate::overlays::keyboard::KEYBOARD_NAME;
use crate::overlays::watch::WATCH_NAME;
use crate::state::{AppSession, AppState};
use crate::subsystem::hid::WheelDelta;
@@ -209,6 +210,8 @@ pub struct InteractionState {
pub hovered_id: Option<OverlayID>,
pub next_push: Instant,
pub haptics: Option<f32>,
pub should_block_input: bool,
pub should_block_poses: bool,
}
impl Default for InteractionState {
@@ -220,6 +223,8 @@ impl Default for InteractionState {
hovered_id: None,
next_push: Instant::now(),
haptics: None,
should_block_input: false,
should_block_poses: false,
}
}
}
@@ -233,6 +238,8 @@ pub struct Pointer {
pub last_click: Instant,
pub pending_haptics: Option<Haptics>,
pub(super) interaction: InteractionState,
pub tracked: bool,
pub handsfree: bool,
}
impl Pointer {
@@ -247,6 +254,8 @@ impl Pointer {
last_click: Instant::now(),
pending_haptics: None,
interaction: InteractionState::default(),
tracked: false,
handsfree: false,
}
}
@@ -318,6 +327,47 @@ pub enum PointerMode {
Special,
}
pub struct PointerLine {
pub mode: PointerMode,
pub a: Vec3A,
pub b: Vec3A,
}
fn populate_lines(
lines: &mut Vec<PointerLine>,
pointer: &Pointer,
maybe_hit: Option<(PointerHit, RayHit)>,
hmd: &Affine3A,
) {
let Some((hit, raw_hit)) = maybe_hit else {
return;
};
if pointer.handsfree {
const HALF_SIZE: f32 = 0.01;
// horizontal arm
lines.push(PointerLine {
mode: PointerMode::Left,
a: raw_hit.global_pos - (hmd.x_axis * HALF_SIZE),
b: raw_hit.global_pos + (hmd.x_axis * HALF_SIZE),
});
// vertical arm
lines.push(PointerLine {
mode: PointerMode::Special,
a: raw_hit.global_pos - (hmd.y_axis * HALF_SIZE),
b: raw_hit.global_pos + (hmd.y_axis * HALF_SIZE),
});
} else {
lines.push(PointerLine {
mode: hit.mode,
a: pointer.pose.translation,
b: raw_hit.global_pos,
});
}
}
fn update_focus(focus: &mut KeyboardFocus, overlay_keyboard_focus: Option<KeyboardFocus>) {
if let Some(f) = &overlay_keyboard_focus
&& *focus != *f
@@ -330,11 +380,12 @@ fn update_focus(focus: &mut KeyboardFocus, overlay_keyboard_focus: Option<Keyboa
pub fn interact<O>(
overlays: &mut OverlayWindowManager<O>,
app: &mut AppState,
) -> [(f32, Option<Haptics>); 2]
lines: &mut Vec<PointerLine>,
) -> [Option<Haptics>; 2]
where
O: Default,
{
if app.input_state.pointers[1].last_click > app.input_state.pointers[0].last_click {
let hits = if app.input_state.pointers[1].last_click > app.input_state.pointers[0].last_click {
let right = interact_hand(1, overlays, app);
let left = interact_hand(0, overlays, app);
[left, right]
@@ -342,21 +393,36 @@ where
let left = interact_hand(0, overlays, app);
let right = interact_hand(1, overlays, app);
[left, right]
};
for (idx, hit) in hits.iter().enumerate() {
populate_lines(
lines,
&app.input_state.pointers[idx],
hit.0,
&app.input_state.hmd,
);
}
[hits[0].1, hits[1].1]
}
fn interact_hand<O>(
idx: usize,
overlays: &mut OverlayWindowManager<O>,
app: &mut AppState,
) -> (f32, Option<Haptics>)
) -> (Option<(PointerHit, RayHit)>, Option<Haptics>)
where
O: Default,
{
// already grabbing, ignore everything else
let mut pointer = &mut app.input_state.pointers[idx];
let pending_haptics = pointer.pending_haptics.take();
if !pointer.tracked {
return (None, pending_haptics); // no hit
}
// already grabbing, ignore everything else
if let Some(grab_data) = pointer.interaction.grabbed {
if let Some(grabbed) = overlays.mut_by_id(grab_data.grabbed_id) {
handle_grabbed(idx, grabbed, app);
@@ -364,13 +430,13 @@ where
log::warn!("Grabbed overlay {:?} does not exist", grab_data.grabbed_id);
pointer.interaction.grabbed = None;
}
return (0.1, pending_haptics);
return (None, pending_haptics);
}
let hovered_id = pointer.interaction.hovered_id.take();
let (Some(mut hit), haptics) = get_nearest_hit(idx, overlays, app) else {
let (Some((mut hit, raw_hit)), haptics) = get_nearest_hit(idx, overlays, app) else {
handle_no_hit(idx, hovered_id, overlays, app);
return (0.0, pending_haptics); // no hit
return (None, pending_haptics); // no hit
};
// focus change
@@ -394,7 +460,7 @@ where
let Some(hovered) = overlays.mut_by_id(hit.overlay) else {
log::warn!("Hit overlay {:?} does not exist", hit.overlay);
return (0.0, pending_haptics); // no hit
return (None, pending_haptics); // no hit
};
pointer = &mut app.input_state.pointers[idx];
pointer.interaction.hovered_id = Some(hit.overlay);
@@ -410,6 +476,19 @@ where
hit.primary = true;
}
if let Some(state) = hovered.config.active_state.as_ref() {
pointer.interaction.should_block_input = state.block_input
&& (hovered.config.name.as_ref() != WATCH_NAME
|| !app.session.config.block_game_input_ignore_watch);
pointer.interaction.should_block_poses = state.block_input
&& app.session.config.block_poses_on_kbd_interaction
&& hovered.config.name.as_ref() == KEYBOARD_NAME;
} else {
pointer.interaction.should_block_input = false;
pointer.interaction.should_block_poses = false;
}
#[cfg(debug_assertions)]
log::trace!("Hit: {} {:?}", hovered.config.name, hit);
@@ -432,7 +511,7 @@ where
);
log::debug!("Hand {}: grabbed {}", hit.pointer, hovered.config.name);
return (
hit.dist,
Some((hit, raw_hit)),
Some(Haptics {
intensity: 0.25,
duration: 0.1,
@@ -463,7 +542,7 @@ where
}
}
(hit.dist, haptics.or(pending_haptics))
(Some((hit, raw_hit)), haptics.or(pending_haptics))
}
fn handle_no_hit<O>(
@@ -483,9 +562,12 @@ fn handle_no_hit<O>(
}
}
let pointer = &mut app.input_state.pointers[pointer_idx];
pointer.interaction.should_block_input = false;
pointer.interaction.should_block_poses = false;
// in case click released while not aiming at anything
// send release event to overlay that was originally clicked
let pointer = &mut app.input_state.pointers[pointer_idx];
if !pointer.now.click
&& pointer.before.click
&& let Some(clicked_id) = pointer.interaction.clicked_id.take()
@@ -562,7 +644,7 @@ fn get_nearest_hit<O>(
pointer_idx: usize,
overlays: &mut OverlayWindowManager<O>,
app: &mut AppState,
) -> (Option<PointerHit>, Option<Haptics>)
) -> (Option<(PointerHit, RayHit)>, Option<Haptics>)
where
O: Default,
{
@@ -594,7 +676,7 @@ where
hits.sort_by(|a, b| a.dist.total_cmp(&b.dist));
for hit in &hits {
for hit in hits {
let overlay = overlays.mut_by_id(hit.overlay).unwrap(); // safe because we just got the id from the overlay
let Some(uv) = overlay
@@ -611,7 +693,7 @@ where
continue;
}
let hit = PointerHit {
let pointer_hit = PointerHit {
pointer: pointer_idx,
overlay: hit.overlay,
mode,
@@ -620,9 +702,9 @@ where
dist: hit.dist,
};
let result = overlay.config.backend.on_hover(app, &hit);
let result = overlay.config.backend.on_hover(app, &pointer_hit);
if result.consume || overlay.config.editing {
return (Some(hit), result.haptics);
return (Some((pointer_hit, hit)), result.haptics);
}
}
@@ -673,6 +755,7 @@ fn start_grab(
if let Some(hand) = pointer.hand()
&& !app.session.config.hide_grab_help
&& !pointer.handsfree
{
let pos = state.positioning;
app.tasks.enqueue(TaskType::Overlay(OverlayTask::Modify(
@@ -732,6 +815,7 @@ where
pointer.interaction.mode = PointerMode::Special;
let grab_dist = grab_data.offset.translation.length().clamp(0.5, 5.0) * 0.2 + 0.4;
handle_scale(&mut app.anchor, pointer.now.scroll_y * grab_dist);
handle_scale(&mut grab_data.offset, pointer.now.scroll_y * grab_dist);
} else if app.session.config.allow_sliding && pointer.now.scroll_y.is_finite() {
// single grab push/pull
let grab_dist = grab_data.offset.translation.length().clamp(0.5, 5.0);
@@ -754,6 +838,7 @@ where
&mut overlay_state.transform,
pointer.now.scroll_y * grab_dist,
);
handle_scale(&mut grab_data.offset, pointer.now.scroll_y * grab_dist);
} else if app.session.config.allow_sliding && pointer.now.scroll_y.is_finite() {
// single grab push/pull
let grab_dist = grab_data.offset.translation.length().clamp(0.5, 5.0);
+37 -11
View File
@@ -15,7 +15,6 @@ use wlx_common::config_io;
use crate::{
backend::input::{Haptics, TrackedDevice, TrackedDeviceRole},
state::AppState,
windowing::OverlayID,
};
use super::helpers::{Affine3AConvert, OVRError};
@@ -41,6 +40,7 @@ const PATH_SCROLL: &str = "/actions/default/in/Scroll";
const PATH_SHOW_HIDE: &str = "/actions/default/in/ShowHide";
const PATH_SPACE_DRAG: &str = "/actions/default/in/SpaceDrag";
const PATH_SPACE_ROTATE: &str = "/actions/default/in/SpaceRotate";
const PATH_SPACE_RESET: &str = "/actions/default/in/SpaceReset";
const PATH_TOGGLE_DASHBOARD: &str = "/actions/default/in/ToggleDashboard";
const INPUT_ANY: InputValueHandle = InputValueHandle(ovr_overlay::sys::k_ulInvalidInputValueHandle);
@@ -56,6 +56,7 @@ pub(super) struct OpenVrInputSource {
toggle_dashboard_hnd: ActionHandle,
space_drag_hnd: ActionHandle,
space_rotate_hnd: ActionHandle,
space_reset_hnd: ActionHandle,
click_modifier_right_hnd: ActionHandle,
click_modifier_middle_hnd: ActionHandle,
move_mouse_hnd: ActionHandle,
@@ -81,6 +82,7 @@ impl OpenVrInputSource {
let toggle_dashboard_hnd = input.get_action_handle(PATH_TOGGLE_DASHBOARD)?;
let space_drag_hnd = input.get_action_handle(PATH_SPACE_DRAG)?;
let space_rotate_hnd = input.get_action_handle(PATH_SPACE_ROTATE)?;
let space_reset_hnd = input.get_action_handle(PATH_SPACE_RESET)?;
let click_modifier_right_hnd = input.get_action_handle(PATH_CLICK_MODIFIER_RIGHT)?;
let click_modifier_middle_hnd = input.get_action_handle(PATH_CLICK_MODIFIER_MIDDLE)?;
let move_mouse_hnd = input.get_action_handle(PATH_MOVE_MOUSE)?;
@@ -119,6 +121,7 @@ impl OpenVrInputSource {
toggle_dashboard_hnd,
space_drag_hnd,
space_rotate_hnd,
space_reset_hnd,
click_modifier_right_hnd,
click_modifier_middle_hnd,
move_mouse_hnd,
@@ -143,26 +146,41 @@ impl OpenVrInputSource {
input: &mut InputManager,
system: &mut SystemManager,
app: &mut AppState,
watch_id: OverlayID,
) {
let should_block_input = app.input_state.pointers.iter().any(|p| {
p.interaction.hovered_id.is_some_and(|id| {
id != watch_id || !app.session.config.block_game_input_ignore_watch
})
}) && app.session.config.block_game_input;
let should_block_input_left = app.input_state.pointers[0].interaction.should_block_input
&& app.session.config.block_game_input;
let aas = ActiveActionSet(ovr_overlay::sys::VRActiveActionSet_t {
let should_block_input_right = app.input_state.pointers[1].interaction.should_block_input
&& app.session.config.block_game_input;
let aas_left = ActiveActionSet(ovr_overlay::sys::VRActiveActionSet_t {
ulActionSet: self.set_hnd.0,
ulRestrictedToDevice: 0,
ulRestrictedToDevice: self.hands[0].input_hnd.0,
ulSecondaryActionSet: 0,
unPadding: 0,
// the range between 0x01000000 and 0x01FFFFFF overrides game action sets as long as
// global input from overlays is enabled in SteamVR developer settings
// (taken from https://github.com/ValveSoftware/openvr/issues/1236)
nPriority: if should_block_input { 0x01000000 } else { 0x0 },
nPriority: if should_block_input_left {
0x01000000
} else {
0x0
},
});
let _ = input.update_actions(&mut [aas]);
let aas_right = ActiveActionSet(ovr_overlay::sys::VRActiveActionSet_t {
ulActionSet: self.set_hnd.0,
ulRestrictedToDevice: self.hands[1].input_hnd.0,
ulSecondaryActionSet: 0,
unPadding: 0,
nPriority: if should_block_input_right {
0x01000000
} else {
0x0
},
});
let _ = input.update_actions(&mut [aas_left, aas_right]);
let devices = system.get_device_to_absolute_tracking_pose(universe.clone(), 0.005);
app.input_state.hmd = devices[0].mDeviceToAbsoluteTracking.to_affine();
@@ -175,6 +193,9 @@ impl OpenVrInputSource {
app_hand.raw_pose = devices[device.0 as usize]
.mDeviceToAbsoluteTracking
.to_affine();
app_hand.tracked = devices[device.0 as usize].bPoseIsValid;
} else {
app_hand.tracked = false;
}
hand.has_pose = false;
@@ -226,6 +247,11 @@ impl OpenVrInputSource {
.map(|x| x.0.bState)
.unwrap_or(false);
app_hand.now.space_reset = input
.get_digital_action_data(self.space_reset_hnd, hand.input_hnd)
.map(|x| x.0.bState)
.unwrap_or(false);
app_hand.now.click_modifier_right = input
.get_digital_action_data(self.click_modifier_right_hnd, hand.input_hnd)
.map(|x| x.0.bState)
+33 -12
View File
@@ -3,7 +3,7 @@ use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use ash::vk::SubmitInfo;
use glam::{Affine3A, Vec3, Vec3A, Vec4};
use glam::{Affine3A, Quat, Vec3, Vec3A, Vec4};
use idmap::IdMap;
use ovr_overlay::overlay::OverlayManager;
use ovr_overlay::sys::ETrackingUniverseOrigin;
@@ -103,27 +103,43 @@ impl LinePool {
id
}
pub fn draw_from(
pub(super) fn draw_between(
&mut self,
id: usize,
mut from: Affine3A,
len: f32,
start: Vec3A,
end: Vec3A,
color: usize,
hmd: &Affine3A,
) {
let dir = end - start;
let len = dir.length();
if len < 0.01 {
return;
}
debug_assert!(color < self.colors.len());
let center = (start + end) * 0.5;
let dir_norm = dir / len;
let xform = Affine3A::from_rotation_translation(
Quat::from_rotation_arc(Vec3::Z, dir_norm.into()),
center.into(),
);
let rotation = Affine3A::from_axis_angle(Vec3::X, -PI * 0.5);
from.translation += from.transform_vector3a(Vec3A::NEG_Z) * (len * 0.5);
let mut transform = from * rotation * Affine3A::from_scale(Vec3::new(1., len / 0.002, 1.));
let to_hmd = hmd.translation - from.translation;
let mut transform = xform * rotation * Affine3A::from_scale(Vec3::new(1., len / 0.002, 1.));
let to_hmd = hmd.translation - center;
let sides = [Vec3A::Z, Vec3A::X, Vec3A::NEG_Z, Vec3A::NEG_X];
let rotations = [
Affine3A::IDENTITY,
Affine3A::from_axis_angle(Vec3::Y, PI * 0.5),
Affine3A::from_axis_angle(Vec3::Y, PI * 1.0),
Affine3A::from_axis_angle(Vec3::Y, PI * 1.5),
];
let mut closest = (0, 0.0);
for (i, &side) in sides.iter().enumerate() {
let dot = to_hmd.dot(transform.transform_vector3a(side));
@@ -134,8 +150,6 @@ impl LinePool {
transform *= rotations[closest.0];
debug_assert!(color < self.colors.len());
self.draw_transform(id, transform, self.colors[color]);
}
@@ -159,7 +173,7 @@ impl LinePool {
for data in self.lines.values_mut() {
data.after_input(overlay, app)?;
let state = data.config.active_state.as_mut().unwrap();
if state.alpha > 0.01 {
if state.alpha > 0.05 {
if data.config.dirty {
data.upload_texture(overlay, &app.gfx);
data.config.dirty = false;
@@ -177,6 +191,13 @@ impl LinePool {
data.config.dirty = true;
}
}
pub fn reset(&mut self) {
for data in self.lines.values_mut() {
let state = data.config.active_state.as_mut().unwrap();
state.alpha = 0.0;
}
}
}
struct LineBackend {
+23 -28
View File
@@ -30,10 +30,7 @@ use crate::{
},
config::{save_settings, save_state},
graphics::{GpuFutures, init_openvr_graphics},
overlays::{
toast::Toast,
watch::{WATCH_NAME, watch_fade},
},
overlays::toast::Toast,
state::AppState,
subsystem::notifications::NotificationManager,
windowing::{
@@ -134,8 +131,6 @@ pub fn openvr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
log::info!("HMD running @ {refresh_rate} Hz");
let watch_id = overlays.lookup(WATCH_NAME).unwrap(); // want panic
// want at least half refresh rate
let frame_timeout = 2 * (1000.0 / refresh_rate).floor() as u32;
@@ -144,6 +139,7 @@ pub fn openvr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
let mut lines = LinePool::new(app.gfx.clone())?;
let pointer_lines = [lines.allocate(), lines.allocate()];
let mut current_lines = Vec::with_capacity(2);
'main_loop: loop {
let _ = overlay_mgr.wait_frame_sync(frame_timeout);
@@ -230,6 +226,8 @@ pub fn openvr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
let _ = adjust_gain(&mut settings_mgr, channel, value);
}
},
#[cfg(feature = "openxr")]
TaskType::OpenXR(_) => {}
}
}
@@ -240,13 +238,7 @@ pub fn openvr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
let universe = playspace.get_universe();
app.input_state.pre_update();
input_source.update(
universe.clone(),
&mut input_mgr,
&mut system_mgr,
&mut app,
watch_id,
);
input_source.update(universe.clone(), &mut input_mgr, &mut system_mgr, &mut app);
app.input_state.post_update(&app.session);
if app
@@ -269,26 +261,27 @@ pub fn openvr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
.enqueue(TaskType::Overlay(OverlayTask::ToggleDashboard));
}
overlays
.values_mut()
.for_each(|o| o.config.auto_movement(&mut app));
overlays.values_mut().for_each(|o| o.config.tick(&mut app));
watch_fade(&mut app, overlays.mut_by_id(watch_id).unwrap()); // want panic
playspace.update(&mut chaperone_mgr, &mut overlays, &app);
let lengths_haptics = interact(&mut overlays, &mut app);
for (idx, (len, haptics)) in lengths_haptics.iter().enumerate() {
lines.draw_from(
pointer_lines[idx],
app.input_state.pointers[idx].pose,
*len,
app.input_state.pointers[idx].interaction.mode as usize + 1,
&app.input_state.hmd,
);
current_lines.clear();
let haptics = interact(&mut overlays, &mut app, &mut current_lines);
for (idx, haptics) in haptics.iter().enumerate() {
if let Some(haptics) = haptics {
input_source.haptics(&mut input_mgr, idx, haptics);
}
}
for (idx, line) in current_lines.iter().enumerate() {
lines.draw_between(
pointer_lines[idx],
line.a,
line.b,
line.mode as usize + 1,
&app.input_state.hmd,
);
}
app.hid_provider.inner.commit();
let mut futures = GpuFutures::default();
@@ -321,7 +314,7 @@ pub fn openvr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
let tgt = RenderTarget {
views: smallvec![o.ensure_staging_image(&mut app, meta.extent)?],
};
let mut rdr = RenderResources::new(app.gfx.clone(), tgt, &meta, 1.0)?;
let mut rdr = RenderResources::new(app.gfx.clone(), tgt, &meta)?;
o.render(&mut app, &mut rdr)?;
o.data.image_dirty = true;
futures.execute_results(rdr.end()?)?;
@@ -335,6 +328,8 @@ pub fn openvr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
.values_mut()
.for_each(|o| o.after_render(universe.clone(), &mut overlay_mgr, &app.gfx));
lines.reset();
// chaperone
} // main_loop
@@ -348,7 +343,7 @@ pub fn openvr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
}
log::warn!("OpenVR shutdown");
// context.shutdown() called by Drop
unsafe { context.shutdown() };
Ok(())
}
+8
View File
@@ -178,6 +178,14 @@ impl PlayspaceMover {
}
}
}
for (_, pointer) in app.input_state.pointers.iter().enumerate() {
if pointer.now.space_reset && !pointer.before.space_reset {
self.reset_offset(chaperone_mgr, &app.input_state);
log::info!("Space reset");
return;
}
}
}
pub fn reset_offset(&mut self, chaperone_mgr: &mut ChaperoneSetupManager, input: &InputState) {
+66 -45
View File
@@ -1,74 +1,95 @@
use libmonado::{ClientState, Monado};
use log::{trace, warn};
use libmonado::{BlockFlags, ClientLogic, ClientState, Monado, Version};
use log::trace;
use wgui::log::LogErr;
use crate::{state::AppState, windowing::OverlayID};
use crate::state::AppState;
pub(super) struct InputBlocker {
blocked_last_frame: bool,
use_io_blocks: bool,
inputs_blocked_last_frame: bool,
poses_blocked_last_frame: bool,
}
impl InputBlocker {
pub const fn new() -> Self {
pub fn new(monado: &Monado) -> Self {
Self {
blocked_last_frame: false,
use_io_blocks: monado.get_api_version() >= Version::new(1, 6, 0),
inputs_blocked_last_frame: false,
poses_blocked_last_frame: false,
}
}
pub fn update(&mut self, app: &mut AppState, watch_id: OverlayID) {
pub fn unblock(&self, monado: &mut Monado) {
self.block_inputs(monado, false, false);
}
pub fn update(&mut self, app: &mut AppState) {
let Some(monado) = &mut app.monado else {
return; // monado not available
};
let should_block = app.input_state.pointers.iter().any(|p| {
p.interaction.hovered_id.is_some_and(|id| {
id != watch_id || !app.session.config.block_game_input_ignore_watch
})
}) && app.session.config.block_game_input;
let should_block_inputs = app
.input_state
.pointers
.iter()
.any(|p| p.interaction.should_block_input)
&& app.session.config.block_game_input;
match (should_block, self.blocked_last_frame) {
(true, false) => {
let should_block_poses = app
.input_state
.pointers
.iter()
.any(|p| p.interaction.should_block_poses)
&& app.session.config.block_poses_on_kbd_interaction;
if should_block_inputs != self.inputs_blocked_last_frame
|| should_block_poses != self.poses_blocked_last_frame
{
if should_block_inputs {
trace!("Blocking input");
set_clients_io_active(monado, false);
}
(false, true) => {
} else {
trace!("Unblocking input");
set_clients_io_active(monado, true);
}
_ => {}
self.block_inputs(monado, should_block_inputs, should_block_poses);
}
self.blocked_last_frame = should_block;
self.inputs_blocked_last_frame = should_block_inputs;
self.poses_blocked_last_frame = should_block_poses;
}
}
fn set_clients_io_active(monado: &mut Monado, active: bool) {
match monado.clients() {
Ok(clients) => {
for mut client in clients {
let name = match client.name() {
Ok(n) => n,
Err(e) => {
warn!("Failed to get client name: {e}");
continue;
}
};
fn block_inputs(&self, monado: &mut Monado, block_inputs: bool, block_poses: bool) {
let Ok(clients) = monado
.clients()
.log_warn("Failed to get clients from Monado")
else {
return;
};
for mut client in clients {
let Ok(name) = client.name().log_warn("Failed to get client name") else {
continue;
};
if name == "wayvr" {
continue;
}
let state = match client.state() {
Ok(s) => s,
Err(e) => {
warn!("Failed to get client state: {e}");
continue;
}
};
let Ok(state) = client.state().log_warn("Failed to get client state") else {
continue;
};
if name != "wayvr"
&& state.contains(ClientState::ClientSessionVisible)
&& let Err(e) = client.set_io_active(active)
{
warn!("Failed to set io active for client: {e}");
if state.contains(ClientState::ClientSessionActive | ClientState::ClientSessionVisible)
{
let _ = if self.use_io_blocks {
let flags = match (block_inputs, block_poses) {
(true, true) => BlockFlags::BlockPoses | BlockFlags::BlockInputs,
(true, false) => BlockFlags::BlockInputs.into(),
(false, _) => BlockFlags::None.into(),
};
client.set_io_blocks(flags)
} else {
client.set_io_active(!block_inputs)
}
.log_warn("Failed to set IO active for client");
}
}
Err(e) => warn!("Failed to get clients from Monado: {e}"),
}
}
+22
View File
@@ -3,6 +3,18 @@ use glam::{Affine3A, Quat, Vec3, Vec3A};
use openxr::{self as xr, SessionCreateFlags, Version, sys::Handle};
use xr::OverlaySessionCreateFlagsEXTX;
macro_rules! next_chain_insert {
($layer:expr, $payload:expr) => {{
let payload_ptr = $payload.as_mut() as *mut _ as *mut xr::sys::BaseInStructure;
let new_elem = payload_ptr.as_mut().unwrap();
let mut raw = $layer.into_raw();
new_elem.next = raw.next as _;
raw.next = payload_ptr as *const _;
raw
}};
}
pub(crate) use next_chain_insert;
pub(super) fn init_xr() -> Result<(xr::Instance, xr::SystemId), anyhow::Error> {
let entry = xr::Entry::linked();
@@ -37,6 +49,11 @@ pub(super) fn init_xr() -> Result<(xr::Instance, xr::SystemId), anyhow::Error> {
} else {
log::warn!("Missing EXT_hand_interaction extension.");
}
if available_extensions.ext_eye_gaze_interaction {
enabled_extensions.ext_eye_gaze_interaction = true;
} else {
log::warn!("Missing EXT_eye_gaze_interaction extension.");
}
if available_extensions.khr_composition_layer_cylinder {
enabled_extensions.khr_composition_layer_cylinder = true;
} else {
@@ -47,6 +64,11 @@ pub(super) fn init_xr() -> Result<(xr::Instance, xr::SystemId), anyhow::Error> {
} else {
log::warn!("Missing EXT_composition_layer_equirect2 extension.");
}
if available_extensions.khr_composition_layer_color_scale_bias {
enabled_extensions.khr_composition_layer_color_scale_bias = true;
} else {
log::warn!("Missing XR_KHR_composition_layer_color_scale_bias extension.");
}
let xr_mndx_system_buttons = "XR_MNDX_system_buttons".as_bytes().to_vec();
if available_extensions.other.contains(&xr_mndx_system_buttons) {
+131 -26
View File
@@ -5,10 +5,10 @@ use std::{
};
use glam::{Affine3A, Quat, Vec3, bool};
use libmonado as mnd;
use libmonado::{self as mnd, DeviceLogic};
use openxr::{self as xr, Quaternionf, Vector2f, Vector3f};
use serde::{Deserialize, Serialize};
use wlx_common::config_io;
use wlx_common::{config::HandsfreePointer, config_io};
use crate::{
backend::input::{Haptics, InputState, Pointer, TrackedDevice, TrackedDeviceRole},
@@ -25,10 +25,11 @@ static CLICK_TIMES: [Duration; 3] = [
pub(super) struct OpenXrInputSource {
action_set: xr::ActionSet,
hands: [OpenXrHand; 2],
pointers: [OpenXrPointer; 2],
handsfree_pointer: OpenXrPointer,
}
pub(super) struct OpenXrHand {
pub(super) struct OpenXrPointer {
source: OpenXrHandSource,
space: xr::Space,
}
@@ -65,7 +66,7 @@ impl<const COUNT: usize> MultiClickHandler<COUNT> {
if !state {
let res = self.action_f32.state(session, xr::Path::NULL)?;
state = res.is_active && res.current_state > threshold;
state = res.is_active && res.current_state >= threshold - 0.001;
}
if !state {
@@ -170,22 +171,27 @@ impl OpenXrInputSource {
let left_source = OpenXrHandSource::new(&mut action_set, "left")?;
let right_source = OpenXrHandSource::new(&mut action_set, "right")?;
let fallback_source = OpenXrHandSource::new(&mut action_set, "handsfree")?;
suggest_bindings(&xr.instance, &[&left_source, &right_source]);
suggest_bindings(
&xr.instance,
&[&left_source, &right_source, &fallback_source],
);
xr.session.attach_action_sets(&[&action_set])?;
Ok(Self {
action_set,
hands: [
OpenXrHand::new(xr, left_source)?,
OpenXrHand::new(xr, right_source)?,
pointers: [
OpenXrPointer::new(xr, left_source)?,
OpenXrPointer::new(xr, right_source)?,
],
handsfree_pointer: OpenXrPointer::new(xr, fallback_source)?,
})
}
pub fn haptics(&self, xr: &XrState, hand: usize, haptics: &Haptics) {
let action = &self.hands[hand].source.haptics;
let action = &self.pointers[hand].source.haptics;
let duration_nanos = f64::from(haptics.duration) * 1_000_000_000.0;
@@ -204,11 +210,14 @@ impl OpenXrInputSource {
let loc = xr.view.locate(&xr.stage, xr.predicted_display_time)?;
let hmd = posef_to_transform(&loc.pose);
let mut hmd_tracked = true;
if loc
.location_flags
.contains(xr::SpaceLocationFlags::ORIENTATION_VALID)
{
state.input_state.hmd.matrix3 = hmd.matrix3;
} else {
hmd_tracked = false;
}
if loc
@@ -216,11 +225,26 @@ impl OpenXrInputSource {
.contains(xr::SpaceLocationFlags::POSITION_VALID)
{
state.input_state.hmd.translation = hmd.translation;
} else {
hmd_tracked = false;
}
let mut any_tracked = false;
for i in 0..2 {
self.hands[i].update(&mut state.input_state.pointers[i], xr, &state.session)?;
let pointer = &mut state.input_state.pointers[i];
self.pointers[i].update(pointer, xr, &state.session)?;
any_tracked |= pointer.tracked;
}
if !any_tracked {
self.handsfree_pointer.update_handsfree(
&mut state.input_state.pointers[0],
xr,
&state.session,
hmd,
hmd_tracked,
)?;
}
Ok(())
}
@@ -305,7 +329,7 @@ impl OpenXrInputSource {
}
}
impl OpenXrHand {
impl OpenXrPointer {
pub(super) fn new(xr: &XrState, source: OpenXrHandSource) -> Result<Self, xr::sys::Result> {
let space = source
.pose
@@ -314,11 +338,70 @@ impl OpenXrHand {
Ok(Self { source, space })
}
pub(super) fn update_handsfree(
&mut self,
pointer: &mut Pointer,
xr: &XrState,
session: &AppSession,
hmd: Affine3A,
hmd_tracked: bool,
) -> anyhow::Result<()> {
match session.config.handsfree_pointer {
HandsfreePointer::None => return Ok(()),
HandsfreePointer::Hmd | HandsfreePointer::HmdOnly => {
pointer.tracked = hmd_tracked;
pointer.raw_pose = hmd;
pointer.pose = hmd;
let (cur_quat, cur_pos) =
(Quat::from_affine3(&pointer.pose), pointer.pose.translation);
let (new_quat, new_pos) = (Quat::from_affine3(&hmd), Vec3::from(hmd.translation));
let lerp_factor =
(1.0 / (xr.fps / 100.0) * session.config.pointer_lerp_factor).clamp(0.1, 1.0);
pointer.raw_pose = Affine3A::from_rotation_translation(new_quat, new_pos);
pointer.pose = Affine3A::from_rotation_translation(
cur_quat.lerp(new_quat, lerp_factor),
cur_pos.lerp(new_pos.into(), lerp_factor).into(),
);
}
HandsfreePointer::EyeTracking | HandsfreePointer::EyeTrackingOnly => {
// more aggressive smoothing for eye
self.pointer_load_pose(pointer, xr, session.config.pointer_lerp_factor * 0.5)?;
}
}
pointer.handsfree = pointer.tracked;
if matches!(
session.config.handsfree_pointer,
HandsfreePointer::HmdOnly | HandsfreePointer::EyeTrackingOnly
) {
// skip actions
return Ok(());
}
self.pointer_load_actions(pointer, xr, session)?;
Ok(())
}
pub(super) fn update(
&mut self,
pointer: &mut Pointer,
xr: &XrState,
session: &AppSession,
) -> anyhow::Result<()> {
pointer.handsfree = false;
self.pointer_load_pose(pointer, xr, session.config.pointer_lerp_factor)?;
self.pointer_load_actions(pointer, xr, session)?;
Ok(())
}
fn pointer_load_pose(
&mut self,
pointer: &mut Pointer,
xr: &XrState,
lerp_factor: f32,
) -> anyhow::Result<()> {
let location = self.space.locate(&xr.stage, xr.predicted_display_time)?;
if location
@@ -333,15 +416,25 @@ impl OpenXrHand {
transmute::<Vector3f, Vec3>(location.pose.position),
)
};
let lerp_factor =
(1.0 / (xr.fps / 100.0) * session.config.pointer_lerp_factor).clamp(0.1, 1.0);
let lerp_factor = (1.0 / (xr.fps / 100.0) * lerp_factor).clamp(0.1, 1.0);
pointer.raw_pose = Affine3A::from_rotation_translation(new_quat, new_pos);
pointer.pose = Affine3A::from_rotation_translation(
cur_quat.lerp(new_quat, lerp_factor),
cur_pos.lerp(new_pos.into(), lerp_factor).into(),
);
pointer.tracked = true;
} else {
pointer.tracked = false;
}
Ok(())
}
fn pointer_load_actions(
&mut self,
pointer: &mut Pointer,
xr: &XrState,
session: &AppSession,
) -> anyhow::Result<()> {
pointer.now.click = self.source.click.state(pointer.before.click, xr, session)?;
pointer.now.grab = self.source.grab.state(pointer.before.grab, xr, session)?;
@@ -464,11 +557,12 @@ fn is_bool(path_str: &str) -> bool {
macro_rules! add_custom {
($action:expr, $field:ident, $hands:expr, $bindings:expr, $instance:expr) => {
if let Some(action) = $action.as_ref() {
for i in 0..2 {
let spec = if i == 0 {
action.left.as_ref()
} else {
action.right.as_ref()
for i in 0..3 {
let spec = match i {
0 => action.left.as_ref(),
1 => action.right.as_ref(),
2 => action.handsfree.as_ref(),
_ => unreachable!(),
};
if let Some(spec) = spec {
@@ -526,11 +620,12 @@ macro_rules! add_custom {
macro_rules! add_custom_lr {
($action:expr, $field:ident, $hands:expr, $bindings:expr, $instance:expr) => {
if let Some(action) = $action {
for i in 0..2 {
let spec = if i == 0 {
action.left.as_ref()
} else {
action.right.as_ref()
for i in 0..3 {
let spec = match i {
0 => action.left.as_ref(),
1 => action.right.as_ref(),
2 => action.handsfree.as_ref(),
_ => unreachable!(),
};
if let Some(spec) = spec {
@@ -551,12 +646,14 @@ macro_rules! add_custom_lr {
}
#[allow(clippy::too_many_lines, clippy::cognitive_complexity)]
fn suggest_bindings(instance: &xr::Instance, hands: &[&OpenXrHandSource; 2]) {
fn suggest_bindings(instance: &xr::Instance, hands: &[&OpenXrHandSource; 3]) {
let profiles = load_action_profiles();
for profile in profiles {
log::warn!("Loading profile {}", &profile.profile);
let Ok(profile_path) = instance.string_to_path(&profile.profile) else {
log::debug!("Profile not supported: {}", profile.profile);
log::warn!("Profile not supported: {}", profile.profile);
continue;
};
@@ -618,6 +715,11 @@ fn suggest_bindings(instance: &xr::Instance, hands: &[&OpenXrHandSource; 2]) {
{
log::error!("Bad bindings for {}", &profile.profile[22..]);
log::error!("Verify config: ~/.config/wayvr/openxr_actions.json5");
} else {
log::debug!(
"Bindings for {} bound successfully.",
&profile.profile[22..]
)
}
}
}
@@ -633,6 +735,7 @@ enum OneOrMany<T> {
struct OpenXrActionConfAction {
left: Option<OneOrMany<String>>,
right: Option<OneOrMany<String>>,
handsfree: Option<OneOrMany<String>>,
threshold: Option<[f32; 2]>,
double_click: Option<bool>,
triple_click: Option<bool>,
@@ -672,6 +775,8 @@ fn load_action_profiles() -> Vec<OpenXrActionConfProfile> {
for new in override_profiles {
if let Some(i) = profiles.iter().position(|old| old.profile == new.profile) {
profiles[i] = new;
} else {
profiles.push(new);
}
}
}
+20 -10
View File
@@ -1,4 +1,4 @@
use glam::{Affine3A, Vec3, Vec3A};
use glam::{Affine3A, Quat, Vec3, Vec3A};
use idmap::IdMap;
use openxr as xr;
use smallvec::SmallVec;
@@ -96,14 +96,17 @@ impl LinePool {
Ok(id)
}
pub(super) fn draw_from(
pub(super) fn draw_between(
&mut self,
id: usize,
mut from: Affine3A,
len: f32,
start: Vec3A,
end: Vec3A,
color: usize,
hmd: &Affine3A,
hmd: Affine3A,
) {
let dir = end - start;
let len = dir.length();
if len < 0.01 {
return;
}
@@ -115,13 +118,19 @@ impl LinePool {
return;
};
let center = (start + end) * 0.5;
let dir_norm = dir / len;
let xform = Affine3A::from_rotation_translation(
Quat::from_rotation_arc(Vec3::Z, dir_norm.into()),
center.into(),
);
let rotation = Affine3A::from_axis_angle(Vec3::X, PI * 1.5);
from.translation += from.transform_vector3a(Vec3A::NEG_Z) * (len * 0.5);
let mut transform = from * rotation;
let to_hmd = hmd.translation - from.translation;
let mut transform = xform * rotation;
let to_hmd = hmd.translation - center;
let sides = [Vec3A::Z, Vec3A::X, Vec3A::NEG_Z, Vec3A::NEG_X];
#[allow(clippy::neg_multiply)]
let rotations = [
Affine3A::IDENTITY,
@@ -129,6 +138,7 @@ impl LinePool {
Affine3A::from_axis_angle(Vec3::Y, PI * -1.0),
Affine3A::from_axis_angle(Vec3::Y, PI * 1.5),
];
let mut closest = (0, 0.0);
for (i, &side) in sides.iter().enumerate() {
let dot = to_hmd.dot(transform.transform_vector3a(side));
+99 -56
View File
@@ -8,7 +8,7 @@ use std::{
use glam::{Affine3A, Vec3};
use input::OpenXrInputSource;
use openxr as xr;
use skybox::create_skybox;
use skybox::{Skybox, create_skybox};
use vulkano::{Handle, VulkanObject};
use wlx_common::overlays::{StereoMode, ToastTopic};
@@ -18,14 +18,11 @@ use crate::{
BackendError, XrBackend,
input::interact,
openxr::{lines::LinePool, overlay::OpenXrOverlayData},
task::{OverlayTask, TaskType},
task::{OpenXrTask, OverlayTask, TaskType},
},
config::{save_settings, save_state},
graphics::{GpuFutures, init_openxr_graphics},
overlays::{
toast::Toast,
watch::{WATCH_NAME, watch_fade},
},
overlays::{toast::Toast, watch::WATCH_NAME},
state::AppState,
subsystem::notifications::NotificationManager,
windowing::{
@@ -69,17 +66,7 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
AppState::from_graphics(gfx, gfx_extras, XrBackend::OpenXR)?
};
let environment_blend_mode = {
let modes = xr_instance.enumerate_environment_blend_modes(system, VIEW_TYPE)?;
if modes.contains(&xr::EnvironmentBlendMode::ALPHA_BLEND)
&& app.session.config.use_passthrough
{
xr::EnvironmentBlendMode::ALPHA_BLEND
} else {
modes[0]
}
};
log::info!("Using environment blend mode: {environment_blend_mode:?}");
let modes = xr_instance.enumerate_environment_blend_modes(system, VIEW_TYPE)?;
if show_by_default {
app.tasks.enqueue_at(
@@ -90,6 +77,7 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
let mut overlays = OverlayWindowManager::<OpenXrOverlayData>::new(&mut app, headless)?;
let mut lines = LinePool::new(&app)?;
let mut current_lines = Vec::with_capacity(2);
let mut notifications = NotificationManager::new();
notifications.run_dbus(&mut app.dbus);
@@ -105,7 +93,7 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
.ok()
});
let mut blocker = app.monado.is_some().then(blocker::InputBlocker::new);
let mut blocker = app.monado.as_ref().map(blocker::InputBlocker::new);
let (session, mut frame_wait, mut frame_stream) = unsafe {
let raw_session = helpers::create_overlay_session(
@@ -136,11 +124,7 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
view: Arc::new(view),
};
let mut skybox = if environment_blend_mode == xr::EnvironmentBlendMode::OPAQUE {
create_skybox(&xr_state, &app)
} else {
None
};
let mut skybox: Option<Skybox> = None;
let pointer_lines = [
lines.allocate(&xr_state, &app)?,
@@ -160,6 +144,7 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
let mut fps_counter: VecDeque<Instant> = VecDeque::new();
let mut main_session_visible = false;
let mut environment_blend_mode = modes[0];
'main_loop: loop {
let cur_frame = FRAME_COUNTER.fetch_add(1, Ordering::Relaxed);
@@ -186,6 +171,14 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
xr::SessionState::READY => {
xr_state.session.begin(VIEW_TYPE)?;
session_running = true;
reconfigure_environment_blend(
&app,
&xr_state,
&modes,
&mut skybox,
&mut environment_blend_mode,
main_session_visible,
);
}
xr::SessionState::STOPPING => {
xr_state.session.end()?;
@@ -204,17 +197,15 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
log::warn!("lost {} events", e.lost_event_count());
}
xr::Event::MainSessionVisibilityChangedEXTX(e) => {
if main_session_visible != e.visible() {
main_session_visible = e.visible();
log::info!("Main session visible: {main_session_visible}");
if main_session_visible {
log::debug!("Destroying skybox.");
skybox = None;
} else if environment_blend_mode == xr::EnvironmentBlendMode::OPAQUE {
log::debug!("Allocating skybox.");
skybox = create_skybox(&xr_state, &app);
}
}
main_session_visible = e.visible();
reconfigure_environment_blend(
&app,
&xr_state,
&modes,
&mut skybox,
&mut environment_blend_mode,
main_session_visible,
);
}
_ => {}
}
@@ -273,7 +264,7 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
app.input_state.post_update(&app.session);
if let Some(ref mut blocker) = blocker {
blocker.update(&mut app, watch_id);
blocker.update(&mut app);
}
if app
@@ -295,7 +286,6 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
.enqueue(TaskType::Overlay(OverlayTask::ToggleDashboard));
}
watch_fade(&mut app, overlays.mut_by_id(watch_id).unwrap()); // want panic
if let Some(ref mut space_mover) = playspace {
space_mover.update(&mut overlays, &mut app);
}
@@ -323,23 +313,25 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
.submit(&mut app);
}
overlays
.values_mut()
.for_each(|o| o.config.auto_movement(&mut app));
overlays.values_mut().for_each(|o| o.config.tick(&mut app));
let lengths_haptics = interact(&mut overlays, &mut app);
for (idx, (len, haptics)) in lengths_haptics.iter().enumerate() {
lines.draw_from(
pointer_lines[idx],
app.input_state.pointers[idx].pose,
*len,
app.input_state.pointers[idx].interaction.mode as usize + 1,
&app.input_state.hmd,
);
current_lines.clear();
let haptics = interact(&mut overlays, &mut app, &mut current_lines);
for (idx, haptics) in haptics.iter().enumerate() {
if let Some(haptics) = haptics {
input_source.haptics(&xr_state, idx, haptics);
}
}
for (idx, line) in current_lines.iter().enumerate() {
lines.draw_between(
pointer_lines[idx],
line.a,
line.b,
line.mode as usize + 1,
app.input_state.hmd,
);
}
app.hid_provider.inner.commit();
@@ -353,6 +345,7 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
y: 0.001,
z: 0.001,
});
watch_state.alpha = 0.02; // visible but not really. Monado freaks out if no layers are submitted.
}
if let Err(e) =
@@ -370,7 +363,11 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
for o in overlays.values_mut() {
o.data.cur_visible = false;
let Some(alpha) = o.config.active_state.as_ref().map(|x| x.alpha) else {
if o.config
.active_state
.as_ref()
.is_none_or(|s| s.alpha < 0.01)
{
log::trace!("{}: hidden, skip render", o.config.name);
continue;
};
@@ -381,11 +378,7 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
o.data.init = true;
}
let should_render = match o.should_render(&mut app)? {
ShouldRender::Should => true,
ShouldRender::Can => (o.data.last_alpha - alpha).abs() > f32::EPSILON,
ShouldRender::Unable => false, //try show old image if exists
};
let should_render = matches!(o.should_render(&mut app)?, ShouldRender::Should);
log::trace!("{}: should_render returned: {should_render}", o.config.name);
if should_render {
@@ -394,9 +387,8 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
let stereo = !matches!(meta.stereo, StereoMode::None);
let wsi = o.ensure_swapchain_acquire(&app, &xr_state, meta.extent, stereo)?;
let tgt = RenderTarget { views: wsi.views };
let mut rdr = RenderResources::new(app.gfx.clone(), tgt, &meta, alpha)?;
let mut rdr = RenderResources::new(app.gfx.clone(), tgt, &meta)?;
o.render(&mut app, &mut rdr)?;
o.data.last_alpha = alpha;
futures.execute_results(rdr.end()?)?;
} else if o.data.swapchain.is_none() {
log::trace!("{}: not showing due to missing swapchain", o.config.name);
@@ -479,6 +471,18 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
playspace.handle_task(&mut app, task);
}
}
TaskType::OpenXR(task) => {
if matches!(task, OpenXrTask::SettingsChanged) {
reconfigure_environment_blend(
&app,
&xr_state,
&modes,
&mut skybox,
&mut environment_blend_mode,
main_session_visible,
);
}
}
#[cfg(feature = "openvr")]
TaskType::OpenVR(_) => {}
}
@@ -495,6 +499,10 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
watch.config.active_state.as_mut().unwrap().transform = watch_transform;
} // main_loop
if let (Some(blocker), Some(monado)) = (blocker, app.monado.as_mut()) {
blocker.unblock(monado);
}
overlays.persist_layout(&mut app);
if let Err(e) = save_state(&app.session.config) {
log::error!("Could not save state: {e:?}");
@@ -512,3 +520,38 @@ pub(super) enum CompositionLayer<'a> {
Cylinder(xr::CompositionLayerCylinderKHR<'a, xr::Vulkan>),
Equirect2(xr::CompositionLayerEquirect2KHR<'a, xr::Vulkan>),
}
fn reconfigure_environment_blend(
app: &AppState,
xr_state: &XrState,
modes: &[xr::EnvironmentBlendMode],
skybox: &mut Option<Skybox>,
environment_blend_mode: &mut xr::EnvironmentBlendMode,
main_session_visible: bool,
) {
*environment_blend_mode = {
if modes.contains(&xr::EnvironmentBlendMode::ALPHA_BLEND)
&& app.session.config.use_passthrough
{
xr::EnvironmentBlendMode::ALPHA_BLEND
} else {
modes[0]
}
};
let want_skybox = *environment_blend_mode == xr::EnvironmentBlendMode::OPAQUE
&& app.session.config.use_skybox
&& !main_session_visible;
if want_skybox == skybox.is_some() {
return;
}
if want_skybox {
log::debug!("Allocating skybox.");
*skybox = create_skybox(xr_state, app);
} else {
log::debug!("Destroying skybox.");
*skybox = None;
}
}
+41 -37
View File
@@ -34,47 +34,48 @@
// do not mess with these, unless you know what you're doing
[
// Hand tracking
// {
// profile: "/interaction_profiles/ext/hand_interaction_ext",
// pose: {
// left: "/user/hand/left/input/aim/pose",
// right: "/user/hand/right/input/aim/pose"
// },
// click: {
// left: "/user/hand/left/input/pinch_ext/value",
// right: "/user/hand/right/input/pinch_ext/value"
// },
// grab: {
// left: "/user/hand/left/input/grasp_ext/value",
// right: "/user/hand/right/input/grasp_ext/value"
// },
// },
// Fallback controller, intended for testing
// Eye+hand interaction
// eye is aim, left pinch is grab, right pinch is click
{
profile: "/interaction_profiles/khr/simple_controller",
profile: "/interaction_profiles/ext/eye_gaze_interaction",
pose: {
left: "/user/hand/left/input/aim/pose",
right: "/user/hand/right/input/aim/pose"
},
haptic: {
left: "/user/hand/left/output/haptic",
right: "/user/hand/right/output/haptic"
handsfree: "/user/eyes_ext/input/gaze_ext/pose",
},
},
{
profile: "/interaction_profiles/ext/hand_interaction_ext",
click: {
// right trigger is click
right: "/user/hand/right/input/select/click"
handsfree: "/user/hand/right/input/pinch_ext/value"
},
grab: {
// left trigger is grab
left: "/user/hand/left/input/select/click",
handsfree: "/user/hand/left/input/pinch_ext/value",
},
show_hide: {
left: "/user/hand/left/input/menu/click"
}
},
// Fallback controller, intended for testing
//{
// profile: "/interaction_profiles/khr/simple_controller",
// pose: {
// left: "/user/hand/left/input/aim/pose",
// right: "/user/hand/right/input/aim/pose"
// },
// haptic: {
// left: "/user/hand/left/output/haptic",
// right: "/user/hand/right/output/haptic"
// },
// click: {
// right trigger is click
// right: "/user/hand/right/input/select/click"
// },
// grab: {
// left trigger is grab
// left: "/user/hand/left/input/select/click",
// },
// show_hide: {
// left: "/user/hand/left/input/menu/click"
// }
//},
// Oculus Touch Controller. Compatible with Quest 2, Quest 3, Quest Pro
{
profile: "/interaction_profiles/oculus/touch_controller",
@@ -213,8 +214,11 @@
left: "/user/hand/left/input/trackpad/x",
right: "/user/hand/right/input/trackpad/x"
},
toggle_dashboard: {
right: "/user/hand/right/input/system/click",
},
show_hide: {
left: "/user/hand/left/input/menu/click",
left: "/user/hand/left/input/system/click",
},
space_drag: {
right: "/user/hand/right/input/menu/click",
@@ -257,11 +261,11 @@
right: "/user/hand/right/input/thumbstick/x"
},
show_hide: {
left: "/user/hand/left/input/menu/click",
left: "/user/hand/left/input/system/click",
},
space_drag: {
double_click: true,
right: "/user/hand/left/input/menu/click",
right: "/user/hand/left/input/system/click",
},
click_modifier_right: {
left: "/user/hand/left/input/trackpad/dpad_up",
@@ -301,11 +305,11 @@
right: "/user/hand/right/input/thumbstick/x"
},
show_hide: {
left: "/user/hand/left/input/menu/click",
left: "/user/hand/left/input/system/click",
},
space_drag: {
double_click: true,
right: "/user/hand/left/input/menu/click",
right: "/user/hand/left/input/system/click",
},
},
+62 -7
View File
@@ -6,7 +6,10 @@ use xr::EyeVisibility;
use super::{CompositionLayer, XrState, helpers, swapchain::WlxSwapchain};
use crate::{
backend::openxr::swapchain::{SwapchainOpts, WlxSwapchainImage, create_swapchain},
backend::openxr::{
helpers::next_chain_insert,
swapchain::{SwapchainOpts, WlxSwapchainImage, create_swapchain},
},
state::AppState,
windowing::window::OverlayWindowData,
};
@@ -17,7 +20,7 @@ pub struct OpenXrOverlayData {
pub(super) swapchain: Option<WlxSwapchain>,
pub(super) init: bool,
pub(super) cur_visible: bool,
pub(super) last_alpha: f32,
color_bias_khr: Option<Box<xr::sys::CompositionLayerColorScaleBiasKHR>>,
}
impl OverlayWindowData<OpenXrOverlayData> {
@@ -86,13 +89,13 @@ impl OverlayWindowData<OpenXrOverlayData> {
let transform = state.transform * self.config.backend.frame_meta().unwrap().transform; // contract
let aspect_ratio = swapchain.extent[1] as f32 / swapchain.extent[0] as f32;
let aspect_ratio = swapchain.extent[0] as f32 / swapchain.extent[1] as f32;
let (scale_x, scale_y) = if aspect_ratio < 1.0 {
let major = transform.matrix3.col(0).length();
(major, major * aspect_ratio)
(major * aspect_ratio, major)
} else {
let major = transform.matrix3.col(1).length();
(major / aspect_ratio, major)
(major, major / aspect_ratio)
};
let flags = if state.additive {
@@ -110,8 +113,10 @@ impl OverlayWindowData<OpenXrOverlayData> {
let posef = helpers::translation_rotation_to_posef(center_point, quat);
let angle = 2.0 * (scale_x / (2.0 * radius));
try_update_color_scale_bias(xr, &mut self.data.color_bias_khr, state.alpha);
for sub_image in sub_images {
let cylinder = xr::CompositionLayerCylinderKHR::new()
let mut cylinder = xr::CompositionLayerCylinderKHR::new()
.layer_flags(flags)
.pose(posef)
.sub_image(sub_image.0)
@@ -120,12 +125,22 @@ impl OverlayWindowData<OpenXrOverlayData> {
.radius(radius)
.central_angle(angle)
.aspect_ratio(aspect_ratio);
if let Some(color_bias_khr) = self.data.color_bias_khr.as_mut() {
unsafe {
let raw = next_chain_insert!(cylinder, color_bias_khr);
cylinder = xr::CompositionLayerCylinderKHR::from_raw(raw);
}
}
layers.push(CompositionLayer::Cylinder(cylinder));
}
} else {
let posef = helpers::transform_to_posef(&transform);
try_update_color_scale_bias(xr, &mut self.data.color_bias_khr, state.alpha);
for sub_image in sub_images {
let quad = xr::CompositionLayerQuad::new()
let mut quad = xr::CompositionLayerQuad::new()
.layer_flags(flags)
.pose(posef)
.sub_image(sub_image.0)
@@ -135,6 +150,14 @@ impl OverlayWindowData<OpenXrOverlayData> {
width: scale_x,
height: scale_y,
});
if let Some(color_bias_khr) = self.data.color_bias_khr.as_mut() {
unsafe {
let raw = next_chain_insert!(quad, color_bias_khr);
quad = xr::CompositionLayerQuad::from_raw(raw);
}
}
layers.push(CompositionLayer::Quad(quad));
}
}
@@ -159,3 +182,35 @@ impl OverlayWindowData<OpenXrOverlayData> {
Ok(())
}
}
fn try_update_color_scale_bias(
xr_state: &XrState,
color_bias_khr: &mut Option<Box<xr::sys::CompositionLayerColorScaleBiasKHR>>,
alpha: f32,
) {
if let Some(item) = color_bias_khr.as_mut() {
item.color_scale.a = alpha;
return;
}
if xr_state
.instance
.exts()
.khr_composition_layer_color_scale_bias
.is_none()
{
return;
}
let new_item = Box::new(xr::sys::CompositionLayerColorScaleBiasKHR {
ty: xr::StructureType::COMPOSITION_LAYER_COLOR_SCALE_BIAS_KHR,
next: std::ptr::null(),
color_bias: Default::default(),
color_scale: xr::Color4f {
r: 1.0,
g: 1.0,
b: 1.0,
a: alpha,
},
});
*color_bias_khr = Some(new_item);
}
+44 -18
View File
@@ -1,8 +1,4 @@
use std::{
f32::consts::PI,
fs::File,
sync::{Arc, LazyLock},
};
use std::{f32::consts::PI, fs::File, sync::Arc};
use glam::{Quat, Vec3A};
use openxr as xr;
@@ -14,7 +10,10 @@ use wgui::gfx::{cmd::WGfxClearMode, pipeline::WPipelineCreateInfo};
use wlx_common::config_io;
use crate::{
backend::openxr::{helpers::translation_rotation_to_posef, swapchain::SwapchainOpts},
backend::openxr::{
helpers::{next_chain_insert, translation_rotation_to_posef},
swapchain::SwapchainOpts,
},
graphics::{ExtentExt, GpuFutures, dds::WlxCommandBufferDds},
state::AppState,
};
@@ -28,10 +27,12 @@ pub(super) struct Skybox {
view: Arc<ImageView>,
sky: Option<WlxSwapchain>,
grid: Option<WlxSwapchain>,
grid_pose: xr::Posef,
grid_color_scale_bias_khr: Option<Box<xr::sys::CompositionLayerColorScaleBiasKHR>>,
}
impl Skybox {
pub fn new(app: &AppState) -> anyhow::Result<Self> {
pub fn new(xr: &XrState, app: &AppState) -> anyhow::Result<Self> {
let mut command_buffer = app
.gfx
.create_xfer_command_buffer(CommandBufferUsage::OneTimeSubmit)?;
@@ -74,10 +75,30 @@ impl Skybox {
let view = ImageView::new_default(maybe_image.unwrap())?; // safe unwrap
let grid_color_scale_bias_khr = xr
.instance
.exts()
.khr_composition_layer_color_scale_bias
.map(|_| {
Box::new(xr::sys::CompositionLayerColorScaleBiasKHR {
ty: xr::StructureType::COMPOSITION_LAYER_COLOR_SCALE_BIAS_KHR,
next: std::ptr::null(),
color_bias: Default::default(),
color_scale: xr::Color4f {
r: 1.0,
g: 1.0,
b: 1.0,
a: 1.0,
},
})
});
Ok(Self {
view,
sky: None,
grid: None,
grid_pose: translation_rotation_to_posef(Vec3A::ZERO, Quat::from_rotation_x(PI * -0.5)),
grid_color_scale_bias_khr: grid_color_scale_bias_khr,
})
}
@@ -205,10 +226,6 @@ impl Skybox {
const HI_VERT_ANGLE: f32 = 0.5 * PI;
const LO_VERT_ANGLE: f32 = -0.5 * PI;
static GRID_POSE: LazyLock<xr::Posef> = LazyLock::new(|| {
translation_rotation_to_posef(Vec3A::ZERO, Quat::from_rotation_x(PI * -0.5))
});
let pose = xr::Posef {
orientation: xr::Quaternionf::IDENTITY,
position: xr::Vector3f {
@@ -232,9 +249,12 @@ impl Skybox {
.lower_vertical_angle(LO_VERT_ANGLE);
self.grid.as_mut().unwrap().ensure_image_released()?;
let grid = xr::CompositionLayerQuad::new()
.layer_flags(xr::CompositionLayerFlags::BLEND_TEXTURE_SOURCE_ALPHA)
.pose(*GRID_POSE)
let flags = xr::CompositionLayerFlags::BLEND_TEXTURE_SOURCE_ALPHA
| xr::CompositionLayerFlags::UNPREMULTIPLIED_ALPHA;
let mut grid = xr::CompositionLayerQuad::new()
.layer_flags(flags)
.pose(self.grid_pose)
.size(xr::Extent2Df {
width: 10.0,
height: 10.0,
@@ -243,6 +263,15 @@ impl Skybox {
.eye_visibility(xr::EyeVisibility::BOTH)
.space(&xr.stage);
if let Some(grid_color_scale_bias_khr) = self.grid_color_scale_bias_khr.as_mut() {
let grid_opacity = app.session.config.grid_opacity;
grid_color_scale_bias_khr.color_scale.a = (grid_opacity * grid_opacity).clamp(0.0, 1.0);
unsafe {
let raw = next_chain_insert!(grid, grid_color_scale_bias_khr);
grid = xr::CompositionLayerQuad::from_raw(raw);
}
}
Ok(vec![
CompositionLayer::Equirect2(sky),
CompositionLayer::Quad(grid),
@@ -251,11 +280,8 @@ impl Skybox {
}
pub(super) fn create_skybox(xr: &XrState, app: &AppState) -> Option<Skybox> {
if !app.session.config.use_skybox {
return None;
}
xr.instance
.exts()
.khr_composition_layer_equirect2
.and_then(|_| Skybox::new(app).ok())
.and_then(|_| Skybox::new(xr, app).ok())
}
+9
View File
@@ -53,6 +53,11 @@ pub enum OpenVrTask {
ColorGain(ColorChannel, f32),
}
#[cfg(feature = "openxr")]
pub enum OpenXrTask {
SettingsChanged,
}
pub enum PlayspaceTask {
Recenter,
Reset,
@@ -66,6 +71,8 @@ pub enum ModifyPanelCommand {
SetColor(String),
SetImage(String),
SetVisible(bool),
GetValue,
SetValue(String),
SetStickyState(bool),
}
@@ -109,6 +116,8 @@ pub enum TaskType {
Playspace(PlayspaceTask),
#[cfg(feature = "openvr")]
OpenVR(OpenVrTask),
#[cfg(feature = "openxr")]
OpenXR(OpenXrTask),
}
#[derive(Deserialize, Clone, Copy)]
-1
View File
@@ -36,7 +36,6 @@ use std::fs::File;
use std::io::Write;
use std::os::fd::OwnedFd;
use std::sync::{Arc, Mutex};
use wayland_client::WEnum;
use smithay::utils::Serial;
use smithay::wayland::compositor::{self, BufferAssignment, SurfaceAttributes, send_surface_state};
+21 -4
View File
@@ -1,5 +1,6 @@
use std::rc::Rc;
use smithay::backend::input::{AxisRelativeDirection, AxisSource};
use smithay::{
input,
utils::{Logical, Point},
@@ -111,16 +112,32 @@ impl Window {
}
pub(super) fn send_mouse_scroll(manager: &mut WayVRCompositor, delta: WheelDelta) {
// workaround: it seems that with one event most applications work fine, but cage doesn't
manager.seat_pointer.axis(
&mut manager.state,
input::pointer::AxisFrame {
source: None,
source: Some(AxisSource::Continuous),
relative_direction: (
smithay::backend::input::AxisRelativeDirection::Identical,
smithay::backend::input::AxisRelativeDirection::Identical,
AxisRelativeDirection::Identical,
AxisRelativeDirection::Identical,
),
time: 0,
axis: (f64::from(delta.x), f64::from(-delta.y)),
axis: (f64::from(delta.x), 0.0),
v120: Some(((delta.x * 64.0) as i32, 0)),
stop: (false, false),
},
);
manager.seat_pointer.axis(
&mut manager.state,
input::pointer::AxisFrame {
source: Some(AxisSource::Continuous),
relative_direction: (
AxisRelativeDirection::Identical,
AxisRelativeDirection::Identical,
),
time: 0,
axis: (0.0, f64::from(-delta.y)),
v120: Some((0, (delta.y * -64.0) as i32)),
stop: (false, false),
},
+17 -5
View File
@@ -6,9 +6,11 @@ use wayvr_ipc::packet_client::WvrProcessLaunchParams;
use wlx_common::{
astr_containers::AStrMap,
config::{
AltModifier, CaptureMethod, GeneralConfig, SerializedWindowSet, SerializedWindowStates,
AltModifier, CaptureMethod, GeneralConfig, HandsfreePointer, SerializedWindowSet,
SerializedWindowStates,
},
config_io,
locale::Language,
overlays::BackendAttribValue,
};
@@ -103,8 +105,9 @@ pub fn load_general_config() -> GeneralConfig {
#[derive(Serialize)]
pub struct AutoSettings {
pub animation_speed: f32,
pub round_multiplier: f32,
pub ui_animation_speed: f32,
pub ui_round_multiplier: f32,
pub ui_gradient_intensity: f32,
pub click_freeze_time_ms: i32,
pub invert_scroll_direction_x: bool,
pub invert_scroll_direction_y: bool,
@@ -124,8 +127,10 @@ pub struct AutoSettings {
pub left_handed_mouse: bool,
pub block_game_input: bool,
pub block_game_input_ignore_watch: bool,
pub block_poses_on_kbd_interaction: bool,
pub space_drag_multiplier: f32,
pub use_skybox: bool,
pub grid_opacity: f32,
pub use_passthrough: bool,
pub screen_render_down: bool,
pub pointer_lerp_factor: f32,
@@ -139,6 +144,8 @@ pub struct AutoSettings {
pub capture_method: CaptureMethod,
pub keyboard_middle_click_mode: AltModifier,
pub autostart_apps: Vec<WvrProcessLaunchParams>,
pub handsfree_pointer: HandsfreePointer,
pub language: Option<Language>,
}
fn get_settings_path() -> PathBuf {
@@ -149,8 +156,9 @@ fn get_settings_path() -> PathBuf {
pub fn save_settings(config: &GeneralConfig) -> anyhow::Result<()> {
let conf = AutoSettings {
animation_speed: config.animation_speed,
round_multiplier: config.round_multiplier,
ui_animation_speed: config.ui_animation_speed,
ui_round_multiplier: config.ui_round_multiplier,
ui_gradient_intensity: config.ui_gradient_intensity,
click_freeze_time_ms: config.click_freeze_time_ms,
invert_scroll_direction_x: config.invert_scroll_direction_x,
invert_scroll_direction_y: config.invert_scroll_direction_y,
@@ -170,8 +178,10 @@ pub fn save_settings(config: &GeneralConfig) -> anyhow::Result<()> {
left_handed_mouse: config.left_handed_mouse,
block_game_input: config.block_game_input,
block_game_input_ignore_watch: config.block_game_input_ignore_watch,
block_poses_on_kbd_interaction: config.block_poses_on_kbd_interaction,
space_drag_multiplier: config.space_drag_multiplier,
use_skybox: config.use_skybox,
grid_opacity: config.grid_opacity,
use_passthrough: config.use_passthrough,
screen_render_down: config.screen_render_down,
pointer_lerp_factor: config.pointer_lerp_factor,
@@ -185,6 +195,8 @@ pub fn save_settings(config: &GeneralConfig) -> anyhow::Result<()> {
capture_method: config.capture_method,
keyboard_middle_click_mode: config.keyboard_middle_click_mode,
autostart_apps: config.autostart_apps.clone(),
handsfree_pointer: config.handsfree_pointer,
language: config.language,
};
let json = serde_json::to_string_pretty(&conf).unwrap(); // want panic
+4 -1
View File
@@ -17,7 +17,9 @@ use vulkano::{
memory::{
DedicatedAllocation, DeviceMemory, ExternalMemoryHandleType, ExternalMemoryHandleTypes,
MemoryAllocateInfo, MemoryImportInfo, MemoryPropertyFlags, ResourceMemory,
allocator::{AllocationCreateInfo, MemoryAllocator, MemoryTypeFilter},
allocator::{
AllocationCreateInfo, MemoryAllocatePreference, MemoryAllocator, MemoryTypeFilter,
},
},
sync::Sharing,
};
@@ -329,6 +331,7 @@ pub fn export_dmabuf_image(
..Default::default()
},
AllocationCreateInfo {
allocate_preference: MemoryAllocatePreference::AlwaysAllocate,
..Default::default()
},
)
Loaded 100 of 187 files, more files were not shown because too many files have changed in this diff. Show more