Disabling package from command pallet



My purpose is to disable a package from command pallet.

1- I create a command for command-palet on init.coffe file which runs this:


After this method, when I click settings–>packages, I can see that the mypackage1 is disabled. But the package runs on backgrund. Because when I run from command-pallet, a command of mypackage1, it works. After I call windows.reload I can not run a command of mypackage1. So I’m asking is there any way disable a package without windows.reload ?

2- I check https://github.com/robenkleene/toggle-packages package. (Like the first thing I wrote) It seems disable the mypackage1 but It needs windows.reload.

3- I check https://atom.io/packages/package-switch package. This one works. It disables the package without windows.reload.

Can somebody help me to write the simliest code block which I can call it from command line.

( Note: I can not use package-switch package. because it disables a package only from command-pallet in 2-3 choices (mouse clicks). But I need one command which can I add it to toolbar as button.)

Thanks in advance


You shouldn’t have to reload the window when disabling a package. Furthermore, both toggle-packages and package-switch use atom.packages.disablePackage behind the scenes. I don’t understand why package-switch is the only one that works.

Can you open the developer tools console (View->Developer->Toggle Developer Tools, Window:Toggle Dev Tools or Ctrl+Shift+I) and check if atom.packages.disablePackage works there ?


Hi deprint,

I tested from command line (from developer tools). atom.packages.disablePackage works from here. It returns a javasciprt Package object which includes informations about the package which I disabled. but window.reload should call again :frowning:

I am using Ubuntu 16.04 64 bit I also try the same think from Windows 8.1 64 bit. My atom version is 10.10+.

Is this a bug? But how package-switch works :confused: I look the codes of package-switch, I am not sure but it changes some config files I think after it disabled the package…

Thank you


I’m pretty sure that atom.packages.disablePackage works exactly as intended and both toggle-packages and package-switch use that function to disable packages.

At this point I could only think of two possible causes:

  1. Your Atom installation is out of date (you said 10.10+? The latest is 1.12.2), but I can’t think of a feature or bug fix related to this issue.

  2. The package you try to disable does not clean up after itself. Can you disable other packages ?


1- I updated to latest stable version. 1.12.2 . The problem did not solved :confused:

2- I am trying the atom-beautify. After you write this, I try also atom-print package. The same problem exist on this package.

I have tested them two different machines, 2 different operating systems. I re-try all these thinks on a Atom which I have remove .atom (settings folder) inside home folder.


I try also “bookmarks” package which is core/default installed package of Atom.


If mypackage1 is a package that you wrote, then you have written it incorrectly. In order for a package’s commands to no longer be available after it is disabled, it must dispose of the command objects in the package’s deactivate function. Notice that the “Return value” of the atom.commands.add function states that it returns a Disposable that can be used to remove those commands. Anything that your package adds to Atom’s environment via code has to be disposed of in this way in your package’s deactivate function.