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.
new
TBrowser` command.root
does provide command line options for commands to run immediately after startup. for what's needed here that would beroot 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.