Simon,

My issue with the .desktop approach is that Virtualbox need to install this for every user at zypper install/update time.

The .config/autostart in not a valid approach for zypper to do if users are added after Virtualbox guest additions are installed.

I was looking at a script to add to /etc/systemd/system to install the code in the systemd user space upon login.

I am not a systemd guru - I think that the oneshot should start every login.

Something like this and systemcfg enable vbox_clipboard.service

[Unit]
Description=Virtualbox Clipboard Service
[Service]
Type=oneshot
RemainAfterExit=true
StandardOutput=journal
ExecStart=/usr/lib/virtualbox/vbox-fix-clipboard-script.sh
#need to wait for Wayland to start
TimeoutStartSec=3
RemainAfterExit=yes

[Install]
WantedBy=graphical.target

The vbox-fix-clipboard-script.sh would test to see if wayland is running - if so it would install the clipboard service. If not it would just exit.

Larry Rainey

Assistant VB maintainer

On 8/4/22 19:28, Simon Lees wrote:

On 8/5/22 07:39, Larry Finger wrote:
Hi,

I have run into a problem using VirtualBox with Wayland-based guests.
The script that enables clipboard sharing and screen resizing under X11
uses a system service script; however for Wayland graphics, the
appropriate commands cannot be run until the user logs in.

I do not know how to create a user-based service, nor do I know where to
place a script so that it will be run for every user that logs in.

Any help will be appreciated.
There are generally 2 options, as you say systemd user sessions which
are well documented on the arch wiki [1]. Secondly most desktops will
run any .desktop file in $HOME/.config/autostart so you can write a
desktop file that just runs a script such as this one that was generated
by enlightenment for me.

[Desktop Entry]
Hidden=false
Exec=./src/config/scripts-config/startup.sh
Icon=
Type=Application
NoDisplay=false
Version=1.0
StartupNotify=false
StartupWMClass=
GenericName[en_US]=startup
Comment=Startup
DBusActivatable=false
Terminal=false
Name=Startup
GenericName=startup
Icon[en_US]=
TryExec=./src/config/scripts-config/startup.sh
Name[en_US]=
Comment[en_US]=

1. https://wiki.archlinux.org/title/systemd/User