Page 1 of 1

Determining default browser on Linux

Posted: Tue Jun 06, 2017 10:08 am
by stringan
By chance, noticed that Slimjet (maybe Chromium too?) uses the 'xdg-settings' command to determine if Slimjet is the default browser.
This is a hideously clunky script which, on my desktop system, takes about 0.8 seconds to execute. Maybe not much, but presumably stops Slimjet loading further until it finishes. Short of 'fronting' xdg-settings with a faster script, could Slimjet have an option not to bother looking to see if it is the default browser? Does it really need to know? ;)

Re: Determining default browser on Linux

Posted: Mon Aug 07, 2017 6:16 am
by stringan
Have now fronted xdg-settings with a script something like this:

Code: Select all

#!/usr/bin/env bash
# Fast wrapper to check default browser; save as /usr/local/bin/xdg-settings
if [[ "$1 $2" == "check default-web-browser" ]]; then
  def="$(sed -r "/^\[Default Applications\]/,/^\[/!d;/^x-scheme-handler\/http=/!d;s///;s/;.*//" ~/.config/mimeapps.list)"
  if [[ $def == $3 ]]; then echo yes; else echo no; fi  # Check <default>.desktop against <test>.desktop
  exit
fi
exec /usr/bin/xdg-settings "$@"
Performance is almost 200x faster than freedesktop.org's xdg-settings script
Hence distinctly swifter loading of Slimjet now!
:D

Re: Determining default browser on Linux

Posted: Wed Aug 16, 2017 1:00 pm
by MiqW7394
Hallo, stringan.

I don't know if you're merely trying to start as fast as you can, or if you're genuinely trying to speed up the 'checking' process.

If it's the former, there is a 'built-in' workaround, y'know.....and it's very simple. It makes use of one of the multitude of Chromium exec-line 'switches', of which there are hundreds. Have a look here if you're interested:-

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

Open Geany up (or whatever your favourite text-editor happens to be), and create a wee script, like this:-

Code: Select all

!bin/sh
flashpeak-slimjet --silent-launch &
(Note the space followed by a 'double-dash' in front of 'silent'). Make it executable, and place it wherever you place apps & processes you want to start at boot-time.

--------------------------------------------------

What it does is to start SlimJet in the background, without actually starting the GUI. Hence, when you're ready to open your browser, all you're really doing is to 'maximixe' it.....because it's already running in the background.

I use this in the SlimJet packages I build for the Puppy Linux membership, having 'acquired' it from another member who, in his turn, has been using it for years in Chrome.

Let me know if that helps.


Mike. ;)

Re: Determining default browser on Linux

Posted: Fri Aug 18, 2017 11:10 am
by stringan
Thanks Mike
That's an entirely sensible suggestion, which I may use on some systems.
My main beef was with the creaking xdg-settings utility which is just *so* slow.
I'd actually prefer a setting to optionally switch off default-browser checking entirely in Slimjet.
;)