App-SlowQuitApps

 view release on metacpan or  search on metacpan

lib/App/SlowQuitApps.pm  view on Meta::CPAN

    if (keys(%SLOWQUIT) && keys(%FASTQUIT)) {
        warn "Can't configure both slowquit and fastquit on apps.\nConfiguration unchanged.\n";
    }
    else {
        # Clear everything...
        _defaults("delete $APP_ID");

        # Set up delay...
        if ($DELAY) {
            _defaults("write $APP_ID delay -int $DELAY");
            say "Slowquit after $DELAY msec";
        }

        # Set up whitelist or blacklist...
        if (keys %SLOWQUIT) {
            _defaults("write $APP_ID invertList -bool YES");
            for my $app (keys %SLOWQUIT) {
                _defaults("write $APP_ID whitelist -array-add $SLOWQUIT{$app}");
                say "Slowquit: $app";
            }
        }
        elsif (keys %FASTQUIT) {
            _defaults("write $APP_ID invertList -bool NO");
            for my $app (keys %FASTQUIT) {
                _defaults("write $APP_ID whitelist -array-add $FASTQUIT{$app}");
                say "Fastquit: $app";
            }
        }

        # Restart to effect changes...
        system("killall $APP_NAME");
        system("open -a $APP_NAME");
    }
}

# Given an app name, get the corresponding identifier...



( run in 1.399 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )