Created
September 29, 2017 15:58
-
-
Save pluma/c8b4bd974c513000920c956c167c6a63 to your computer and use it in GitHub Desktop.
Automatically hide Hyper.app on startup by running `HYPER_AUTOHIDE=1 hyper`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.