GithubHelp home page GithubHelp logo

technosophos / glowbear Goto Github PK

View Code? Open in Web Editor NEW
39.0 6.0 3.0 81 KB

add custom Touch Bar buttons on macOS MacBook Pro

License: Other

TypeScript 97.91% JavaScript 2.09%
nodejs typescript applescript touchbar touchbar-support macos macbook-pro

glowbear's Introduction

GlowBear: The TouchBar Customization Tool for your MacBook Pro

This is a tool for creating custom buttons to go on your MacBook Pro's touch bar (that glowy bar that hijacked the F-key row). It also supplies hotkey support so that you can map both a Touch Bar button and a hotkey.

Glow Bear

Prerequisites

  • node
  • yarn or npm

Usage

Build it the first time with npm install && npm build or yarn install && yarn build

Create/edit your ~/.config/glowbear/glowbear.yaml file to contain the buttons and commands you want to run.

Run with npm start or yarn start.

To raise the app, press CMD-SHIFT-.. At that point, the buttons will be visible on the button bar, and the accelerator keys will be active.

glowbear.yaml Format

The glowbear.yaml format contains a list of commands, with each command being represented as a button on the Touch Bar.

commands:
- name: "Web"
  color: "#b00707"
  accelerator: "a"
  applescript: |-
    tell application "Vivaldi"
      activate
      set visible of first window whose visible is true to true
    end tell

Commands have the following properties:

  • name: Text to display on the button.
  • color: A CSS-formatted color for the button.
  • accelerator: A hotkey (optional).
  • applescript: The script to execute when the button is clicked or the acclerator is executed.

Check out the examples directory for more examples.

LICENSE

This project is licensed under the MIT license. See LICENSE.txt for more.

Images in this package are licensed under CC-0 from https://openclipart.org.

Contributing

Feel free to open pull requests on this project. The main goal of the project was to make a tool for my own personal use. So I don't actively develop on this unless I get an idea.

glowbear's People

Contributors

technosophos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

glowbear's Issues

Buttons Disappear

I can get the Glowbear buttons to appear, but they don't persist. I only get one button-press, and then the buttons are gone and no longer available no matter what page I am on. Is this by design?

npm install && npm build problems

Hi there,

First of thanks for the potential awesome package, i've been trying to get this running on my macbookpro for two days now and keep running into the same issues. I'm no expert when it comes to installing scripts like this but I love tinkering to find out where things go wrong.

Currently i run the npm install && npm build command which results in an error as followed:

henksteenwijk@Henks-MacBook-Pro glowbear % npm install && npm build           
npm WARN [email protected] No repository field.

removed 21 packages and audited 122 packages in 0.771s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

npm WARN build `npm build` called with no arguments. Did you mean to `npm run-script build`?
henksteenwijk@Henks-MacBook-Pro glowbear % 

As it states build is called without argument so I added "run-script" to the command which results in the following:

henksteenwijk@Henks-MacBook-Pro glowbear % npm install && npm run-script build 
npm WARN [email protected] No repository field.

audited 122 packages in 0.823s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


> [email protected] build /Users/henksteenwijk/Documents/glowbear
> tsc

index.ts:71:24 - error TS2345: Argument of type 'TouchBarButton' is not assignable to parameter of type 'TouchBarLabel | TouchBarSpacer'.
  Type 'TouchBarButton' is missing the following properties from type 'TouchBarLabel': textColor, addListener, on, once, and 12 more.

 71             items.push(new TouchBar.TouchBarButton({
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 72                 label: cmd.name,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
 75                 click: fn
    ~~~~~~~~~~~~~~~~~~~~~~~~~
 76             }))
    ~~~~~~~~~~~~~~

