From 25a532bc15187db24fbb9273239ef64bac5392d3 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 19 Jan 2026 10:40:37 +0100 Subject: [PATCH 1/5] Handle Path= argument in .desktop files --- server/main.cpp | 2 +- server/start_application.cpp | 20 +++++++++++++++++--- server/start_application.h | 7 ++++--- server/start_systemd_unit.cpp | 8 +++++++- server/start_systemd_unit.h | 2 +- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/server/main.cpp b/server/main.cpp index e545993c..a85ea096 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -513,7 +513,7 @@ gboolean control_received(gint fd, GIOCondition condition, gpointer user_data) [&](const wivrn::from_headset::start_app & request) { const auto & apps = list_applications(); if (auto it = apps.find(request.app_id); it != apps.end()) - children->start_application(it->second.exec); + children->start_application(it->second.exec, it->second.path); }, [&](const from_monado::headset_connected &) { stop_publishing(); diff --git a/server/start_application.cpp b/server/start_application.cpp index 7d729583..499655ae 100644 --- a/server/start_application.cpp +++ b/server/start_application.cpp @@ -22,6 +22,7 @@ #include "utils/flatpak.h" #include +#include #include #include #include @@ -95,15 +96,15 @@ static std::vector unescape_string(const std::string & app_string) return app; } -void children_manager::start_application(const std::string & exec) +void children_manager::start_application(const std::string & exec, const std::optional & path) { - start_application(unescape_string(exec)); + start_application(unescape_string(exec), path); } forked_children::forked_children(std::function state_changed_cb) : state_changed_cb(state_changed_cb) {} -void forked_children::start_application(const std::vector & args) +void forked_children::start_application(const std::vector & args, const std::optional & path) { if (args.empty()) return; @@ -151,6 +152,19 @@ void forked_children::start_application(const std::vector & args) { tmp.push_back("flatpak-spawn"); tmp.push_back("--host"); + if (path) + tmp.push_back("--directory=" + *path); + } + else + { + try + { + std::filesystem::current_path(*path); + } + catch (std::exception & e) + { + std::cerr << "Failed to set path to " << *path << ": " << e.what() << std::endl; + } } tmp.insert(tmp.end(), args.begin(), args.end()); diff --git a/server/start_application.h b/server/start_application.h index 27869807..948d7a86 100644 --- a/server/start_application.h +++ b/server/start_application.h @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -32,8 +33,8 @@ class children_manager public: virtual ~children_manager(); - virtual void start_application(const std::vector &) = 0; - void start_application(const std::string &); + virtual void start_application(const std::vector &, const std::optional & path = {}) = 0; + void start_application(const std::string &, const std::optional & path = {}); virtual bool running() const = 0; @@ -55,7 +56,7 @@ public: forked_children(std::function state_changed_cb); virtual ~forked_children(); - void start_application(const std::vector &) override; + void start_application(const std::vector &, const std::optional & path) override; // true if any unit started by this object is still running bool running() const override; diff --git a/server/start_systemd_unit.cpp b/server/start_systemd_unit.cpp index 258fca49..76fc630f 100644 --- a/server/start_systemd_unit.cpp +++ b/server/start_systemd_unit.cpp @@ -196,7 +196,7 @@ struct variant_builder }; // namespace -void systemd_units_manager::start_application(const std::vector & args) +void systemd_units_manager::start_application(const std::vector & args, const std::optional & path) { if (args.empty()) return; @@ -224,6 +224,12 @@ void systemd_units_manager::start_application(const std::vector & a &exec_start, 1)); + if (path) + g_variant_builder_add(&b, + "(sv)", + "WorkingDirectory", + g_variant_new("s", path->c_str())); + if (auto path = std::getenv("PATH")) { variant_builder pathv(G_VARIANT_TYPE("as")); diff --git a/server/start_systemd_unit.h b/server/start_systemd_unit.h index 31d53c37..45a48ae0 100644 --- a/server/start_systemd_unit.h +++ b/server/start_systemd_unit.h @@ -54,7 +54,7 @@ public: systemd_units_manager(GDBusConnection * connection, std::function state_changed_cb); // create and start the transient unit - void start_application(const std::vector &) override; + void start_application(const std::vector &, const std::optional & path) override; // true if any unit started by this object is still running bool running() const override; From b632502da5a8c2a5c16c630f91fc1b4b8902305a Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Mon, 19 Jan 2026 21:40:34 +0100 Subject: [PATCH 2/5] Fix missing starry background in nightly builds published on the Meta store --- .github/workflows/Build.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 25649368..6117efb8 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -279,7 +279,6 @@ jobs: VERSION_CODE=$(( $VERSION_CODE + 1 )) fi - CSS=images/wivrn-release.css APPNAME=WiVRn else VERSION_CODE=1 @@ -287,15 +286,20 @@ jobs: if [ ${{ github.ref_type }} = 'tag' ] then SUFFIX=".github" - CSS=images/wivrn-release.css APPNAME="WiVRn" else SUFFIX=".github.testing" - CSS=images/wivrn-nightly.css APPNAME="WiVRn Testing" fi fi + if [ ${{ github.ref_type }} = 'tag' ] + then + CSS=images/wivrn-release.css + else + CSS=images/wivrn-nightly.css + fi + echo Setting version $VERSION and version code $VERSION_CODE in manifest echo Using stylesheet $CSS and name $APPNAME From e06d0d094367eb5563083ba8231683b23aea4883 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 19 Jan 2026 19:37:25 +0100 Subject: [PATCH 3/5] Optimize away a memory allocation --- common/wivrn_sockets.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/common/wivrn_sockets.cpp b/common/wivrn_sockets.cpp index b4c881af..875040ae 100644 --- a/common/wivrn_sockets.cpp +++ b/common/wivrn_sockets.cpp @@ -313,24 +313,21 @@ wivrn::deserialization_packet wivrn::UDP::receive_raw() #else buffer.reset(new uint8_t[message_size * num_messages]); #endif - std::vector iovecs; - std::vector mmsgs; - iovecs.reserve(num_messages); - mmsgs.reserve(num_messages); + std::array iovecs; + std::array mmsgs; for (size_t i = 0; i < num_messages; ++i) { - iovecs.push_back({ + iovecs[i] = { .iov_base = buffer.get() + message_size * i, .iov_len = message_size, - }); + }; - mmsgs.push_back( - { - .msg_hdr = { - .msg_iov = &iovecs.back(), - .msg_iovlen = 1, - }, - }); + mmsgs[i] = { + .msg_hdr = { + .msg_iov = &iovecs[i], + .msg_iovlen = 1, + }, + }; } int received = recvmmsg(fd, mmsgs.data(), num_messages, MSG_DONTWAIT, nullptr); From 62a626e35ebbc408fb9f738c85d0ce7e4b7e511b Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 19 Jan 2026 20:54:37 +0100 Subject: [PATCH 4/5] Avoid memory allocation in UDP receive --- common/wivrn_sockets.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/wivrn_sockets.cpp b/common/wivrn_sockets.cpp index 875040ae..3f085bd2 100644 --- a/common/wivrn_sockets.cpp +++ b/common/wivrn_sockets.cpp @@ -308,11 +308,14 @@ wivrn::deserialization_packet wivrn::UDP::receive_raw() static const size_t message_size = 2048; static const size_t num_messages = 20; + if ((not buffer) or buffer.use_count() > 1) + { #if defined(__cpp_lib_smart_ptr_for_overwrite) && __cpp_lib_smart_ptr_for_overwrite >= 202002L - buffer = std::make_shared_for_overwrite(message_size * num_messages); + buffer = std::make_shared_for_overwrite(message_size * num_messages); #else - buffer.reset(new uint8_t[message_size * num_messages]); + buffer.reset(new uint8_t[message_size * num_messages]); #endif + } std::array iovecs; std::array mmsgs; for (size_t i = 0; i < num_messages; ++i) From 5e4108f1c1cc6847e9ed56a4efcef868ce36b99e Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 19 Jan 2026 23:23:18 +0100 Subject: [PATCH 5/5] Don't build libnotify in flatpak --- flatpak/io.github.wivrn.wivrn.yml.in | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/flatpak/io.github.wivrn.wivrn.yml.in b/flatpak/io.github.wivrn.wivrn.yml.in index 30274957..58fcad50 100644 --- a/flatpak/io.github.wivrn.wivrn.yml.in +++ b/flatpak/io.github.wivrn.wivrn.yml.in @@ -256,23 +256,6 @@ modules: cleanup: - '*' - - name: libnotify - buildsystem: meson - config-opts: - - -Dtests=false - - -Dintrospection=disabled - - -Dman=false - - -Dgtk_doc=false - - -Ddocbook_docs=disabled - sources: - - type: archive - url: https://download.gnome.org/sources/libnotify/0.8/libnotify-0.8.8.tar.xz - sha256: 23420ef619dc2cb5aebad613f4823a2fa41c07e5a1d05628d40f6ec4b35bfddd - x-checker-data: - type: gnome - name: libnotify - stable-only: true - - name: qcoro buildsystem: cmake-ninja config-opts: