1

I am trying to launch a script after a user has loged into the computer using the GUI. This script requires user input through the terminal. I have tried the following

.desktop file in ~/.config/autostart --> Does not work

When using this the output is not the same as that of the script running in the terminal. It closes the opened applications and vpn breaks the network connection. Neither of these occurr using the normal terminal.

My desktop enviroment is xubuntu version 20.04.


#!/bin/bash

echo "........ Start Up Script ........." echo "sudo priveledges necessary for VPN"

#Connect VPN to Server in Czech Republic sudo protonvpn c --cc CZ

#Prompt To Mount Encrypted Files read -p 'Mount Encrypted Files? [ y/n ] ' encryptedmount case $encryptedmount in [Yy]* ) veracrypt -t -k "" --pim=0 --protect-hidden=no /media/peterthegreat/Main_Data/Files /media/veracrypt1; break;; [Nn]* ) ;; esac

Prompt To Update Packages

read -p 'Upgrade and Update System? [ y/n ] ' upgradeandupdate case $upgradeandupdate in [Yy]* ) apt-get update && apt-get upgrade; break;; [Nn]* ) ;; esac

#Prompt to Open Tilix read -p 'Open Tilix? [ y/n ] ' til case $til in [Yy]* ) cd /home/peterthegreat; tilix --session=~/Documents/Start_Up/TilixSetup.json -e &;; [Nn]* ) ;; esac disown %1

#Prompt to Open Firefox read -p 'Open Firefox? [ y/n ] ' firefox case $firefox in [Yy]* ) firefox &;; [Nn]* ) ;; esac disown %1

echo "....... Done ......."

Thanks

1 Answers1

0

Have a look at .desktop file spec -- its not expecting a bash script.

Your .desktop file needs to look something like

[Desktop Entry]
Type=Application
Exec=<path to your bash script>
Terminal=True
X-GNOME-Autostart-enabled=true
NoDisplay=false
Hidden=false
Name[en_GB]=VPN
Comment[en_GB]=Creates a VPN
X-GNOME-Autostart-Delay=9

where "path to your bash script" points to the script that you show in the question (probably best saved in /usr/local/bin)

Nick Sillito
  • 1,636