0

I'm working with CERNs framework for data analysis ROOT on an ubuntu machine. The generated data is stored in so-called root files (*.root). To open and browse such a file, I need to open a terminal, load the file and open a (T)Browser. In code:

$ root
root[0] TFile *f=new TFile("my_file.root")
root[1] new TBrowser() // opens GUI

Equivalently, I can also just do

$ root my_file.root
root[0] new TBrowser() // opens GUI

but this is still tedious. Therefore, I'd like to just double click the respective file(s) (or call xdg-open my_file.root in the terminal, respectively) and automatically open the GUI, i.e., execute the little script above. How can I do this in Ubuntu? Many thanks in advance.

Note: I've already asked this question at Stack Overflow, but was forwarded to Ask ubuntu.

5
  • Does this help? help.ubuntu.com/stable/ubuntu-help/files-open.html
    – FedKad
    Jan 9, 2020 at 18:22
  • I would add details of the machine, OS version, etc then add up to 5 tags specific to the details. This will get you a wider audience and perhaps some people with answers to this. The application is rather advanced and the script needed may need someone with advanced skill to help you. We do have some really advanced people here please be patient. Good luck. :) And working with/at CERN is cool, helping advance human understanding of the universe...awesome! Jan 9, 2020 at 21:23
  • It is really a matter of the application that apparently does not provide command line options to directly do what you want. I only can think of a hacks where you use a wrapper script that 1) executes your first command (and send it to background) and then continues with 2) xdotool or another automation tool to simulate typing the new TBrowser` command.
    – vanadium
    Jan 10, 2020 at 8:19
  • root does provide command line options for commands to run immediately after startup. for what's needed here that would be root my_file.root -e 'TBrowser b'. (-e for execute. order matters - first open the file, then run the command, i.e. -e must come after the filename.) so the task really boils down to registering the filetype with a command for xdg-open.
    – pseyfert
    Jan 10, 2020 at 18:15
  • i think this is a freedesktop.org matter. maybe have a look at stackoverflow.com/q/30931 and unix.stackexchange.com/q/41195.
    – pseyfert
    Jan 17, 2020 at 13:09

0

Your Answer

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

Browse other questions tagged or ask your own question.