[Request] quit application when last window closed

When the last window/tab is closed, then quit the application so that it doesn’t show the active indicator in the dock.

I will vote against this request, as Mac apps should not quit when all of the windows are closed.

1 Like

and it’s the kind of custom behaviour that could be defined (for those who want it) in the form of a Keyboard Maestro Macro attached to ⌘W for TaskPaper alone.

(Close document window, and if none remain, then the app too)

( No need, really, to push the app itself outside the macOS GUI conventions – to a place where others might be surprised or inconvenienced)

2 Likes

The source for an Execute a JavaScript for Automation action in a TaskPaper-only Keyboard Maestro macro assigned to ⌘W might be something like:

Expand disclosure triangle to view JS Source
(() => {
    "use strict";

    const
        taskpaper = Application("TaskPaper"),
        windows = taskpaper.windows,
        intWins = windows.length;

    return 0 < intWins ? (
        1 === intWins ? (
            windows.at(0).close(),
            taskpaper.quit(),
            "Last window closed, TaskPaper quit."
        ) : (
            windows.at(0).close(),
            "One TaskPaper window closed."
        )
    ) : (
        taskpaper.quit(),
        "TaskPaper quit."
    );
})();
1 Like

i agree with all the replies here. thanks!

Added Script to Wiki

3 Likes