Location for Gnome script to be run at login
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. Larry
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 -- Simon Lees (Simotek) http://simotek.net Emergency Update Team keybase.io/simotek SUSE Linux Adelaide Australia, UTC+10:30 GPG Fingerprint: 5B87 DB9D 88DC F606 E489 CEC5 0922 C246 02F0 014B
On 8/5/22 10:26, Larry Len Rainey wrote:
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.
Ahh yeah sorry, I didn't realise you were looking from a packaging perspective. In that case systemd units are much better. The pre systemd way was to force whichever application to take care of it on first run.
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.
Neither am I but i'm sure someone else on the list will pipe up if something is wrong here.
Something like this and systemcfg enable vbox_clipboard.service
Check out https://en.opensuse.org/openSUSE:Systemd_packaging_guidelines#Enabling_units for enabling the service, the way it needs to be done for openSUSE packages is slightly different to standard.
|[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]=
-- Simon Lees (Simotek) http://simotek.net Emergency Update Team keybase.io/simotek SUSE Linux Adelaide Australia, UTC+10:30 GPG Fingerprint: 5B87 DB9D 88DC F606 E489 CEC5 0922 C246 02F0 014B
On 05.08.2022 01:09, 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.
E-h-h ... https://bugzilla.opensuse.org/show_bug.cgi?id=1194126
Any help will be appreciated.
Well, there are two options 1. Starting as user service. The problem is to arrange start of this service after Wayland compositor is fully functional and Xwayland (at least $DISPLAY) is actually available. GNOME has graphical-session.target, so ordering this service after it worked in my testing. KDE does not (yet?) use systemd to manage session processes, so for KDE something else is needed. 2. Use normal XDG autostart facilities that should work in any DE. For this just place desktop file in /etc/xdg/autostart. I do not know whether there is any condition to restrict it only to Wayland environment. Note that autostart will be processed both for X11 and Wayland, which may conflict with xinit script (I do not know if VB service is smart enough to notice it is already running). Moving startup from xinit to autostart means it will stop working for bare minimal X11 environment without any fancy desktop.
On 8/5/22 15:15, Andrei Borzenkov wrote:
On 05.08.2022 01:09, 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.
E-h-h ... https://bugzilla.opensuse.org/show_bug.cgi?id=1194126
Any help will be appreciated.
Well, there are two options
1. Starting as user service. The problem is to arrange start of this service after Wayland compositor is fully functional and Xwayland (at least $DISPLAY) is actually available. GNOME has graphical-session.target, so ordering this service after it worked in my testing. KDE does not (yet?) use systemd to manage session processes, so for KDE something else is needed.
2. Use normal XDG autostart facilities that should work in any DE. For this just place desktop file in /etc/xdg/autostart. I do not know whether there is any condition to restrict it only to Wayland environment. Note that autostart will be processed both for X11 and Wayland, which may conflict with xinit script (I do not know if VB service is smart enough to notice it is already running). Moving startup from xinit to autostart means it will stop working for bare minimal X11 environment without any fancy desktop.
It would be simple enough to detect a straight X11 session and bail (for example $DISPLAY will be set and $WAYLAND_DISPLAY will not. As long as its well documented that people using xinit may need extra steps and what those steps are having it stop working there by default is probably ok. These days any user experienced enough to still be needing xinit should have the technical skills to make any required adjustments. These days there are plenty of things that assume a systemd user session will have been started because ligthdm, gdm and sddm all handle this. -- Simon Lees (Simotek) http://simotek.net Emergency Update Team keybase.io/simotek SUSE Linux Adelaide Australia, UTC+10:30 GPG Fingerprint: 5B87 DB9D 88DC F606 E489 CEC5 0922 C246 02F0 014B
participants (4)
-
Andrei Borzenkov
-
Larry Finger
-
Larry Len Rainey
-
Simon Lees