Skip to content

Instantly share code, notes, and snippets.

@pluma
Created September 29, 2017 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pluma/c8b4bd974c513000920c956c167c6a63 to your computer and use it in GitHub Desktop.
Save pluma/c8b4bd974c513000920c956c167c6a63 to your computer and use it in GitHub Desktop.
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
Copy link
Author

pluma 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