├── .gitignore ├── readme.md ├── package.json ├── index.js └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Who's awesome? 2 | 3 | ## Install 4 | 5 | [Download the latest version for Mac on the releases page](https://github.com/muan/confetti/releases) (and drag into your apps folder.) 6 | 7 | ## Built with 8 | 9 | - [maxogden/menubar](https://github.com/maxogden/menubar) 10 | 11 | ## Note 12 | 13 | Thanks to @nicolebartelt for the idea. :heart: 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "confetti", 3 | "version": "0.0.3", 4 | "description": "CONFETTI.", 5 | "main": "index.js", 6 | "scripts": { 7 | "app": "electron .", 8 | "build": "electron-packager . Confetti --platform=darwin --arch=x64 --version=0.37.2 --overwrite" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/muan/confetti.git" 13 | }, 14 | "author": "Mu-An Chiou ", 15 | "license": "MIT", 16 | "bugs": { 17 | "url": "https://github.com/muan/confetti/issues" 18 | }, 19 | "homepage": "https://github.com/muan/confetti#readme", 20 | "devDependencies": { 21 | "electron-packager": "^5.2.1" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var menubar = require('menubar') 2 | var ipc = require('electron').ipcMain 3 | var globalShortcut = require('global-shortcut') 4 | var mb = menubar({ 5 | transparent: true, 6 | width: 100, 7 | hasShadow: false, 8 | height: 100, 9 | tooltip: 'Who\'s awesome?!' 10 | }) 11 | 12 | mb.on('ready', function () { 13 | var size = require('electron').screen.getPrimaryDisplay().workAreaSize 14 | mb.setOption('width', size.width) 15 | mb.setOption('height', size.height) 16 | 17 | // Register a shortcut listener. 18 | try { 19 | globalShortcut.register('Command+Shift+1', function () { 20 | mb.showWindow() 21 | }) 22 | } catch (err) { 23 | console.log(err) 24 | } 25 | }) 26 | 27 | mb.on('show', function () { 28 | mb.window.webContents.send('start-countdown') 29 | }) 30 | 31 | mb.on('after-create-window', function () { 32 | mb.window.webContents.on('did-finish-load', function () { 33 | mb.window.webContents.send('start-countdown') 34 | }) 35 | }) 36 | 37 | mb.on('hide', function () { 38 | mb.window.webContents.send('stop-countdown') 39 | }) 40 | 41 | // when receive the abort message, close the app 42 | ipc.on('abort', function () { 43 | mb.hideWindow() 44 | }) 45 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 39 | 73 |
74 | You’re awesome! 75 |
76 | 77 | --------------------------------------------------------------------------------