vertexclique/tokamak

Contextually hide and show Tokamak toolbar

hawkw opened this issue · 5 comments

hawkw commented

I write a lot of Rust in Atom, but I also oftentimes use Atom for writing code in other languages as well. When editing files in non-Rust languages, all of Tokamak's Rust-specific toolbar icons are still shown. Since Atom exposes the language of the currently open file to plugins, it seems to me that the Tokamak toolbar icons could be contextually shown and hidden.

It would sure be nice if when I'm programming in, say, Scala, the buttons to run a Cargo build were to disappear...

Just an idea: tokamak could look for cargo.toml in project root directory.

It could be a setting: Activate Toolbar

  • Always
  • Rust, or no project open
  • Rust projects open

Alternatively there could be a hide/show key combo.

hawkw commented

Looking for a cargo.toml is a good idea - that way the toolbar buttons are still there when editing files in Rust projects that aren't Rust source code (such as cargo.toml!). Making it a setting is a good idea, though – I might want to have it open when editing Rust files that aren't in Cargo projects, or I might not want the extra overhead of checking for a cargo.toml (though I doubt that's too much of a performance hit).

cargo-build checks for cargo.toml - it could possibly be adapted. It doesn't seem to be a performance issue there.

I've had this issue with similar project packages for Atom like Platform.io and likely now with Tokamak and soon Nuclide. As these sorts of projects that have specific changes to Atom UI for the projects they cater for continue to pop up, perhaps they should all be managed via a separate package(I'm assuming each is using the toolbar package for toolbar additions).

I've not had more than one of these IDE like packages active, so no idea if things like toolbar conflict or I get 1 for each. Simply disabling/enabling the package should solve the problem? I would think there is a package out there already for controlling which projects should be enabled/disabled when opening a project. There are project management packages but it's not clear if they cater to this need.

Tokamak supports contextual hiding itself from now on. You can enable or disable it by removing tokamak.toml configuration file from project directories.