Skip to content

Commit e486488

Browse files
authored
xwayland: add core option for XWayland startup script (#2672)
Fixes #2670
1 parent 3947bee commit e486488

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@ build/**
6565
.cache/**
6666

6767
# End of https://www.toptal.com/developers/gitignore/api/c++,meson,ninja,linux
68+
.aider*

metadata/core.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@
6262
<_name>Start when client connects</_name>
6363
</desc>
6464
</option>
65+
<option name="xwayland_startup_script" type="string">
66+
<_short>XWayland startup script</_short>
67+
<_long>A script to execute when the XWayland server starts. This script is executed in a POSIX shell (/bin/sh).</_long>
68+
<default></default>
69+
</option>
6570
<option name="max_render_time" type="int">
6671
<_short>Maximum render time</_short>
6772
<_long>Sets the compositor render delay in milliseconds, which allows applications to render with low latency.</_long>

src/view/xwayland.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "../core/seat/cursor.hpp"
66
#include <wayfire/view.hpp>
77
#include <wayfire/nonstd/tracking-allocator.hpp>
8+
#include <wayfire/option-wrapper.hpp>
89

910
#include "wayfire/unstable/wlr-view-events.hpp"
1011
#include "wayfire/util.hpp"
@@ -243,6 +244,14 @@ void wf::init_xwayland(bool lazy)
243244

244245
wlr_xwayland_set_seat(xwayland_handle, wf::get_core().get_current_seat());
245246
xwayland_update_default_cursor();
247+
248+
static wf::option_wrapper_t<std::string> xwayland_startup_script{"core/xwayland_startup_script"};
249+
auto script = xwayland_startup_script.value();
250+
if (!script.empty())
251+
{
252+
LOGD("Executing XWayland startup script: ", script);
253+
wf::get_core().run(script);
254+
}
246255
});
247256

248257
xwayland_handle = wlr_xwayland_create(wf::get_core().display,

0 commit comments

Comments
 (0)