Page 1 of 1

Prevent multiple Chromium instances

Posted: Sat Dec 25, 2021 5:43 pm
by wizard

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

Re: Prevent multiple Chromium instances

Posted: Sat Dec 25, 2021 6:26 pm
by williwaw

.


Re: Prevent multiple Chromium instances

Posted: Sat Dec 25, 2021 11:57 pm
by mikewalsh

@wizard :-

Maybe something here that could help? These are all command-line/script 'exec' line '--switches' for modifying browser behaviour. I'll warn you; it's a LONG list..!

https://peter.sh/experiments/chromium-c ... -switches/

I've 'skimmed it' on several occasions, but I don't think I've ever read it right from top to bottom.

Mike. ;)


Re: Prevent multiple Chromium instances

Posted: Sun Dec 26, 2021 4:02 am
by wizard

@mikewalsh

Thanks mike, I'm using peebee's chromium 94 and did go through the list of experimental switches, no luck, and it is a long list. Couldn't find anything on a web search either.

wizard