Always launch a program with additional parameters Ubuntu 20.04

In summary, to open chromium with the proxy set, you need to use the --proxy-server option and set the proxy environmental variable.
  • #1
dRic2
Gold Member
883
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:
Technology news on Phys.org
  • #2
Can't you set the proxy in the OS itself? In that way, all applications accessing the internet will use the proxy.
 
  • #3
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.
 
  • #4
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.
 
  • #5
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:
  • #6
@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?
 
  • #7
@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 Wrichik Basu
  • #8
dRic2 said:
@pbuk yeah... I tried to edit the Exec but it failed 😭
If you have managed to find the one in the Gnome launcher you probably need elevated privileges to edit it.
 
  • #9
I use Linux Mint: no Gnome to fight, no nasty snap installations.
 
  • #10
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 Wrichik Basu
  • #11
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.
 
  • #12
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?
 
  • #13
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.
 
  • #14
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

launch_cromium.sh:
#!/bin/bash

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

1. What does it mean to launch a program with additional parameters in Ubuntu 20.04?

Launching a program with additional parameters in Ubuntu 20.04 means adding specific instructions or values that modify how the program behaves when it is run. These parameters can be used to customize the program's behavior or to pass specific information to the program.

2. How do I add additional parameters when launching a program in Ubuntu 20.04?

To add additional parameters when launching a program in Ubuntu 20.04, you can simply add them after the command used to run the program. For example, if the command to run the program is "program_name", you can add parameters like this: "program_name parameter1 parameter2".

3. Can I add multiple parameters when launching a program in Ubuntu 20.04?

Yes, you can add multiple parameters when launching a program in Ubuntu 20.04. Simply separate each parameter with a space after the program's command. For example, "program_name parameter1 parameter2 parameter3".

4. What types of additional parameters can be used when launching a program in Ubuntu 20.04?

The types of additional parameters that can be used when launching a program in Ubuntu 20.04 depend on the program itself. Common types of parameters include flags, options, and values. These can be used to specify settings, enable or disable features, or provide input for the program to use.

5. Are there any risks to using additional parameters when launching a program in Ubuntu 20.04?

Using additional parameters when launching a program in Ubuntu 20.04 may have some risks, depending on the program and the parameters used. For example, some parameters may cause the program to crash if not used correctly. It is always recommended to carefully read the documentation or consult with a professional before using additional parameters.

Similar threads

  • Programming and Computer Science
Replies
1
Views
617
  • Computing and Technology
Replies
1
Views
1K
Replies
6
Views
6K
Replies
7
Views
238
Replies
21
Views
3K
  • Computing and Technology
Replies
4
Views
3K
  • Computing and Technology
Replies
15
Views
4K
Replies
2
Views
2K
  • Programming and Computer Science
Replies
21
Views
5K
Replies
16
Views
2K
Back
Top