Skip to content

Instantly share code, notes, and snippets.

@pluma pluma/autohide.js
Created Sep 29, 2017

Embed
What would you like to do?
Automatically hide Hyper.app on startup by running `HYPER_AUTOHIDE=1 hyper`
'use strict';
const $AUTO_HIDDEN = Symbol('autoHidden');
if (process.env.HYPER_AUTOHIDE) {
exports.onApp = app => {
if (app[$AUTO_HIDDEN]) return;
app[$AUTO_HIDDEN] = true;
const windows = app.getWindows();
for (const window of windows.values()) {
setTimeout(() => window.hide(), 500);
}
};
}
@pluma

This comment has been minimized.

Copy link
Owner Author

commented Sep 29, 2017

The 500ms delay is silly but seems to hit the sweet spot between window.hide() not having any effect and the window being fully visible. There's a perceptible flash but it's short enough not to be annoying during startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.