Close IDA decompiler windows


Author: David Zimmer
Date: 12.15.25 - 4:05pm



I always get a shit ton of IDA decompiler windows open. The script below will close them out.

IDA JScript also received a D button on the main toolbar to run this action along with ida.CloseAllDecompilerWindows() and ida.runScript(path) which can run py, idc, or individual py commands.

import ida_kernwin

closed = 0
for i in range(100):  # try up to 100 windows
    for prefix in ["Pseudocode-", "Decompile-"]:
        for suffix in [chr(65+i), str(i)]:  # Try A-Z and 0-99
            name = prefix + suffix
            w = ida_kernwin.find_widget(name)
            if w:
                ida_kernwin.close_widget(w, 0)
                closed += 1

print(f"Closed {closed} windows")


Or the plugin version:

import ida_kernwin
import ida_hexrays
import idaapi

PLUGIN_ACTION_NAME = "my:close_decompiler_views"
PLUGIN_ACTION_LABEL = "Close All Decompiler Windows"

# Your function to close decompiler windows by brute force
def close_all_decompilers():
    closed = 0
    for i in range(100):  # Try up to 100 windows
        for prefix in ["Pseudocode-", "Decompile-"]:
            for suffix in [chr(65 + i) if i < 26 else str(i)]:
                name = prefix + suffix
                w = ida_kernwin.find_widget(name)
                if w:
                    ida_kernwin.close_widget(w, 0)
                    closed += 1
    print(f"Closed {closed} decompiler window(s).")

# Action handler for the plugin
class CloseDecompilersHandler(ida_kernwin.action_handler_t):
    def __init__(self):
        ida_kernwin.action_handler_t.__init__(self)
    
    def activate(self, ctx):
        close_all_decompilers()
        return 1
    
    def update(self, ctx):
        return ida_kernwin.AST_ENABLE_ALWAYS

# Register the action and attach to menu
def register_action():
    ida_kernwin.register_action(
        ida_kernwin.action_desc_t(
            PLUGIN_ACTION_NAME,
            PLUGIN_ACTION_LABEL,
            CloseDecompilersHandler()
        )
    )
    ida_kernwin.attach_action_to_menu(
        "Edit/Plugins/",  # You can choose another path like "View/" or custom
        PLUGIN_ACTION_NAME,
        ida_kernwin.SETMENU_APP
    )

class CloseAllPlugin(idaapi.plugin_t):
    flags = idaapi.PLUGIN_KEEP  # Keep plugin loaded
    comment = "Closes all open decompiler windows"
    help = "Close all Hex-Rays tabs"
    wanted_name = "Close All Decompiler Windows"
    wanted_hotkey = ""
    
    def init(self):
        register_action()
        print("[close_decompilers.py] Plugin initialized.")
        return idaapi.PLUGIN_KEEP  # Return PLUGIN_KEEP to stay loaded
    
    def run(self, arg):
        close_all_decompilers()
    
    def term(self):
        # Unregister action on plugin unload
        ida_kernwin.unregister_action(PLUGIN_ACTION_NAME)

def PLUGIN_ENTRY():
    return CloseAllPlugin()





Comments: (1)

On 01.21.26 - 2:06pm Dominik Weber wrote:
Nice to see these post with useful workflows

 
Leave Comment:
Name:
Email: (not shown)
Message: (Required)
Math Question: 96 + 40 = ? followed by the letter: E 



About Me
More Blogs
Main Site
Posts: (All)
2025 (14)
     Close IDA decompiler windows
     IDA Xrefs From/To
     Youtube AI Slop
     IDA Jscript 3 Beta
     IDA JScript Updates
     IdaCompare StringDiff
     Sensationalization
     Claude AI Personality Emergence
     iPhone to PC Dictation
     pediff and chatgpt
     Py Magic Numbers
     upside down pyramid
     IDA Compare Updates
     Bindiff Niceity
2024 (1)
     MAP Update
2023 ( 4 )
2022 ( 5 )
2021 ( 2 )
2020 ( 5 )
2019 ( 6 )
2017 ( 5 )
2016 ( 4 )
2015 ( 5 )
2014 ( 5 )
2013 ( 9 )
2012 ( 13 )
2011 ( 19 )
2010 ( 11 )
2009 ( 1 )