1

I'm creating a desktop for Linux. As a result, I'm creating a utility called ts-open. However, when xdg-open is run, I want it to open ts-open when it detects that my desktop is running (just like it opens kde-open in KDE.) Is there a way to do this? If it has to be coded into xdg-open is there someone that I can speak to?

  • Why don't you create a wrapper script called xdg-open that calls ts-open if your desktop is running and the regular xdg-open if it isn't? Is this something that has to ship with your software? Only for you? – terdon Jan 12 '17 at 11:00
  • @terdon ts-open will ship with my software, and xdg-open will already be present on the system (probably in /usr/bin.) I'd like applications (like Chrome) that are already using xdg-open to open ts-open like in any other desktop environment. – Victor Tran Jan 12 '17 at 11:03
1

You'd need to patch xdg-open to detect your desktop environment in detectDE(), and add an open_...() function that delegates to ts-open.

Once your DE is ready, you should contact the xdg-utils maintainers with a patch, either via a bug, or the mailing list.

  • So just to make sure that I'm getting this right, I need to modify xdg-open myself, and then once it works, send the xdg-utils maintainers the modified version? – Victor Tran Jan 12 '17 at 11:51
  • Pretty much. "Once it works", and once your DE is released (and perhaps has traction...). You need to modify xdg-open yourself to test things while you're developing your DE anyway, but there's no point in submitting a patch until your DE is available to others. – Stephen Kitt Jan 12 '17 at 11:53
0

With all the respect to OP and to accepted answer, since xdg-open actually opens anything with the x default application, could an alias possibly do the job?

The following test in my machine brings the taskmanager without a single warning....

$ alias xdg-open='xfce4-taskmanager'

So setting this alias xdg-open=ts-open when your DE is loaded and unalias xdg-open when your DE is exited, is not enough or i'm missing something ....?

  • The problem is that I don't have control over that. For example, when I open Chrome, it internally uses xdg-open to open downloads. Unfortunately, I don't think I'll be able to set an alias in every application that the user opens. :) – Victor Tran Jan 12 '17 at 23:23
  • @VictorTran I have the feeling that once such an alias is set, even if xdg-open is called internally by Chrome should be redirected to the alias of xdg-open (ts-open). But i'm not sure if it works like this. If you want you can give it a try in the meantime :-) . I am not sure how fast xdg devs will implement your request, this is why i'm thinking "workarounds". – George Vasiliou Jan 12 '17 at 23:31
  • I suppose it can't hurt to give it a try... :) – Victor Tran Jan 12 '17 at 23:35
  • @VictorTran Another workaround would be to implement the wrapper comment of terdon. You could build a script with name xdg-open that will point to ts-open, rename old xdg-open to i.e xdg-openn and as soon as users log-out from your DE revert everything back to previous state (remove your script from /usr/bin and rename again the xdg-openn to xdg-open) – George Vasiliou Jan 12 '17 at 23:36
  • Unfortunately my app doesn't have root access (and that's a good thing, isn't it?) so I won't be able to do that. – Victor Tran Jan 12 '17 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.