Project Title in Tree View Tab (help wanted)


#1

I would like to replace the Tree View Tab title from “Project” to the current Project name.

I found in this discussion that the tab can be accessed something like this: document.querySelector('[data-type="TreeView"]').parentNode

Also I found this from this issue:

atom.packages.onDidActivatePackage (pack) ->
        if pack.name == 'project-manager'
            atom.packages.getActivePackage('project-manager').mainModule.provideProjects().getProject (project) ->
                console.log project

In theory, if I edit my init.coffee file, I can access the current Project title, but I know nothing about Coffee Script, nor the Atom API.

So if somebody would help me, I would really appreciate.

Thanks in advance


#2

I know nothing about Coffee Script

What about JavaScript? You can write everything in JavaScript if you want (eg. use init.js).

Sorry, I can’t help you with the actual issue though.


#3

Thanks for the tip!
I 'd try with plain JS


#4

You can get the node for the title text with document.querySelector('[data-type="TreeView"]>.title') (though there might be a better selector?) and change it with textContent or some such.

The snippet you posted is based on the package project-manager.
Do you use it? If so, then the snippet should work for you. There are coffeescript to javascript converters online, so you should be able to convert & reuse the snippet if you prefer it in javascript.


#5

Thank you all for help!