index.ts:133:9 - error TS2322: Type '({ role: "about"; } | { type: "separator"; } | { role: "services"; submenu: undefined[]; } | { role: "hide"; } | { role: "hideothers"; } | { role: "unhide"; } | { role: "quit"; })[]' is not assignable to type 'Menu | MenuItemConstructorOptions[]'.
  Type '({ role: "about"; } | { type: "separator"; } | { role: "services"; submenu: undefined[]; } | { role: "hide"; } | { role: "hideothers"; } | { role: "unhide"; } | { role: "quit"; })[]' is not assignable to type 'MenuItemConstructorOptions[]'.
    Type '{ role: "about"; } | { type: "separator"; } | { role: "services"; submenu: undefined[]; } | { role: "hide"; } | { role: "hideothers"; } | { role: "unhide"; } | { role: "quit"; }' is not assignable to type 'MenuItemConstructorOptions'.
      Type '{ role: "hideothers"; }' is not assignable to type 'MenuItemConstructorOptions'.
        Types of property 'role' are incompatible.
          Type '"hideothers"' is not assignable to type '"window" | "hide" | "reload" | "close" | "copy" | "cut" | "paste" | "quit" | "minimize" | "undo" | "redo" | "pasteAndMatchStyle" | "delete" | "selectAll" | "forceReload" | "toggleDevTools" | ... 24 more ... | "windowMenu"'.

133         submenu: [
            ~~~~~~~

  node_modules/electron/electron.d.ts:11524:5
    11524     submenu?: (MenuItemConstructorOptions[]) | (Menu);
              ~~~~~~~
    The expected type comes from property 'submenu' which is declared here on type 'MenuItemConstructorOptions'


Found 2 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/henksteenwijk/.npm/_logs/2019-12-11T08_44_47_617Z-debug.log

Mentioned log file gives me the following info:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/local/Cellar/node/13.3.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run-script',
1 verbose cli   'build'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/henksteenwijk/Documents/glowbear/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle [email protected]~build: CWD: /Users/henksteenwijk/Documents/glowbear
10 silly lifecycle [email protected]~build: Args: [ '-c', 'tsc' ]
11 silly lifecycle [email protected]~build: Returned: code: 2  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `tsc`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:219:5)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:219:5)
13 verbose stack     at maybeClose (internal/child_process.js:1027:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/henksteenwijk/Documents/glowbear
16 verbose Darwin 19.0.0
17 verbose argv "/usr/local/Cellar/node/13.3.0/bin/node" "/usr/local/bin/npm" "run-script" "build"
18 verbose node v13.3.0
19 verbose npm  v6.13.2
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] build: `tsc`
22 error Exit status 2
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

And then my troubleshooting skills come to an extreme halt, I have no idea how to move on. Any help would be highly appreciated.

I'm running on osx 10.15.1 btw I'm not sure if this changes anything regarding the build part.

Cheers,
Henk Steenwijk

Application crashes on start

Hello !
When I want to run the app on my Mac 10.14.5 by doing $ yarn start
The app doesn't launch and the terminal outputs:

A Javascript error occured in the main process
Uncaught Exception:
TypeError: Cannot read property 'forEach' of undefined
    at Object.commands (/Users/.../Documents/glowbear/dist/commands.js:11:17)
    at App.<anonymous> (/Users/.../Documents/glowbear/dist/index.js:47:25)
    at Object.onceWrapper (events.js:293:19)
    at emitTwo (events.js:111:20)
    at App.emit (events.js:194:7)

tsc?

In the package.json file the build step executes tsc but that's not a dependency. It's something expected to be installed globally. Is that https://github.com/basarat/tsc?

glowbear/package.json

Lines 6 to 11 in 09736ca

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc",
"start": "node_modules/.bin/electron dist/index.js",
"glow": "tsc && node_modules/.bin/electron dist/index.js"
},

Or, is it https://www.npmjs.com/package/ntypescript which is the replacement for tsc?

touch bar icons don't come up when in full screen mode for current app

If I use the keys to activate the glow bear touch bar display while in an app in full screen mode it switches back to the desktop, brings up the glow bear touch bar, focuses on the app on that display, and the touch bar switches to that app.

The issue only seems to happen when starting on an app in full screen mode.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.