2nd activated browser sets itself as default browser
- Rava
- Contributor
- Posts: 5415
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
2nd activated browser sets itself as default browser
I created the chromium-ungoogled-105.0.5195.125-x86_64-en-GB-1alien.xzm module via update-browser.
Without asking me it set itself up as default browser (at least partially) - when I click a URL link in interlink, it opens chromium-ungoogled instead of my default browser Palemoon.
Still, when chromium-ungoogled got started by clicking a link in interlink, chromium-ungoogled told me it's not the system's default browser.
When I did a "killall palmoon" (after chromium-ungoogled got activated, was run once and then quit) and then restarted Palemoon, it did not complain about not being the default.
Still, despite all that, it was chromium-ungoogled instead of Palemoon that got started by interlink.
I presume the reason is that the last browser that one has activated is always set as the default browser, overwriting the previous settings.
Why chromium-ungoogled gets started, but still both Palemoon and chromium-ungoogled seem to think the default browser is Palemoon I do not get. Most probably because I do not fully understand what's going on with setting up the default browser under the OS's hood.
Is there a way for the user to have control what is and what stays the default browser?
I load at boot the most recent Palemoon, but at times I need a 2nd browser, e.g. for video conferences. Still, I never want that 2nd browser to be appointed as the default browser. There should be a way for the user to tell the system which browser should be kept as default. The method of the newest activated browser module getting the role of default browser is not working for me, and some other users who only need temporarily a 2nd browser for certain tasks might see it the same way.
Without asking me it set itself up as default browser (at least partially) - when I click a URL link in interlink, it opens chromium-ungoogled instead of my default browser Palemoon.
Still, when chromium-ungoogled got started by clicking a link in interlink, chromium-ungoogled told me it's not the system's default browser.
When I did a "killall palmoon" (after chromium-ungoogled got activated, was run once and then quit) and then restarted Palemoon, it did not complain about not being the default.
Still, despite all that, it was chromium-ungoogled instead of Palemoon that got started by interlink.
I presume the reason is that the last browser that one has activated is always set as the default browser, overwriting the previous settings.
Why chromium-ungoogled gets started, but still both Palemoon and chromium-ungoogled seem to think the default browser is Palemoon I do not get. Most probably because I do not fully understand what's going on with setting up the default browser under the OS's hood.
Is there a way for the user to have control what is and what stays the default browser?
I load at boot the most recent Palemoon, but at times I need a 2nd browser, e.g. for video conferences. Still, I never want that 2nd browser to be appointed as the default browser. There should be a way for the user to tell the system which browser should be kept as default. The method of the newest activated browser module getting the role of default browser is not working for me, and some other users who only need temporarily a 2nd browser for certain tasks might see it the same way.
Cheers!
Yours Rava
Yours Rava
-
- Black ninja
- Posts: 62
- Joined: 23 Jul 2022, 07:42
- Distribution: Porteus 5.01_x86_64 Xfce
2nd activated browser sets itself as default browser
Hi,
try the following:
in your chromium-ungoogled module is a file /usr/share/application/browser.desktop.
This overwrites the corresponding file in your system.
Delete it from your module and build a module without this file.
try the following:
in your chromium-ungoogled module is a file /usr/share/application/browser.desktop.
This overwrites the corresponding file in your system.
Delete it from your module and build a module without this file.
- Rava
- Contributor
- Posts: 5415
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
2nd activated browser sets itself as default browser
^
Will do and will report back.
What happens when one deactivates the later activated browser module? Will the original /usr/share/application/browser.desktop (in my case → Palemoon) be restored?
Will do and will report back.
What happens when one deactivates the later activated browser module? Will the original /usr/share/application/browser.desktop (in my case → Palemoon) be restored?
Cheers!
Yours Rava
Yours Rava
-
- Black ninja
- Posts: 73
- Joined: 14 Sep 2022, 17:52
- Distribution: Debian
2nd activated browser sets itself as default browser
I hope you had your problem resolved. You got me curious with Palemoon browser and currently using it to type this message... :buhehe:
One thing, on another forum I participate in, on "code" blocks this browser keeps displaying "off" with the two "f's" pulled together as if they were "i's" in a non-monospaced font which is getting on my nerves. The "code" block font is supposed to be something like "Courier New" on Windoze, right? It behaves a lot like the old Firefox I used on Windoze instead of Internet Explorer because the former was slicker loading dozens of images in a short time and displaying them in one page. It had a pretty good ad-blocker too. But it kept asking for add-ons and upgrades which sucked...
- Rava
- Contributor
- Posts: 5415
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
2nd activated browser sets itself as default browser
Originally it is based on an older FFx, but one can say that Palemoon nowadays is mostly its own thing (they even have their very own version of html renderer)
Added in 2 minutes 35 seconds:
In case someone wonders, while I did not manage to hack any of my alternative browser modules (that is: anything but the Palemoon one) I did manage to deactivate chromium-without-shiitake-googled and the old /usr/share/application/browser.desktop gets indeed restored.
But since I have approx 45 minutes time till my next assignment I try to hack chromium-without-shiitake-googled right NOW.
(Rava out)
Added in 7 minutes 54 seconds:
In case one gets confused, /Porteus_modules is a symlink to the internal harddisk main folder for modules (this being on an ext3 partition), and /Porteus_modules_sdb4/ is the same but - maybe you guessed it - on sdb4 (also on an ext3 partition)
Code: Select all
root@porteus:/Porteus_modules# mkdir /Porteus_modules_sdb4/HAPPYHACKING/
root@porteus:/Porteus_modules# xzm2dir 005-chromium-ungoogled-91.0.4472.114-x86_64-en-US-1alien.xzm /Porteus_modules_sdb4/HAPPYHACKING/
Parallel unsquashfs: Using 8 processors
[…]
root@porteus:/Porteus_modules# cd /Porteus_modules_sdb4/HAPPYHACKING/
root@porteus:/Porteus_modules_sdb4/HAPPYHACKING# ls -o
total 40
drwxr-xr-x 6 root 4096 2021-06-29 07:25 .
drwxr-xr-x 54 guest 20480 2022-09-28 09:41 ..
drwxr-xr-x 3 root 4096 2021-06-21 06:49 etc
drwxr-xr-x 3 root 4096 2021-06-29 07:17 home
drwxr-xr-x 7 root 4096 2021-06-21 06:49 usr
drwxr-xr-x 4 root 4096 2021-06-29 07:25 var
root@porteus:/Porteus_modules_sdb4/HAPPYHACKING# rm usr/share/applications/browser.desktop
root@porteus:/Porteus_modules_sdb4/HAPPYHACKING# cd -
/Porteus_modules
root@porteus:/Porteus_modules# dir2xzm /Porteus_modules_sdb4/HAPPYHACKING 005-chromium-ungoogled-91.0.4472.114-x86_64-en-US-1alien-NO-browser.desktop.xzm
Parallel mksquashfs: Using 8 processors
Creating 4.0 filesystem on 005-chromium-ungoogled-91.0.4472.114-x86_64-en-US-1alien-NO-browser.desktop.xzm, block size 262144.
[…]
Number of ids (unique uids + gids) 3
Number of uids 2
root (0)
guest (1000)
Number of gids 2
root (0)
users (100)
root@porteus:/Porteus_modules# activate 005-chromium-ungoogled-91.0.4472.114-x86_64-en-US-1alien-NO-browser.desktop.xzm
Updating shared library links: /sbin/ldconfig
root@porteus:/Porteus_modules# grep Exec /usr/share/applications/browser.desktop
Exec=palemoon %u
root@porteus:/Porteus_modules#
But the best thing, it worked as it should.
The main part of course is this considered /Porteus_modules_sdb4/HAPPYHACKING is the folder where you unpacked your original browser module into (and is on a ext[234] partition, or some other kind of Linux partition [NO VFAT nor NTFS or such]) is this:
Code: Select all
root@porteus:/Porteus_modules_sdb4/HAPPYHACKING# rm usr/share/applications/browser.desktop
Cheers!
Yours Rava
Yours Rava
- Rava
- Contributor
- Posts: 5415
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
2nd activated browser sets itself as default browser
No, it did NOT work as it should.
While /usr/share/applications/browser.desktop was not changed from
Code: Select all
Exec=palemoon %u
Seems there is more going on under the hood than just /usr/share/applications/browser.desktop …
Hopefully anyone has an idea what that can be?
Or did silly interlink save to its settings the change in browser by itself? [It is the only program where its settings folder is persistent since I do not want to download the approx 1.5 GB of emails each time anew I start Porteus…]
Added in 3 minutes 48 seconds:
I did look up everything there is to see in interlink's Preferences… but found no entry defining which browser to use…
Added in 3 minutes 37 seconds:
Update 2
After I deactivated 005-chromium-ungoogled-91.0.4472.114-x86_64-en-US-1alien-NO-browser.desktop.xzm the links in interlink were opened in palemoon once again, so it should not be an issue with interlink itself but only with the system.
But when it's not /usr/share/applications/browser.desktop - then what is it?
Added in 3 minutes 8 seconds:
Since /usr/share/applications/chromium-ungoogled.desktop also kinda defines a browser, could it be that
Code: Select all
Updating shared library links: /sbin/ldconfig
Here you see what is left in the hacked module's usr/share/applications/ :
Code: Select all
root@porteus:/Porteus_modules_sdb4/HAPPYHACKING/usr/share/applications# ls -o --time-style=long-iso
total 12
-rw-r--r-- 1 root 8552 2021-06-21 06:49 chromium-ungoogled.desktop
Now Rava out, my RL appointment awaits.
*runs off*
Cheers!
Yours Rava
Yours Rava
-
- Black ninja
- Posts: 62
- Joined: 23 Jul 2022, 07:42
- Distribution: Porteus 5.01_x86_64 Xfce
2nd activated browser sets itself as default browser
nothing is defined in /usr/share/applications/, it stores entries for the startup menu and some programs use this information.Rava wrote:Since /usr/share/applications/chromium-ungoogled.desktop also kinda defines a browser
take a look:
Code: Select all
xdg-open 'http://www.freedesktop.org/'
look at the source code:
/opt/porteus-scripts/xorg/browser
and
/usr/bin/xdg-open
line 95-101
it shows some connections
- Rava
- Contributor
- Posts: 5415
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
2nd activated browser sets itself as default browser
I did and created a test script:
Code: Select all
root@porteus:~# cp /opt/porteus-scripts/xorg/browser /tmp/browser-test
root@porteus:~# l3afpad /tmp/browser-test
root@porteus:~# diff /opt/porteus-scripts/xorg/browser /tmp/browser-test
11c11
< $browser $*
---
> echo $browser $*
root@porteus:~# /tmp/browser-test
palemoon
root@porteus:~#
Code: Select all
Exec=palemoon %u
Code: Select all
xdg-open https://example.com
Added in 11 minutes 11 seconds:
What the heck, I did not wait but activated the hacked chromium right away:
Code: Select all
root@porteus:/# activate /Porteus_modules/005-chromium-ungoogled-91.0.4472.114-x86_64-en-US-1alien-NO-browser.desktop.xzm
Updating shared library links: /sbin/ldconfig
root@porteus:/# grep Exec /usr/share/applications/browser.desktop
Exec=palemoon %u
root@porteus:/# /tmp/browser-test
palemoon
root@porteus:/# xdg-open https://example.com
(I kept that window open and did not select anything)
and what did double-clicking on an URL in interlink do?
It did open the URL in chromium.
Now, someone tell my why that is.
/tmp/browser-test tells me palemoon is my browser.
So there must be something else going on with a browser module than just /usr/share/applications/browser.desktop - since removing that file and checking via
Code: Select all
grep Exec /usr/share/applications/browser.desktop
Also, my /tmp/browser-test confirms what my browser should be. You see the diff of it compared to what /opt/porteus-scripts/xorg/browser is in the [ code ] snippet above.
Added in 1 hour 25 minutes 48 seconds:
UPDATE
As expected, when deactivating 005-chromium-ungoogled-91.0.4472.114-x86_64-en-US-1alien-NO-browser.desktop.xzm once more, interlink again opens its URLs in palemoon.
Of course /usr/share/applications/browser.desktop and a test via /tmp/browser-test all result in palemoon being my browser.
But these also did say the same when 005-chromium-ungoogled-91.0.4472.114-x86_64-en-US-1alien-NO-browser.desktop.xzm was activated, still chromium was started via interlink during that time and not palemoon as one should expect.
Last edited by Rava on 30 Sep 2022, 03:51, edited 1 time in total.
Reason: typo
Reason: typo
Cheers!
Yours Rava
Yours Rava
-
- Black ninja
- Posts: 62
- Joined: 23 Jul 2022, 07:42
- Distribution: Porteus 5.01_x86_64 Xfce
2nd activated browser sets itself as default browser
it looks like the preferred browser is not configured anyway.Rava wrote:xdg-open https://example.com only results in this window:
Code: Select all
root@azer:~-> xdg-settings get default-web-browser
palemoon.desktop
Code: Select all
root@azer:~-> xdg-settings set default-web-browser palemoon.desktop
Code: Select all
root@azer:~-> xdg-mime query default x-scheme-handler/http
browser.desktop
Code: Select all
root@azer:~-> xdg-mime query default x-scheme-handler/https
browser.desktop
- Rava
- Contributor
- Posts: 5415
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
2nd activated browser sets itself as default browser
It looks like interlink does not care about that.
When only palemoon module is activated, it opens the URLs in palemoon.
When a 2nd browser module got activated and even when that browser has its /usr/share/applications/browser.desktop removed interlink still opens all URLs in the 2nd browser, in my case, in chromium.firefox.desktop
Code: Select all
guest@porteus:/$ xdg-settings get default-web-browser
firefox.desktop
But that xdg-settings can also not be responsible for how interlink acts since there is no firefox.desktop:
Code: Select all
guest@porteus:~$ ls -o /usr/share/applications/firefox.desktop ~/.local/share/applications/firefox.desktop
/bin/ls: cannot access '/usr/share/applications/firefox.desktop': No such file or directory
/bin/ls: cannot access '/home/guest/.local/share/applications/firefox.desktop': No such file or directory
Update
Code: Select all
guest@porteus:~$ xdg-mime query default x-scheme-handler/https
palemoon.desktop
I have to go for now, RL calls, <Arnie voice>I will be back!</Arnie voice> but I will investigate that and the other variants you provided with the 2nd browser activated and without a 2nd browser when I returned…
Thanks a lot for now, itrukrakso.
Cheers!
Yours Rava
Yours Rava
- Rava
- Contributor
- Posts: 5415
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
2nd activated browser sets itself as default browser
These are the settings when only the palemoon browser is active:
Since there is no firefox.desktop - and when interlink uses one of these, it must be the default x-scheme-handler/https / default x-scheme-handler/http .
I will report back when I activated the 005-chromium-ungoogled-105.0.5195.125-x86_64-en-GB-1alien-NO-browser.desktop.xzm once more to see if any of the above did change into chromium.desktop
Code: Select all
guest@porteus:~$ xdg-settings get default-web-browser
firefox.desktop
guest@porteus:~$ xdg-mime query default x-scheme-handler/http
palemoon.desktop
guest@porteus:~$ xdg-mime query default x-scheme-handler/https
palemoon.desktop
I will report back when I activated the 005-chromium-ungoogled-105.0.5195.125-x86_64-en-GB-1alien-NO-browser.desktop.xzm once more to see if any of the above did change into chromium.desktop
Cheers!
Yours Rava
Yours Rava
- Rava
- Contributor
- Posts: 5415
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
2nd activated browser sets itself as default browser
This time I had to activate a Firefox and not a chrome, but with the same issues.
Now following itrukrakso's ideas:
"custom-WebBrowser" - that seems to be the by-its-name non-descriptive .desktop file XFCE uses:
And by its date it was not changed due to the activation of the 2nd browser module, the Firefox one:
I think I try tweaking that script into having palemoon as the 1st choice, that should get PM started instead of this time firefox, and probably /opt/porteus-scripts/xorg/browser was also responsible last time for starting chromium-ungoogled
Added in 3 minutes 47 seconds:
And I have to change more than that or elsewould overwrite my palemoon since right now
browser.desktop got hijacked by firefox…
Now following itrukrakso's ideas:
Code: Select all
guest@porteus:~$ xdg-settings get default-web-browser
custom-WebBrowser.desktop
Code: Select all
guest@porteus:~$ cat ./.local/share/xfce4/helpers/custom-WebBrowser.desktop
[Desktop Entry]
NoDisplay=true
Version=1.0
Encoding=UTF-8
Type=X-XFCE-Helper
X-XFCE-Category=WebBrowser
X-XFCE-CommandsWithParameter=/opt/porteus-scripts/xorg/browser "%s"
Icon=browser
Name=browser
X-XFCE-Commands=/opt/porteus-scripts/xorg/browser
Code: Select all
guest@porteus:~$ ls -o ./.local/share/xfce4/helpers/custom-WebBrowser.desktop
-rwxr-xr-x 1 guest 249 2017-03-05 21:11 ./.local/share/xfce4/helpers/custom-WebBrowser.desktop
Code: Select all
guest@porteus:~$ /opt/porteus-scripts/xorg/browser --version
Mozilla Firefox 91.1.0esr
guest@porteus:~$ file /opt/porteus-scripts/xorg/browser
/opt/porteus-scripts/xorg/browser: POSIX shell script, ASCII text executable
guest@porteus:~$ cat /opt/porteus-scripts/xorg/browser
#!/bin/sh
# Find and run a web browser.
where() { which $1 2>/dev/null; }
browser=`where firefox || where chromium || where chromium-ungoogled || where google-chrome || where google-chrome-stable || where opera || where midori || where konqueror || where palemoon || where basilisk || where vivaldi || where netsurf`
if [ -e /usr/share/applications/browser.desktop ]; then
browser=`awk -F= '/Exec=/{print$NF}' /usr/share/applications/browser.desktop | head -n1 | cut -f 1 -d ' ' `
fi
$browser $*
Added in 3 minutes 47 seconds:
And I have to change more than that or else
Code: Select all
if [ -e /usr/share/applications/browser.desktop ]; then
browser=`awk -F= '/Exec=/{print$NF}' /usr/share/applications/browser.desktop | head -n1 | cut -f 1 -d ' ' `
fi
Code: Select all
guest@porteus:~$ grep Exec /usr/share/applications/browser.desktop
Exec=firefox %u
Cheers!
Yours Rava
Yours Rava
- Rava
- Contributor
- Posts: 5415
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
2nd activated browser sets itself as default browser
Update
This hack is recommend only for people who know what they are doing. Also recall the hack so that you would not complain about your system behaving differently in the future. (The remembering thing is for me to recall as well)
Since I would have to remove every /usr/share/applications/browser.desktop from all alternative browsers but my main one (=palemoon) - including all new ones to be created in the future - I went by a quick'n dirty hack of /opt/porteus-scripts/xorg/browser instead.
This now reads
With a 2nd browser activated that has its /usr/share/applications/browser.desktop intact and thus overwriting the existing /usr/share/applications/browser.desktop this test results in FFx:
when /opt/porteus-scripts/xorg/browser is still reporting PM:
Added in 4 minutes 34 seconds:
While this does help the approach that uses /opt/porteus-scripts/xorg/browser it is not helping with my issue on what gets started by clicking a link in interlink - that still opens FFx.
Therefore most probably another hack is required. But it is too late already to continue, nighty night for now, BRB.
This hack is recommend only for people who know what they are doing. Also recall the hack so that you would not complain about your system behaving differently in the future. (The remembering thing is for me to recall as well)
Since I would have to remove every /usr/share/applications/browser.desktop from all alternative browsers but my main one (=palemoon) - including all new ones to be created in the future - I went by a quick'n dirty hack of /opt/porteus-scripts/xorg/browser instead.
This now reads
Code: Select all
#!/bin/sh
# Find and run a web browser.
if [ -e /usr/share/applications/browser.desktop ]; then
browser=`awk -F= '/Exec=/{print$NF}' /usr/share/applications/browser.desktop | head -n1 | cut -f 1 -d ' ' `
fi
where() { which $1 2>/dev/null; }
browser=`where palemoon || where firefox || where chromium || where chromium-ungoogled || where google-chrome || where google-chrome-stable || where opera || where midori || where konqueror || where basilisk || where vivaldi || where netsurf`
$browser $*
Code: Select all
guest@porteus:~$ awk -F= '/Exec=/{print$NF}' /usr/share/applications/browser.desktop | head -n1 | cut -f 1 -d ' '
firefox
Code: Select all
guest@porteus:~$ /opt/porteus-scripts/xorg/browser --version
Moonchild Productions Pale Moon 31.3.0.1
Added in 4 minutes 34 seconds:
While this does help the approach that uses /opt/porteus-scripts/xorg/browser it is not helping with my issue on what gets started by clicking a link in interlink - that still opens FFx.
Therefore most probably another hack is required. But it is too late already to continue, nighty night for now, BRB.
Cheers!
Yours Rava
Yours Rava
-
- Black ninja
- Posts: 62
- Joined: 23 Jul 2022, 07:42
- Distribution: Porteus 5.01_x86_64 Xfce
2nd activated browser sets itself as default browser
Hi,
and/or
xdg-open and xdg-settings have access to ~/.config/xfce4/helpers.rc
results in
if the same browser is called in browser.desktop it should work (don't forget to restart)
then there is a file helpers.rc in your systemRava wrote:Code: Select all
guest@porteus:~$ xdg-settings get default-web-browser custom-WebBrowser.desktop
Code: Select all
cat /etc/xdg/xfce4/helpers.rc
#
# Default helpers.rc for Xfce's Preferred Applications
#
# Copyright (c) 2005-2006 Benedikt Meurer <benny@xfce.org>
#
WebBrowser=firefox
MailReader=thunderbird
TerminalEmulator=xfce4-terminal
FileManager=thunar
Code: Select all
cat ~/.config/xfce4/helpers.rc
WebBrowser=custom-WebBrowser
Code: Select all
xdg-settings set default-web-browser firefox.desktop
Code: Select all
cat ~/.config/xfce4/helpers.rc
WebBrowser=firefox
- Rava
- Contributor
- Posts: 5415
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
2nd activated browser sets itself as default browser
Unsurprisingly my /etc/xdg/xfce4/helpers.rc is the same as yours.
But by standard bootup, I have neither a firefox,
nor a thunderbird
When I would correct it it should look like so:
Where does your /home/guest/.config/xfce4/helpers.rc come from?
my has no such thing:
I presume /etc/xdg/xfce4/helpers.rc is the global file and ~/.config/xfce4/helpers.rc the local one, and when the local one exists its contents overwrite the ones from the global one?
But by standard bootup, I have neither a firefox,
nor a thunderbird
When I would correct it it should look like so:
Code: Select all
# Default helpers.rc for Xfce's Preferred Applications
#
# tweaked by Rava
WebBrowser=palemoon
MailReader=interlink
TerminalEmulator=xfce4-terminal
FileManager=thunar
Code: Select all
guest@porteus:/p$ cat ~/.config/xfce4/helpers.rc
cat: /home/guest/.config/xfce4/helpers.rc: No such file or directory
Code: Select all
guest@porteus:/$ cat /etc/porteus/003-xfce.ver
003-xfce.xzm:20220925
Code: Select all
guest@porteus:/mnt/live/memory/images$ find . 2>/dev/null|grep xfce4/helpers.rc
./003-xfce-4.16.xzm/etc/xdg/xfce4/helpers.rc
Cheers!
Yours Rava
Yours Rava