Prevent multiple Chromium instances
In my current remaster project, Cloudpup-Fossa64, a ChromeOS work-a-like, I want to prevent the user from opening more than one instance of Chromium. No extensions or settings appear to do this. Wrote this script, that works, but think there are probably better ways. Also has a companion script in startup that deletes the test file in case of a ungraceful shutdown.
Feel free to comment and contribute.
wizard
Code: Select all
#! /bin/bash
#prevents multiple Chromium instance
#minimize window
thisid=$(xdotool getactivewindow)
echo $thisid
xdotool windowminimize $thisid
#check if Chromium is running
FILE=/root/my-applications/bin/chrom-on.txt
if [ -f "$FILE" ]; then
DIALOG=${DIALOG=Xdialog}
$DIALOG --title "Chromium" --clear \
--msgbox "Chromium is already running" 10 30
exit
fi
#create test file
>/root/my-applications/bin/chrom-on.txt
chromium "$@"
wait
#remove test file when chromium closes
rm /root/my-applications/bin/chrom-on.txt