From 5c35bf032b32089827545de4d10e95f35e86f709 Mon Sep 17 00:00:00 2001 From: RedBearAK <64876997+RedBearAK@users.noreply.github.com> Date: Thu, 1 Apr 2021 12:02:19 -0800 Subject: [PATCH] Inline export DISPLAY on openSUSE Tumbleweed OpenSUSE Tumbleweed has an error where install completes but the xkeysnail service won't run due to "display not found". Double quotes together indicates display environment variable inside the command is nonexistent or empty. This patch inlines `export DISPLAY=` [ insert actual DISPLAY variable value] at the beginning of the main command in the xkeysnail service file, just before the file is copied into its destination. Don't know of any other way to fix the issue on Tumbleweed. Tried moving the "Environment" line before the "ExecStart" line in the service file, that of course made no difference. --- xkeysnail_service.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index 3222c99..641bba6 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -491,6 +491,12 @@ if ! [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then fi sed -i "s#{xkeysnail}#`which xkeysnail`#g" ./linux/xkeysnail.service.new sed -i "s#{xkeysnail}#`which xkeysnail`#g" ./linux/limitedadmins.new + + # openSUSE Tumbleweed needs DISPLAY exported inside main command to avoid display "" not found error. + if [ "$distro" == "opensusetumbleweed" ]; then + sed -i "s#'/usr/bin/xhost#'export DISPLAY=`echo $DISPLAY` \&\& /usr/bin/xhost#g" ./linux/xkeysnail.service.new + fi + sudo mv ./linux/xkeysnail.service.new "$xkeypath"xkeysnail.service && echo "Service file added to "$xkeypath"xkeysnail.service" sudo chown root:root ./linux/limitedadmins.new # Add a check here for xkeysnail path resolving