#!/bin/bash # Script assumes one user is using the desktop environment (no multi-session). # It was tested on Fedora 38, 39, Debian 12, and OpenSUSE Leap/Tumbleweed. set -x run_uid=$(id -u) # Start detached script and exit as root (to send result back to Fleet). if [ $run_uid == 0 ] && [ $# -eq 0 ]; then /bin/bash -c "/bin/bash $0 1 >/var/log/orbit/appindicator_script.log 2>/var/log/orbit/appindicator_script.log }' 0 # Give some time to user to see notification. sleep 10 # Use GNOME Extensions for all distributions (including OpenSUSE) sudo -i -u $username -H DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus \ gdbus call --session \ --dest org.gnome.Shell.Extensions \ --object-path /org/gnome/Shell/Extensions \ --method org.gnome.Shell.Extensions.InstallRemoteExtension \ "$extension_name" # Wait until the extension is accepted by the user ("gdbus call" command above is asynchronous). while [ ! -d "/home/$username/.local/share/gnome-shell/extensions/$extension_name" ]; do sleep 1 done # Sleep to give some time for files to be downloaded. sleep 15 fi # Enable the extension if [ -d "$extension_path" ]; then sudo -i -u $username -H DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus \ gnome-extensions enable "$extension_name" fi