Toggle Full-Screen Status of Front Window

Or, if you would like to experiment with an Execute JavaScript for Automation action, you might try something like:

(function () {
    'use strict';

    // fullScreenAttribute :: () -> Maybe attribute
    function maybeFullScreenAttribute() {
        var lstProc = Application('System Events')
            .applicationProcesses
            .whose({
                frontmost: true
            }),

            // Frontmost standard window ?
            procFront = lstProc.length ? lstProc.at(0) : undefined,
            lstWins = procFront ? procFront.windows
            .whose({
                subrole: 'AXStandardWindow'
            }) : [];

        return lstWins.length ? lstWins[0]
            .attributes.AXFullScreen : undefined;
    }
    

    var fullScreen =  maybeFullScreenAttribute();

    if (fullScreen !== undefined) {
    
        // Toggle ...
        fullScreen.value = !fullScreen.value();
    }

})();
1 Like