Always launch a program with additional parameters Ubuntu 20.04

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
13 replies · 2K views
dRic2
Gold Member
Messages
887
Reaction score
225
Hi,

Due to a proxy issue I have to launch chromium with this additional requirement to set the right proxy

chromium-browser --proxy-server=http://proxy.myproxy:XXXX

To get things more easy I defined an alias

alias chrome='chromium-browser --proxy-server=http://proxy.myproxy:XXXX'

so now I just type chrome in the command line and it works. However, I would like to launch the application by right-clicking on it instead of typing chrome in the console. Unfortunately, I am not able to set this proxy thing to work if I open chromium by right-clicking on it. I tried to google it but all the main suggestions failed to work for me (for example I was very optimistic with this one https://askubuntu.com/questions/537...n-application-with-specific-parameters-from-u but it didn't work).
 
Last edited by a moderator:
Physics news on Phys.org
The proxy is already set as an environmental variable, but chromium doesn't read it for some reason. It works for every other application though.
 
dRic2 said:
The proxy is already set as an environmental variable, but chromium doesn't read it for some reason. It works for every other application though.
That shouldn't happen.

I am not sure how to set proxy using environment variable, but in the past, I have followed the steps below, and it worked fine for Chrome.

Step 1: Go to Settings.

Step 2: Go to Network on the LHS panel:

1637785577308.png


Step 3: Click on the gear button next to Network Proxy:

1637785645844.png


Step 4: Choose "Manual" and set up the proxy:

1637786083201.png


Step 5: You can just close the windows after setting up. Changes should take place immediately.
 
This is something that Gnome makes unnecessarily difficult (I assume you are on Ubuntu 20.04 or similar): you could consider switching to another flavour of Ubuntu or even a different distro (that doesn't use Canonical's evil snap distributions).

But if you are sticking with Gnome, you can try the instructions here: https://linuxconfig.org/how-to-create-desktop-shortcut-launcher-on-ubuntu-20-04-focal-fossa-linux to create a launcher on your desktop with the right option (I don't know if you can easily change the option in the Gnome menu).

You will have to edit the Exec action to add the proxy option.

Edit: oh, the snap distribution of Chromium doesn't create a desktop launcher, I told you it was evil.
 
Last edited:
@pbuk Shouldn't it be enough to change the proxy on the system level? I generally change launcher entries if they are something specific for that application. If it is something that should be used by all applications throughout the system, shouldn't we first change the system setting, if it is available?
 
@Wrichik Basu if you type in the terminal echo $http_proxy (or $HTTP_PROXY) and it outputs the proxy that you set then your method should be equivalent to mine.

@pbuk yeah... I tried to edit the Exec but it failed 😭
 
  • Informative
Likes   Reactions: Wrichik Basu
Wrichik Basu said:
it worked fine for Chrome.
Yeah, Google make sure Chrome works. Canonical have wrapped the open source Chromium in their proprietory Snap package manager so, it seems, it doesn't. Take it up with Canonical (who own Ubuntu), or walk to a more free distro.
 
  • Informative
Likes   Reactions: Wrichik Basu
pbuk said:
If you have managed to find the one in the Gnome launcher you probably need elevated privileges to edit it.
No I mean, I successfully edited the Exec lines in the chromium.desktop file, but it didn't change anything.
 
dRic2 said:
No I mean, I successfully edited the Exec lines in the chromium.desktop file, but it didn't change anything.
Even when you ran chromium by double-clicking the desktop icon?
 
pbuk said:
Even when you ran chromium by double-clicking the desktop icon?
yep. I will try again tomorrow... I didn't get the chance today.
 
I solved the problem by creating a bash script and placing it on the desktop so that I can simply click on it as it was a shortcut. Everything else failed. Thanks though! :D

[CODE lang="bash" title="launch_cromium.sh"]#!/bin/bash

chromium-bowser --proxy-server="MYPROXY:MYPORT" &
exit[/CODE]
 
  • Like
Likes   Reactions: jim mcnamara and Wrichik Basu