Reputation: 19826
I’m making a program with Ruby where I need to know the default browser of the user (actually, I want to know if his/her default browser is Chrome or Chromium (and which one)). How can I do that?
Upvotes: 1
Views: 79
Reputation: 2945
You can find out default user browser with bash command, and then check out inclusion of chrome
or chromium
substring. Something like this.
1.9.3p194 :001 > mimelist = `cat ~/.local/share/applications/mimeapps.list | grep text/html`
=> "text/html=google-chrome.desktop\n"
1.9.3p194 :004 > mimelist.include?('chrome')
=> true
1.9.3p194 :005 > mimelist.include?('chromium')
=> false
Upvotes: 1