Use xdg-open to open a url with a new process2019 Community Moderator ElectionOpen any kind of application with BASHranger: open many files with mplayerOpen file with default program and wait until the app is terminatedMake Firefox use xdg-open for opening filesIs there a FreeDesktop command to open an open-with dialog similar to xdg-open?Is there any way to detect file type and open it with GUI in terminal in Fedora?What program to use to open files? (gnome-open, gvfs-open, xdg-open, etc.)Open url from terminal in chromeLaunch executable with xdg-openOpen any .c file with Sublime Text using a terminal command
Why does a 97 / 92 key piano exist by Bosendorfer?
Capacitor electron flow
Hashing password to increase entropy
What can I do if I am asked to learn different programming languages very frequently?
Would this string work as string?
How do you say "Trust your struggle." in French?
How can I, as DM, avoid the Conga Line of Death occurring when implementing some form of flanking rule?
Non-Borel set in arbitrary metric space
Unfrosted light bulb
Would a primitive species be able to learn English from reading books alone?
Can you take a "free object interaction" while incapacitated?
What is the tangent at a sharp point on a curve?
What (if any) is the reason to buy in small local stores?
1 John in Luther’s Bibel
Travelling in US for more than 90 days
How would a solely written language work mechanically
Mortal danger in mid-grade literature
How can a new country break out from a developed country without war?
Why is "la Gestapo" feminine?
Magnifying glass in hyperbolic space
Air travel with refrigerated insulin
Error in master's thesis, I do not know what to do
What is the period/term used describe Giuseppe Arcimboldo's style of painting?
Friend wants my recommendation but I don't want to give it to him
Use xdg-open to open a url with a new process
2019 Community Moderator ElectionOpen any kind of application with BASHranger: open many files with mplayerOpen file with default program and wait until the app is terminatedMake Firefox use xdg-open for opening filesIs there a FreeDesktop command to open an open-with dialog similar to xdg-open?Is there any way to detect file type and open it with GUI in terminal in Fedora?What program to use to open files? (gnome-open, gvfs-open, xdg-open, etc.)Open url from terminal in chromeLaunch executable with xdg-openOpen any .c file with Sublime Text using a terminal command
I'm starting to experiment with Crunchbang (which is based on Debian, and uses terminator) as a web development environment, and one of the things I am struggling with is the behaviour of xdg-open
. I come from an OSX background, so forgive me if this question comes off as dense.
I would like to be able to open a url with xdg-open http://www.google.com
and then continue to use the same terminal window to work (it's how open
functions in OSX). Right now, using xdg-open
occupies the current tab/session until I close browser window, or manually end things with ctrl + c
. I'd much prefer it start a new process, that way I can open up a URL, refer to data on the page, and use it in the same tab/window without needing to open an additional one.
command-line file-opening
add a comment |
I'm starting to experiment with Crunchbang (which is based on Debian, and uses terminator) as a web development environment, and one of the things I am struggling with is the behaviour of xdg-open
. I come from an OSX background, so forgive me if this question comes off as dense.
I would like to be able to open a url with xdg-open http://www.google.com
and then continue to use the same terminal window to work (it's how open
functions in OSX). Right now, using xdg-open
occupies the current tab/session until I close browser window, or manually end things with ctrl + c
. I'd much prefer it start a new process, that way I can open up a URL, refer to data on the page, and use it in the same tab/window without needing to open an additional one.
command-line file-opening
What web browser are you using?
– Cristian Ciupitu
Jul 30 '14 at 18:46
add a comment |
I'm starting to experiment with Crunchbang (which is based on Debian, and uses terminator) as a web development environment, and one of the things I am struggling with is the behaviour of xdg-open
. I come from an OSX background, so forgive me if this question comes off as dense.
I would like to be able to open a url with xdg-open http://www.google.com
and then continue to use the same terminal window to work (it's how open
functions in OSX). Right now, using xdg-open
occupies the current tab/session until I close browser window, or manually end things with ctrl + c
. I'd much prefer it start a new process, that way I can open up a URL, refer to data on the page, and use it in the same tab/window without needing to open an additional one.
command-line file-opening
I'm starting to experiment with Crunchbang (which is based on Debian, and uses terminator) as a web development environment, and one of the things I am struggling with is the behaviour of xdg-open
. I come from an OSX background, so forgive me if this question comes off as dense.
I would like to be able to open a url with xdg-open http://www.google.com
and then continue to use the same terminal window to work (it's how open
functions in OSX). Right now, using xdg-open
occupies the current tab/session until I close browser window, or manually end things with ctrl + c
. I'd much prefer it start a new process, that way I can open up a URL, refer to data on the page, and use it in the same tab/window without needing to open an additional one.
command-line file-opening
command-line file-opening
edited May 7 '13 at 19:24
Nick Tomlin
asked May 3 '13 at 18:55
Nick TomlinNick Tomlin
232139
232139
What web browser are you using?
– Cristian Ciupitu
Jul 30 '14 at 18:46
add a comment |
What web browser are you using?
– Cristian Ciupitu
Jul 30 '14 at 18:46
What web browser are you using?
– Cristian Ciupitu
Jul 30 '14 at 18:46
What web browser are you using?
– Cristian Ciupitu
Jul 30 '14 at 18:46
add a comment |
6 Answers
6
active
oldest
votes
Strange, it works like that out of the box on my Debian. Try running it in the background:
xdg-open http://www.google.com &
You can make this into a function by adding these lines to your ~/.bashrc
file:
function open ()
xdg-open "$*" &
You can then simply run open http://www.google.com
and it will run in the background.
1
This works great. I was hoping to have a simple alias to toopen
, (i.e. open='xdg-open') is there a way to get the functionality ofxdg-open <url> &
without using a shell function?
– Nick Tomlin
May 7 '13 at 19:27
@NickTomlin Not as far as I know, no, but what have you got against functions? As you can see in my updated answer it is almost as simple as an alias.
– terdon♦
May 7 '13 at 20:07
Not a particular bias, I was hoping to avoid a function since I am trying to use (and reuse) the same alias for both Mac OS and *nix flavors.
– Nick Tomlin
May 7 '13 at 20:20
No reason why you couldn't. Functions depend on the shell, as long as you use bash in all systems in question it should work perfectly well.
– terdon♦
May 7 '13 at 20:23
It works out of the box on Fedora 20 too.
– Cristian Ciupitu
Jul 30 '14 at 18:47
add a comment |
If you want to detach the process from the current shell rather than starting it as a background job with xdg-open http://www.google.com &
, I like the detach
utility:
detach xdg-open http://www.google.com
One could create an alias for this. I like detach
over nohup
as closes stdin stdout and stderr by default so its invocation is cleaner.
2
Alas,detach
does not seem to exist in my distro.nohup
launches the process, but still occupies the terminal window.
– Nick Tomlin
May 7 '13 at 19:25
detach
is not in my distro either; but python can handle opening URLs and detaching:python -m webbrowser -t "http://example.com"
. This should work out-of-the box on almost all somewhat-recent distros of linux.
– Krets
Jul 10 '17 at 11:21
Althoughdetach
is not even in the AUR, it proved easy to install from source and furthermore was the only program that achieved what I wanted. (the alternatives listed here and on thedetach
website don't allow closing the shell as long asxdg-open
is running, or at leastdetach
did not make my shell complain one bit)
– rien333
Aug 13 '18 at 13:40
add a comment |
xdg-open
waits for the program to finish. This is by design. If the program is a text mode program, it has to stay in the foreground in the terminal. Even if the program is a GUI one, this behavior is useful in case xdg-open
is used from a script and the script wants to perform something after the file has been edited (e.g. send the new version somewhere or otherwise make something with the new version).
If you don't want to wait, run xdg-open
in the background. You can run any shell command in the background by putting an ampersand at the end.
xdg-open http://www.google.com &
With some programs, xdg-open
returns immediately. What happens is actually that the program that xdg-open
invokes returns immediately. This typically happens with GUI programs that open all files in a single instance: when you start them a second time, they send a message the running instance to tell it to open the file, and exit immediately.
how do such applications implement single instance policy? DBus is one way i know of but is there 'xdg' way of implementing this?
– PnotNP
Mar 16 '16 at 4:17
@NulledPointer Lock files, X11 window messages, D-Bus, … I suppose D-Bus is the “standard” Freedesktop way but I don't know if there is a formal specification for this.
– Gilles
Mar 16 '16 at 10:10
1
On my Ubuntu 16.04 system, xdg-open always returns immediately. For my current application, I would actually prefer that it blocks. Where does your "xdg-open waits for the program to finish. This is by design." information come from?
– Charl Botha
Feb 24 '17 at 11:10
@CharlBothaxdg-open
returns immediately (I can confirm that on Ubuntu 16.04), but the program it invokes may move to the background. For example, on my system,xdg-open
invokes Evince for PDF files;evince foo.pdf
blocks until you close the PDF file, unless the PDF is already open, in which case the secondevince
process started byxdg-open
focuses the existing instance and exits.xdg-open
has no control over that, unless there's a way to make the program keep a running process.
– Gilles
Feb 24 '17 at 13:07
add a comment |
Try this:
DISPLAY=:0.0; xdg-open '<url>'
I use this technique to en-queue magnet:// URLs into my Bit Torrent client Vuze.
ssh someserver "DISPLAY=:0.0; xdg-open 'http://www.google.com/'"
The single quotes help to protect the contents of the URLs so that the shell doesn't attempt to interpret them.
This still keeps the process running in the current terminal window. Let me know if I need to clarify my question.
– Nick Tomlin
May 7 '13 at 19:29
Yeah, if you want it to go background immediately then just put it to the background with a ampersand "&". Isn't that @terdon's answer said to do?
– slm♦
May 7 '13 at 19:37
The issue here isn't xdg-open, see @Gilles answer, he explains why xdg-open is being held up, it's the GUI you're sending the URL to which is causing xdg-open to wait.
– slm♦
May 7 '13 at 19:47
What browser are you sending the URL to? Is there a dialog box or anything else being popped when you send the URLs w/xdg-open
? Seems like several of the answerers here have indicated that the normal behavior is that control is returned to the terminal after some period of time.
– slm♦
May 7 '13 at 19:52
thanks for the clarification. I've reviewed the answers and I understand this better now. The browser is iceweasal.
– Nick Tomlin
May 7 '13 at 19:55
|
show 1 more comment
If you need to open web pages from command line (loop), you can just open the browser before starting the script.
In this case it doesn't wait for browser to be closed after the first link, but opens them all in new tabs.
add a comment |
As today, none of those options did work for me.
I am total aware that the OP said "use xdg-open", sorry in advance.
I've ended up doing a dead-simple chrome https://google.es --new-window || chromium https://google.es --new-window || firefox https://google.es
.
If you don't have any of those 3 browsers, then just feel free to use the right ones with your preference of order.
Note: Firefox did open a new window without add anything. Case doesn't work seamessly for you, use firefox https://google.es -new-instance -new-window
. Note that is just one -
for firefox flags.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f74605%2fuse-xdg-open-to-open-a-url-with-a-new-process%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
Strange, it works like that out of the box on my Debian. Try running it in the background:
xdg-open http://www.google.com &
You can make this into a function by adding these lines to your ~/.bashrc
file:
function open ()
xdg-open "$*" &
You can then simply run open http://www.google.com
and it will run in the background.
1
This works great. I was hoping to have a simple alias to toopen
, (i.e. open='xdg-open') is there a way to get the functionality ofxdg-open <url> &
without using a shell function?
– Nick Tomlin
May 7 '13 at 19:27
@NickTomlin Not as far as I know, no, but what have you got against functions? As you can see in my updated answer it is almost as simple as an alias.
– terdon♦
May 7 '13 at 20:07
Not a particular bias, I was hoping to avoid a function since I am trying to use (and reuse) the same alias for both Mac OS and *nix flavors.
– Nick Tomlin
May 7 '13 at 20:20
No reason why you couldn't. Functions depend on the shell, as long as you use bash in all systems in question it should work perfectly well.
– terdon♦
May 7 '13 at 20:23
It works out of the box on Fedora 20 too.
– Cristian Ciupitu
Jul 30 '14 at 18:47
add a comment |
Strange, it works like that out of the box on my Debian. Try running it in the background:
xdg-open http://www.google.com &
You can make this into a function by adding these lines to your ~/.bashrc
file:
function open ()
xdg-open "$*" &
You can then simply run open http://www.google.com
and it will run in the background.
1
This works great. I was hoping to have a simple alias to toopen
, (i.e. open='xdg-open') is there a way to get the functionality ofxdg-open <url> &
without using a shell function?
– Nick Tomlin
May 7 '13 at 19:27
@NickTomlin Not as far as I know, no, but what have you got against functions? As you can see in my updated answer it is almost as simple as an alias.
– terdon♦
May 7 '13 at 20:07
Not a particular bias, I was hoping to avoid a function since I am trying to use (and reuse) the same alias for both Mac OS and *nix flavors.
– Nick Tomlin
May 7 '13 at 20:20
No reason why you couldn't. Functions depend on the shell, as long as you use bash in all systems in question it should work perfectly well.
– terdon♦
May 7 '13 at 20:23
It works out of the box on Fedora 20 too.
– Cristian Ciupitu
Jul 30 '14 at 18:47
add a comment |
Strange, it works like that out of the box on my Debian. Try running it in the background:
xdg-open http://www.google.com &
You can make this into a function by adding these lines to your ~/.bashrc
file:
function open ()
xdg-open "$*" &
You can then simply run open http://www.google.com
and it will run in the background.
Strange, it works like that out of the box on my Debian. Try running it in the background:
xdg-open http://www.google.com &
You can make this into a function by adding these lines to your ~/.bashrc
file:
function open ()
xdg-open "$*" &
You can then simply run open http://www.google.com
and it will run in the background.
edited Aug 1 '14 at 0:18
answered May 3 '13 at 19:28
terdon♦terdon
132k32262441
132k32262441
1
This works great. I was hoping to have a simple alias to toopen
, (i.e. open='xdg-open') is there a way to get the functionality ofxdg-open <url> &
without using a shell function?
– Nick Tomlin
May 7 '13 at 19:27
@NickTomlin Not as far as I know, no, but what have you got against functions? As you can see in my updated answer it is almost as simple as an alias.
– terdon♦
May 7 '13 at 20:07
Not a particular bias, I was hoping to avoid a function since I am trying to use (and reuse) the same alias for both Mac OS and *nix flavors.
– Nick Tomlin
May 7 '13 at 20:20
No reason why you couldn't. Functions depend on the shell, as long as you use bash in all systems in question it should work perfectly well.
– terdon♦
May 7 '13 at 20:23
It works out of the box on Fedora 20 too.
– Cristian Ciupitu
Jul 30 '14 at 18:47
add a comment |
1
This works great. I was hoping to have a simple alias to toopen
, (i.e. open='xdg-open') is there a way to get the functionality ofxdg-open <url> &
without using a shell function?
– Nick Tomlin
May 7 '13 at 19:27
@NickTomlin Not as far as I know, no, but what have you got against functions? As you can see in my updated answer it is almost as simple as an alias.
– terdon♦
May 7 '13 at 20:07
Not a particular bias, I was hoping to avoid a function since I am trying to use (and reuse) the same alias for both Mac OS and *nix flavors.
– Nick Tomlin
May 7 '13 at 20:20
No reason why you couldn't. Functions depend on the shell, as long as you use bash in all systems in question it should work perfectly well.
– terdon♦
May 7 '13 at 20:23
It works out of the box on Fedora 20 too.
– Cristian Ciupitu
Jul 30 '14 at 18:47
1
1
This works great. I was hoping to have a simple alias to to
open
, (i.e. open='xdg-open') is there a way to get the functionality of xdg-open <url> &
without using a shell function?– Nick Tomlin
May 7 '13 at 19:27
This works great. I was hoping to have a simple alias to to
open
, (i.e. open='xdg-open') is there a way to get the functionality of xdg-open <url> &
without using a shell function?– Nick Tomlin
May 7 '13 at 19:27
@NickTomlin Not as far as I know, no, but what have you got against functions? As you can see in my updated answer it is almost as simple as an alias.
– terdon♦
May 7 '13 at 20:07
@NickTomlin Not as far as I know, no, but what have you got against functions? As you can see in my updated answer it is almost as simple as an alias.
– terdon♦
May 7 '13 at 20:07
Not a particular bias, I was hoping to avoid a function since I am trying to use (and reuse) the same alias for both Mac OS and *nix flavors.
– Nick Tomlin
May 7 '13 at 20:20
Not a particular bias, I was hoping to avoid a function since I am trying to use (and reuse) the same alias for both Mac OS and *nix flavors.
– Nick Tomlin
May 7 '13 at 20:20
No reason why you couldn't. Functions depend on the shell, as long as you use bash in all systems in question it should work perfectly well.
– terdon♦
May 7 '13 at 20:23
No reason why you couldn't. Functions depend on the shell, as long as you use bash in all systems in question it should work perfectly well.
– terdon♦
May 7 '13 at 20:23
It works out of the box on Fedora 20 too.
– Cristian Ciupitu
Jul 30 '14 at 18:47
It works out of the box on Fedora 20 too.
– Cristian Ciupitu
Jul 30 '14 at 18:47
add a comment |
If you want to detach the process from the current shell rather than starting it as a background job with xdg-open http://www.google.com &
, I like the detach
utility:
detach xdg-open http://www.google.com
One could create an alias for this. I like detach
over nohup
as closes stdin stdout and stderr by default so its invocation is cleaner.
2
Alas,detach
does not seem to exist in my distro.nohup
launches the process, but still occupies the terminal window.
– Nick Tomlin
May 7 '13 at 19:25
detach
is not in my distro either; but python can handle opening URLs and detaching:python -m webbrowser -t "http://example.com"
. This should work out-of-the box on almost all somewhat-recent distros of linux.
– Krets
Jul 10 '17 at 11:21
Althoughdetach
is not even in the AUR, it proved easy to install from source and furthermore was the only program that achieved what I wanted. (the alternatives listed here and on thedetach
website don't allow closing the shell as long asxdg-open
is running, or at leastdetach
did not make my shell complain one bit)
– rien333
Aug 13 '18 at 13:40
add a comment |
If you want to detach the process from the current shell rather than starting it as a background job with xdg-open http://www.google.com &
, I like the detach
utility:
detach xdg-open http://www.google.com
One could create an alias for this. I like detach
over nohup
as closes stdin stdout and stderr by default so its invocation is cleaner.
2
Alas,detach
does not seem to exist in my distro.nohup
launches the process, but still occupies the terminal window.
– Nick Tomlin
May 7 '13 at 19:25
detach
is not in my distro either; but python can handle opening URLs and detaching:python -m webbrowser -t "http://example.com"
. This should work out-of-the box on almost all somewhat-recent distros of linux.
– Krets
Jul 10 '17 at 11:21
Althoughdetach
is not even in the AUR, it proved easy to install from source and furthermore was the only program that achieved what I wanted. (the alternatives listed here and on thedetach
website don't allow closing the shell as long asxdg-open
is running, or at leastdetach
did not make my shell complain one bit)
– rien333
Aug 13 '18 at 13:40
add a comment |
If you want to detach the process from the current shell rather than starting it as a background job with xdg-open http://www.google.com &
, I like the detach
utility:
detach xdg-open http://www.google.com
One could create an alias for this. I like detach
over nohup
as closes stdin stdout and stderr by default so its invocation is cleaner.
If you want to detach the process from the current shell rather than starting it as a background job with xdg-open http://www.google.com &
, I like the detach
utility:
detach xdg-open http://www.google.com
One could create an alias for this. I like detach
over nohup
as closes stdin stdout and stderr by default so its invocation is cleaner.
answered May 3 '13 at 23:40
Dan D.Dan D.
335412
335412
2
Alas,detach
does not seem to exist in my distro.nohup
launches the process, but still occupies the terminal window.
– Nick Tomlin
May 7 '13 at 19:25
detach
is not in my distro either; but python can handle opening URLs and detaching:python -m webbrowser -t "http://example.com"
. This should work out-of-the box on almost all somewhat-recent distros of linux.
– Krets
Jul 10 '17 at 11:21
Althoughdetach
is not even in the AUR, it proved easy to install from source and furthermore was the only program that achieved what I wanted. (the alternatives listed here and on thedetach
website don't allow closing the shell as long asxdg-open
is running, or at leastdetach
did not make my shell complain one bit)
– rien333
Aug 13 '18 at 13:40
add a comment |
2
Alas,detach
does not seem to exist in my distro.nohup
launches the process, but still occupies the terminal window.
– Nick Tomlin
May 7 '13 at 19:25
detach
is not in my distro either; but python can handle opening URLs and detaching:python -m webbrowser -t "http://example.com"
. This should work out-of-the box on almost all somewhat-recent distros of linux.
– Krets
Jul 10 '17 at 11:21
Althoughdetach
is not even in the AUR, it proved easy to install from source and furthermore was the only program that achieved what I wanted. (the alternatives listed here and on thedetach
website don't allow closing the shell as long asxdg-open
is running, or at leastdetach
did not make my shell complain one bit)
– rien333
Aug 13 '18 at 13:40
2
2
Alas,
detach
does not seem to exist in my distro. nohup
launches the process, but still occupies the terminal window.– Nick Tomlin
May 7 '13 at 19:25
Alas,
detach
does not seem to exist in my distro. nohup
launches the process, but still occupies the terminal window.– Nick Tomlin
May 7 '13 at 19:25
detach
is not in my distro either; but python can handle opening URLs and detaching: python -m webbrowser -t "http://example.com"
. This should work out-of-the box on almost all somewhat-recent distros of linux.– Krets
Jul 10 '17 at 11:21
detach
is not in my distro either; but python can handle opening URLs and detaching: python -m webbrowser -t "http://example.com"
. This should work out-of-the box on almost all somewhat-recent distros of linux.– Krets
Jul 10 '17 at 11:21
Although
detach
is not even in the AUR, it proved easy to install from source and furthermore was the only program that achieved what I wanted. (the alternatives listed here and on the detach
website don't allow closing the shell as long as xdg-open
is running, or at least detach
did not make my shell complain one bit)– rien333
Aug 13 '18 at 13:40
Although
detach
is not even in the AUR, it proved easy to install from source and furthermore was the only program that achieved what I wanted. (the alternatives listed here and on the detach
website don't allow closing the shell as long as xdg-open
is running, or at least detach
did not make my shell complain one bit)– rien333
Aug 13 '18 at 13:40
add a comment |
xdg-open
waits for the program to finish. This is by design. If the program is a text mode program, it has to stay in the foreground in the terminal. Even if the program is a GUI one, this behavior is useful in case xdg-open
is used from a script and the script wants to perform something after the file has been edited (e.g. send the new version somewhere or otherwise make something with the new version).
If you don't want to wait, run xdg-open
in the background. You can run any shell command in the background by putting an ampersand at the end.
xdg-open http://www.google.com &
With some programs, xdg-open
returns immediately. What happens is actually that the program that xdg-open
invokes returns immediately. This typically happens with GUI programs that open all files in a single instance: when you start them a second time, they send a message the running instance to tell it to open the file, and exit immediately.
how do such applications implement single instance policy? DBus is one way i know of but is there 'xdg' way of implementing this?
– PnotNP
Mar 16 '16 at 4:17
@NulledPointer Lock files, X11 window messages, D-Bus, … I suppose D-Bus is the “standard” Freedesktop way but I don't know if there is a formal specification for this.
– Gilles
Mar 16 '16 at 10:10
1
On my Ubuntu 16.04 system, xdg-open always returns immediately. For my current application, I would actually prefer that it blocks. Where does your "xdg-open waits for the program to finish. This is by design." information come from?
– Charl Botha
Feb 24 '17 at 11:10
@CharlBothaxdg-open
returns immediately (I can confirm that on Ubuntu 16.04), but the program it invokes may move to the background. For example, on my system,xdg-open
invokes Evince for PDF files;evince foo.pdf
blocks until you close the PDF file, unless the PDF is already open, in which case the secondevince
process started byxdg-open
focuses the existing instance and exits.xdg-open
has no control over that, unless there's a way to make the program keep a running process.
– Gilles
Feb 24 '17 at 13:07
add a comment |
xdg-open
waits for the program to finish. This is by design. If the program is a text mode program, it has to stay in the foreground in the terminal. Even if the program is a GUI one, this behavior is useful in case xdg-open
is used from a script and the script wants to perform something after the file has been edited (e.g. send the new version somewhere or otherwise make something with the new version).
If you don't want to wait, run xdg-open
in the background. You can run any shell command in the background by putting an ampersand at the end.
xdg-open http://www.google.com &
With some programs, xdg-open
returns immediately. What happens is actually that the program that xdg-open
invokes returns immediately. This typically happens with GUI programs that open all files in a single instance: when you start them a second time, they send a message the running instance to tell it to open the file, and exit immediately.
how do such applications implement single instance policy? DBus is one way i know of but is there 'xdg' way of implementing this?
– PnotNP
Mar 16 '16 at 4:17
@NulledPointer Lock files, X11 window messages, D-Bus, … I suppose D-Bus is the “standard” Freedesktop way but I don't know if there is a formal specification for this.
– Gilles
Mar 16 '16 at 10:10
1
On my Ubuntu 16.04 system, xdg-open always returns immediately. For my current application, I would actually prefer that it blocks. Where does your "xdg-open waits for the program to finish. This is by design." information come from?
– Charl Botha
Feb 24 '17 at 11:10
@CharlBothaxdg-open
returns immediately (I can confirm that on Ubuntu 16.04), but the program it invokes may move to the background. For example, on my system,xdg-open
invokes Evince for PDF files;evince foo.pdf
blocks until you close the PDF file, unless the PDF is already open, in which case the secondevince
process started byxdg-open
focuses the existing instance and exits.xdg-open
has no control over that, unless there's a way to make the program keep a running process.
– Gilles
Feb 24 '17 at 13:07
add a comment |
xdg-open
waits for the program to finish. This is by design. If the program is a text mode program, it has to stay in the foreground in the terminal. Even if the program is a GUI one, this behavior is useful in case xdg-open
is used from a script and the script wants to perform something after the file has been edited (e.g. send the new version somewhere or otherwise make something with the new version).
If you don't want to wait, run xdg-open
in the background. You can run any shell command in the background by putting an ampersand at the end.
xdg-open http://www.google.com &
With some programs, xdg-open
returns immediately. What happens is actually that the program that xdg-open
invokes returns immediately. This typically happens with GUI programs that open all files in a single instance: when you start them a second time, they send a message the running instance to tell it to open the file, and exit immediately.
xdg-open
waits for the program to finish. This is by design. If the program is a text mode program, it has to stay in the foreground in the terminal. Even if the program is a GUI one, this behavior is useful in case xdg-open
is used from a script and the script wants to perform something after the file has been edited (e.g. send the new version somewhere or otherwise make something with the new version).
If you don't want to wait, run xdg-open
in the background. You can run any shell command in the background by putting an ampersand at the end.
xdg-open http://www.google.com &
With some programs, xdg-open
returns immediately. What happens is actually that the program that xdg-open
invokes returns immediately. This typically happens with GUI programs that open all files in a single instance: when you start them a second time, they send a message the running instance to tell it to open the file, and exit immediately.
answered May 4 '13 at 0:41
GillesGilles
543k12811001617
543k12811001617
how do such applications implement single instance policy? DBus is one way i know of but is there 'xdg' way of implementing this?
– PnotNP
Mar 16 '16 at 4:17
@NulledPointer Lock files, X11 window messages, D-Bus, … I suppose D-Bus is the “standard” Freedesktop way but I don't know if there is a formal specification for this.
– Gilles
Mar 16 '16 at 10:10
1
On my Ubuntu 16.04 system, xdg-open always returns immediately. For my current application, I would actually prefer that it blocks. Where does your "xdg-open waits for the program to finish. This is by design." information come from?
– Charl Botha
Feb 24 '17 at 11:10
@CharlBothaxdg-open
returns immediately (I can confirm that on Ubuntu 16.04), but the program it invokes may move to the background. For example, on my system,xdg-open
invokes Evince for PDF files;evince foo.pdf
blocks until you close the PDF file, unless the PDF is already open, in which case the secondevince
process started byxdg-open
focuses the existing instance and exits.xdg-open
has no control over that, unless there's a way to make the program keep a running process.
– Gilles
Feb 24 '17 at 13:07
add a comment |
how do such applications implement single instance policy? DBus is one way i know of but is there 'xdg' way of implementing this?
– PnotNP
Mar 16 '16 at 4:17
@NulledPointer Lock files, X11 window messages, D-Bus, … I suppose D-Bus is the “standard” Freedesktop way but I don't know if there is a formal specification for this.
– Gilles
Mar 16 '16 at 10:10
1
On my Ubuntu 16.04 system, xdg-open always returns immediately. For my current application, I would actually prefer that it blocks. Where does your "xdg-open waits for the program to finish. This is by design." information come from?
– Charl Botha
Feb 24 '17 at 11:10
@CharlBothaxdg-open
returns immediately (I can confirm that on Ubuntu 16.04), but the program it invokes may move to the background. For example, on my system,xdg-open
invokes Evince for PDF files;evince foo.pdf
blocks until you close the PDF file, unless the PDF is already open, in which case the secondevince
process started byxdg-open
focuses the existing instance and exits.xdg-open
has no control over that, unless there's a way to make the program keep a running process.
– Gilles
Feb 24 '17 at 13:07
how do such applications implement single instance policy? DBus is one way i know of but is there 'xdg' way of implementing this?
– PnotNP
Mar 16 '16 at 4:17
how do such applications implement single instance policy? DBus is one way i know of but is there 'xdg' way of implementing this?
– PnotNP
Mar 16 '16 at 4:17
@NulledPointer Lock files, X11 window messages, D-Bus, … I suppose D-Bus is the “standard” Freedesktop way but I don't know if there is a formal specification for this.
– Gilles
Mar 16 '16 at 10:10
@NulledPointer Lock files, X11 window messages, D-Bus, … I suppose D-Bus is the “standard” Freedesktop way but I don't know if there is a formal specification for this.
– Gilles
Mar 16 '16 at 10:10
1
1
On my Ubuntu 16.04 system, xdg-open always returns immediately. For my current application, I would actually prefer that it blocks. Where does your "xdg-open waits for the program to finish. This is by design." information come from?
– Charl Botha
Feb 24 '17 at 11:10
On my Ubuntu 16.04 system, xdg-open always returns immediately. For my current application, I would actually prefer that it blocks. Where does your "xdg-open waits for the program to finish. This is by design." information come from?
– Charl Botha
Feb 24 '17 at 11:10
@CharlBotha
xdg-open
returns immediately (I can confirm that on Ubuntu 16.04), but the program it invokes may move to the background. For example, on my system, xdg-open
invokes Evince for PDF files; evince foo.pdf
blocks until you close the PDF file, unless the PDF is already open, in which case the second evince
process started by xdg-open
focuses the existing instance and exits. xdg-open
has no control over that, unless there's a way to make the program keep a running process.– Gilles
Feb 24 '17 at 13:07
@CharlBotha
xdg-open
returns immediately (I can confirm that on Ubuntu 16.04), but the program it invokes may move to the background. For example, on my system, xdg-open
invokes Evince for PDF files; evince foo.pdf
blocks until you close the PDF file, unless the PDF is already open, in which case the second evince
process started by xdg-open
focuses the existing instance and exits. xdg-open
has no control over that, unless there's a way to make the program keep a running process.– Gilles
Feb 24 '17 at 13:07
add a comment |
Try this:
DISPLAY=:0.0; xdg-open '<url>'
I use this technique to en-queue magnet:// URLs into my Bit Torrent client Vuze.
ssh someserver "DISPLAY=:0.0; xdg-open 'http://www.google.com/'"
The single quotes help to protect the contents of the URLs so that the shell doesn't attempt to interpret them.
This still keeps the process running in the current terminal window. Let me know if I need to clarify my question.
– Nick Tomlin
May 7 '13 at 19:29
Yeah, if you want it to go background immediately then just put it to the background with a ampersand "&". Isn't that @terdon's answer said to do?
– slm♦
May 7 '13 at 19:37
The issue here isn't xdg-open, see @Gilles answer, he explains why xdg-open is being held up, it's the GUI you're sending the URL to which is causing xdg-open to wait.
– slm♦
May 7 '13 at 19:47
What browser are you sending the URL to? Is there a dialog box or anything else being popped when you send the URLs w/xdg-open
? Seems like several of the answerers here have indicated that the normal behavior is that control is returned to the terminal after some period of time.
– slm♦
May 7 '13 at 19:52
thanks for the clarification. I've reviewed the answers and I understand this better now. The browser is iceweasal.
– Nick Tomlin
May 7 '13 at 19:55
|
show 1 more comment
Try this:
DISPLAY=:0.0; xdg-open '<url>'
I use this technique to en-queue magnet:// URLs into my Bit Torrent client Vuze.
ssh someserver "DISPLAY=:0.0; xdg-open 'http://www.google.com/'"
The single quotes help to protect the contents of the URLs so that the shell doesn't attempt to interpret them.
This still keeps the process running in the current terminal window. Let me know if I need to clarify my question.
– Nick Tomlin
May 7 '13 at 19:29
Yeah, if you want it to go background immediately then just put it to the background with a ampersand "&". Isn't that @terdon's answer said to do?
– slm♦
May 7 '13 at 19:37
The issue here isn't xdg-open, see @Gilles answer, he explains why xdg-open is being held up, it's the GUI you're sending the URL to which is causing xdg-open to wait.
– slm♦
May 7 '13 at 19:47
What browser are you sending the URL to? Is there a dialog box or anything else being popped when you send the URLs w/xdg-open
? Seems like several of the answerers here have indicated that the normal behavior is that control is returned to the terminal after some period of time.
– slm♦
May 7 '13 at 19:52
thanks for the clarification. I've reviewed the answers and I understand this better now. The browser is iceweasal.
– Nick Tomlin
May 7 '13 at 19:55
|
show 1 more comment
Try this:
DISPLAY=:0.0; xdg-open '<url>'
I use this technique to en-queue magnet:// URLs into my Bit Torrent client Vuze.
ssh someserver "DISPLAY=:0.0; xdg-open 'http://www.google.com/'"
The single quotes help to protect the contents of the URLs so that the shell doesn't attempt to interpret them.
Try this:
DISPLAY=:0.0; xdg-open '<url>'
I use this technique to en-queue magnet:// URLs into my Bit Torrent client Vuze.
ssh someserver "DISPLAY=:0.0; xdg-open 'http://www.google.com/'"
The single quotes help to protect the contents of the URLs so that the shell doesn't attempt to interpret them.
answered May 3 '13 at 19:15
slm♦slm
254k71537687
254k71537687
This still keeps the process running in the current terminal window. Let me know if I need to clarify my question.
– Nick Tomlin
May 7 '13 at 19:29
Yeah, if you want it to go background immediately then just put it to the background with a ampersand "&". Isn't that @terdon's answer said to do?
– slm♦
May 7 '13 at 19:37
The issue here isn't xdg-open, see @Gilles answer, he explains why xdg-open is being held up, it's the GUI you're sending the URL to which is causing xdg-open to wait.
– slm♦
May 7 '13 at 19:47
What browser are you sending the URL to? Is there a dialog box or anything else being popped when you send the URLs w/xdg-open
? Seems like several of the answerers here have indicated that the normal behavior is that control is returned to the terminal after some period of time.
– slm♦
May 7 '13 at 19:52
thanks for the clarification. I've reviewed the answers and I understand this better now. The browser is iceweasal.
– Nick Tomlin
May 7 '13 at 19:55
|
show 1 more comment
This still keeps the process running in the current terminal window. Let me know if I need to clarify my question.
– Nick Tomlin
May 7 '13 at 19:29
Yeah, if you want it to go background immediately then just put it to the background with a ampersand "&". Isn't that @terdon's answer said to do?
– slm♦
May 7 '13 at 19:37
The issue here isn't xdg-open, see @Gilles answer, he explains why xdg-open is being held up, it's the GUI you're sending the URL to which is causing xdg-open to wait.
– slm♦
May 7 '13 at 19:47
What browser are you sending the URL to? Is there a dialog box or anything else being popped when you send the URLs w/xdg-open
? Seems like several of the answerers here have indicated that the normal behavior is that control is returned to the terminal after some period of time.
– slm♦
May 7 '13 at 19:52
thanks for the clarification. I've reviewed the answers and I understand this better now. The browser is iceweasal.
– Nick Tomlin
May 7 '13 at 19:55
This still keeps the process running in the current terminal window. Let me know if I need to clarify my question.
– Nick Tomlin
May 7 '13 at 19:29
This still keeps the process running in the current terminal window. Let me know if I need to clarify my question.
– Nick Tomlin
May 7 '13 at 19:29
Yeah, if you want it to go background immediately then just put it to the background with a ampersand "&". Isn't that @terdon's answer said to do?
– slm♦
May 7 '13 at 19:37
Yeah, if you want it to go background immediately then just put it to the background with a ampersand "&". Isn't that @terdon's answer said to do?
– slm♦
May 7 '13 at 19:37
The issue here isn't xdg-open, see @Gilles answer, he explains why xdg-open is being held up, it's the GUI you're sending the URL to which is causing xdg-open to wait.
– slm♦
May 7 '13 at 19:47
The issue here isn't xdg-open, see @Gilles answer, he explains why xdg-open is being held up, it's the GUI you're sending the URL to which is causing xdg-open to wait.
– slm♦
May 7 '13 at 19:47
What browser are you sending the URL to? Is there a dialog box or anything else being popped when you send the URLs w/
xdg-open
? Seems like several of the answerers here have indicated that the normal behavior is that control is returned to the terminal after some period of time.– slm♦
May 7 '13 at 19:52
What browser are you sending the URL to? Is there a dialog box or anything else being popped when you send the URLs w/
xdg-open
? Seems like several of the answerers here have indicated that the normal behavior is that control is returned to the terminal after some period of time.– slm♦
May 7 '13 at 19:52
thanks for the clarification. I've reviewed the answers and I understand this better now. The browser is iceweasal.
– Nick Tomlin
May 7 '13 at 19:55
thanks for the clarification. I've reviewed the answers and I understand this better now. The browser is iceweasal.
– Nick Tomlin
May 7 '13 at 19:55
|
show 1 more comment
If you need to open web pages from command line (loop), you can just open the browser before starting the script.
In this case it doesn't wait for browser to be closed after the first link, but opens them all in new tabs.
add a comment |
If you need to open web pages from command line (loop), you can just open the browser before starting the script.
In this case it doesn't wait for browser to be closed after the first link, but opens them all in new tabs.
add a comment |
If you need to open web pages from command line (loop), you can just open the browser before starting the script.
In this case it doesn't wait for browser to be closed after the first link, but opens them all in new tabs.
If you need to open web pages from command line (loop), you can just open the browser before starting the script.
In this case it doesn't wait for browser to be closed after the first link, but opens them all in new tabs.
edited Jul 30 '14 at 18:00
polym
6,80653158
6,80653158
answered Jul 30 '14 at 17:50
Valentina WalxValentina Walx
11
11
add a comment |
add a comment |
As today, none of those options did work for me.
I am total aware that the OP said "use xdg-open", sorry in advance.
I've ended up doing a dead-simple chrome https://google.es --new-window || chromium https://google.es --new-window || firefox https://google.es
.
If you don't have any of those 3 browsers, then just feel free to use the right ones with your preference of order.
Note: Firefox did open a new window without add anything. Case doesn't work seamessly for you, use firefox https://google.es -new-instance -new-window
. Note that is just one -
for firefox flags.
add a comment |
As today, none of those options did work for me.
I am total aware that the OP said "use xdg-open", sorry in advance.
I've ended up doing a dead-simple chrome https://google.es --new-window || chromium https://google.es --new-window || firefox https://google.es
.
If you don't have any of those 3 browsers, then just feel free to use the right ones with your preference of order.
Note: Firefox did open a new window without add anything. Case doesn't work seamessly for you, use firefox https://google.es -new-instance -new-window
. Note that is just one -
for firefox flags.
add a comment |
As today, none of those options did work for me.
I am total aware that the OP said "use xdg-open", sorry in advance.
I've ended up doing a dead-simple chrome https://google.es --new-window || chromium https://google.es --new-window || firefox https://google.es
.
If you don't have any of those 3 browsers, then just feel free to use the right ones with your preference of order.
Note: Firefox did open a new window without add anything. Case doesn't work seamessly for you, use firefox https://google.es -new-instance -new-window
. Note that is just one -
for firefox flags.
As today, none of those options did work for me.
I am total aware that the OP said "use xdg-open", sorry in advance.
I've ended up doing a dead-simple chrome https://google.es --new-window || chromium https://google.es --new-window || firefox https://google.es
.
If you don't have any of those 3 browsers, then just feel free to use the right ones with your preference of order.
Note: Firefox did open a new window without add anything. Case doesn't work seamessly for you, use firefox https://google.es -new-instance -new-window
. Note that is just one -
for firefox flags.
answered 16 hours ago
erm3ndaerm3nda
1386
1386
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f74605%2fuse-xdg-open-to-open-a-url-with-a-new-process%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What web browser are you using?
– Cristian Ciupitu
Jul 30 '14 at 18:46