WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit ce901ef

Browse files
authored
electron: Overhaul sandbox permissions section
1 parent 73f858c commit ce901ef

File tree

1 file changed

+38
-26
lines changed

1 file changed

+38
-26
lines changed

docs/electron.rst

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ manifest:
6262
base: org.electronjs.Electron2.BaseApp
6363
base-version: '23.08'
6464
65-
BaseApps are described in :doc:`dependencies`. Using the Electron base
65+
BaseApps are described in :doc:`dependencies`. Using the Electron base
6666
app is much faster and more convenient than manually building Electron
6767
dependencies. It also has the advantage of reducing the amount of duplication
6868
on users' machines, since it means that Electron is only saved once on disk.
@@ -103,14 +103,14 @@ later.
103103
Sandbox permissions
104104
-------------------
105105

106-
The standard guidelines on sandbox permissions apply to Electron
107-
applications. However, Electron does not use Wayland by default. So for
108-
display access, only X11 should be used as the default configuration.
109-
This will make Electron use Xwayland in a wayland session and nothing
110-
else is required.
106+
The standard sandbox :ref:`sandbox-permissions:Permissions guidelines` also
107+
apply to Electron applications. However, Electron's Wayland support is still
108+
experimental. So for display access, only X11 should be used as the default
109+
configuration. This will make Electron use Xwayland in a Wayland session and
110+
nothing else is required.
111111

112-
The sample app also configures pulseaudio for sound and enables network
113-
access.
112+
The sample app also configures PulseAudio for sound and enables network
113+
access:
114114

115115
.. code-block:: yaml
116116
@@ -122,36 +122,48 @@ access.
122122
- --share=network
123123
- --env=ELECTRON_TRASH=gio
124124
125-
.. note::
126-
127-
Native wayland support in electron is experimental and often unstable.
128-
It is advised to stick with the X11 and Xwayland configuration above
129-
as the default.
130-
131-
To enable experimental `native Wayland` support in Electron>=20, the
125+
To allow experimental `native Wayland` support in Electron>=20, the
132126
``--ozone-platform-hint=auto`` flag can be passed to the program. `auto`
133-
will choose Wayland when the session is wayland and Xwayland or X11
134-
otherwise.
127+
will choose Wayland when the current session is running under Wayland and
128+
Xwayland or X11 otherwise.
135129

136-
The recommended option is to leave it to the user. So ``--socket=x11``
137-
should be used in manifest and Wayland can be tested with::
130+
It's recommended to leave actually `enabling` Wayland up to the user for now,
131+
i.e. set ``--socket=x11`` in the manifest. Wayland can then be tested with::
138132

139133
flatpak run --socket=wayland org.flathub.electron-sample-app
140134

141-
To make native wayland the `default` for users ``--socket=fallback-x11``
135+
Enable native Wayland support by default
136+
````````````````````````````````````````
137+
138+
.. note::
139+
140+
Native Wayland support in Electron is still experimental and often unstable.
141+
It is advised to stick with the X11/Xwayland configuration above as the
142+
default.
143+
144+
To make native Wayland the `default` for users, ``--socket=fallback-x11``
142145
and ``--socket=wayland`` must be used in the manifest.
143146

144-
For Electron versions between 17 and 27, client-side window decorations in native wayland can be enabled by
145-
passing ``--enable-features=WaylandWindowDecorations``.
147+
For Electron versions between 17 and 27, client-side window decorations under
148+
native Wayland can be enabled by passing
149+
``--enable-features=WaylandWindowDecorations`` to the program. For newer
150+
versions of Electron , this isn't necessary anymore.
146151

147152
Electron uses ``libnotify`` on Linux to provide desktop notifications.
148-
libnotify `since 0.8.0 <https://gitlab.gnome.org/GNOME/libnotify/-/merge_requests/27>`_
153+
`Since version 0.8.0 <https://gitlab.gnome.org/GNOME/libnotify/-/merge_requests/27>`_ libnotify
149154
automatically uses the `notification portal <https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Notification.html>`_
150155
when inside a sandboxed environment and ``--talk-name=org.freedesktop.Notifications``
151-
is not required.
156+
is not required anymore. ``org.electronjs.Electron2.BaseApp`` includes
157+
``libnotify>=0.8.0`` since ``branch/23.08``.
158+
159+
To ensure proper mouse cursor scaling on HiDPI displays under Wayland, the
160+
``XCURSOR_PATH`` environment variable must be set to the host's corresponding
161+
directories:
152162

153-
``org.electronjs.Electron2.BaseApp`` since ``branch/23.08`` comes with
154-
``libnotify>=0.8.0``
163+
.. code-block:: yaml
164+
165+
finish-args:
166+
- --env=XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons
155167
156168
.. _use-correct-desktop-filename:
157169

0 commit comments

Comments
 (0)