View previous topic :: View next topic |
Author |
Message |
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Thu Oct 21, 2021 7:56 pm Post subject: default chrome parameters |
|
|
On one system I use chromium and use /etc/chromium/default to define default parameters. On another system I use chrome but I don't see a way to specify default parameters for chrome. What is the best way to do that? I use xfce and launch chrome with exo-open. |
|
Back to top |
|
|
dbtx Tux's lil' helper
Joined: 20 Jan 2020 Posts: 117
|
Posted: Sun Oct 24, 2021 4:26 pm Post subject: |
|
|
Maybe you could run chrome under dev-util/strace, dump into a log, and search in it for accesses to things in /etc/ and ~ in case there's any substitute for /etc/chromium/default.
But if all you're doing is adjusting commandline options, you can run exo-preferred-applications (Settings->Preferred Applications) and under Web Browser, choose "Other..." and just make up the command line, with "%s" for the URL. It seems to create ~/.local/share/xfce4/helpers/custom-WebBrowser.desktop, and (later) manual edits to the X-XFCE-CommandsWithParameter variable within take effect immediately upon saving it. I don't know if that's strictly the best way, but it works, at least in XFCE 4.14.
P.S. of course that will only work for that one user.
Also, you might have known that clicks don't always go through that setting. While I was fighting with things and trying to figure out Thunderbird won't open Firefox links I found out that dbus has another redundant layer of control here, and I don't know yet exactly how to set its default browser to something-- someday I'll just set it to exo-open or xdg-open and be done.
(semi-OT) But I did find out with some annoyance that if I said yes to Firefox to become the default browser, and later I ran Firefox with some unusual command line options, it asked me again if I wanted it to become the default, apparently because it stores and then asks dbus for the current default and compares the whole command line every time. I feel like it should make a distinction between the program and the arguments, and maybe perhaps possibly ask if I want these things to become the new defaults. In practice, I am mostly against the idea of manipulating persistent settings directly from command lines, especially if it's done opportunistically & automatically, and there's already some of that going around, called "sticky option" or something. It is unpleasant. |
|
Back to top |
|
|
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Mon Oct 25, 2021 4:38 pm Post subject: |
|
|
Incredibly helpful, thank you!
FWIW, here it's Settings->Default Applications. |
|
Back to top |
|
|
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Mon Oct 25, 2021 11:00 pm Post subject: |
|
|
I gave this a try but parameters added to the command line for Web Browser in xfce4-settings-manager Default Applications don't seem to have any effect on the default browser launcher in the panel which uses:
Code: | exo-open --launch WebBrowser %u |
|
|
Back to top |
|
|
dbtx Tux's lil' helper
Joined: 20 Jan 2020 Posts: 117
|
Posted: Tue Oct 26, 2021 11:11 am Post subject: |
|
|
Oh, boy. It seems to be doing a thing again, though I can't easily imagine how or why. In the past, something was weird about the environment inherited by Launcher and/or launched things, so my ordinary PATH wasn't helping it find them and I had to type full paths into custom items. Here, I had clicked links in claws-mail and run exo-open in a terminal but I hadn't tried a launcher.
If I make a Launcher item and drop in the ready-made Web Browser item, then as you said, it fails to use that custom .desktop file. If I edit that Web Browser item and enable "Run in terminal", it runs as expected. Restarting the panel or logging out and back in didn't help, so I suppose there's a real bug. At least, the workaround doesn't pollute with another terminal because exo-open mostly sends a command or signal to something else and exits immediately. |
|
Back to top |
|
|
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Tue Oct 26, 2021 6:36 pm Post subject: |
|
|
The "Run in terminal" workaround works great except for some reason the browser opens to an error page after attempting to load URL "exo-open/". It opens normally without "Run in terminal". Any ideas? |
|
Back to top |
|
|
dbtx Tux's lil' helper
Joined: 20 Jan 2020 Posts: 117
|
Posted: Tue Oct 26, 2021 10:37 pm Post subject: |
|
|
I was looking through exo-0.10.7/exo-open/main.c earlier for any idea of how it loses track of default/preferred applications, and it was like an argument in favor of KISS. To be fair, I didn't check exo-0.12.11 which I'm actually using. Also I did some tests with Launcher to find out how different the environment is, with vs. without a terminal holding it, and it didn't show anything interesting or obviously influential: Code: | $ grep ^[-+] < diff-set
--- panel-set-n 2021-10-26 11:09:26.810817133 -0400
+++ panel-set-y 2021-10-26 11:09:28.967411718 -0400
+ALACRITTY_LOG=/tmp/Alacritty-15318.log
-BASH_SOURCE=([0]="/home/dbtx/bin/without-term")
+BASH_SOURCE=([0]="/home/dbtx/bin/with-term")
+COLORTERM=truecolor
-PPID=5537
+PPID=15318
-TERM=linux
+TERM=xterm-256color
+WINDOWID=73400322
| so it seems my first assumption about launched items getting different environments was wrong and Panel is weird. But just now, I ran Code: | $ exo-open --launch WebBrowser | and Code: | $ exo-open --launch WebBrowser http://0x0.st | and only with the second form it actually used the additional parameters. So on a hunch I tried editing that other line in the .desktop file-- X-XFCE-Commands as opposed to X-XFCE-CommandsWithParameter -- and it worked, the browser got the parameters every time. Apparently that's the command line that gets used by the plain Launcher item as well as the Web Browser item within Applications Menu. It wasn't losing track of default applications-- that was my next wrong assumption. It was using one or the other command line in the same .desktop file. The 'Run in terminal' switch was somehow causing it to use the one I mentioned first, which by default only differs by the presence of a placeholder for a URL, even when there was no URL, and I think that's not good, but whatever. So it looks like you'd only have to add your parameters to both, and of course turn off Run in terminal.
If it still throws errors in Chrome, what is the command line, as in output of Code: | $ ps x | grep chrome | ? |
|
Back to top |
|
|
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Tue Nov 02, 2021 3:36 pm Post subject: |
|
|
Nice find dbtx! Is there GUI access to that line? If I'm following then Settings->Default Applications edits X-XFCE-CommandsWithParameter but we want X-XFCE-Commands? |
|
Back to top |
|
|
dbtx Tux's lil' helper
Joined: 20 Jan 2020 Posts: 117
|
Posted: Tue Nov 02, 2021 5:31 pm Post subject: |
|
|
We want both, because it uses one for exo-open/xdg-open/clicked-links and one for just the Launcher items. And Oh Boy, I may have just sort of figured it out, and it's kind of weird. I'm not sure if it's exactly the same for newer releases but it seems to be, because you already found it wasn't quite working as expected.
First, the Preferred (aka Default) Applications dialog always adds "%s" to the end of whatever command line I type, unless it's already there. If I pick Other... and type in Code: | chrome -extrathing -anotherthing | then, I see Code: | $ grep Commands < .local/share/xfce4/helpers/custom-WebBrowser.desktop
X-XFCE-CommandsWithParameter=chrome -extrathing -anotherthing "%s"
X-XFCE-Commands=chrome -extrathing -anotherthing | and this is exactly what we want. But if the %s is already there-- not just at the end but anywhere on the command line-- then it does Something Else™. If I choose Other... a second time, the contents of that X-XFCE-CommandsWithParameter line appears, complete with "%s", and everything is highlighted, and this is fine. If I change nothing and hit OK, then it strips all the arguments from the X-XFCE-CommandsWithParameter to recreate the X-XFCE-Commands line: Code: | $ grep Commands < .local/share/xfce4/helpers/custom-WebBrowser.desktop
X-XFCE-CommandsWithParameter=chrome -extrathing -anotherthing "%s"
X-XFCE-Commands=chrome |
The way to make it stop doing that and keep your extra arguments is to always delete %s before you hit OK, so it's still on 'Phase One: Add "%s"' and then don't forget to delete %s every time... and file a bug somewhere.
edit: while looking for what to change for a patch, in exo-helper/exo-helper.c I found a reference to XFCE #4093 which seems to be a similar problem. Apparently their fix is actually what enables the workaround I describe, removing %s. And it wouldn't have helped anyone but me-- exo-helper bits have since been moved to xfce4-settings.
edit++: the patch still applied after I changed the filenames and offset. If you want to just force it to use the whole command for everything and leave %s alone: Code: | $ cat /etc/portage/patches/xfce-base/xfce4-settings/mime-helper.diff
--- a/dialogs/mime-settings/xfce-mime-helper.c 2021-11-02 15:09:40.733181736 -0400
+++ b/dialogs/mime-settings/xfce-mime-helper.c 2021-11-02 15:10:38.721057683 -0400
@@ -1180,13 +1180,8 @@
xfce_rc_write_entry (rc, "Name", name);
g_free (name);
- if (strstr (command, "%s") == NULL) {
/* trust the user, they defined the command without a parameter (bug #4093) */
xfce_rc_write_entry (rc, "X-XFCE-Commands", command);
- } else {
- /* use only the binary for the Commands */
- xfce_rc_write_entry (rc, "X-XFCE-Commands", *argv);
- }
/* cleanup */
g_strfreev (argv);
|
P.S. I didn't actually test that at all besides applying it to upstream's tarball. That function xfce_mime_helper_database_set_custom() isn't specific to WebBrowser so it very likely screws up other custom application commands like Terminal. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|