-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
116 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/** @babel */ | ||
/** @jsx etch.dom */ | ||
|
||
import {Disposable} from 'atom' | ||
import etch from 'etch' | ||
const {app, BrowserWindow, TouchBar} = require('remote') | ||
const {TouchBarLabel, TouchBarButton, TouchBarSpacer, TouchBarSlider} = TouchBar | ||
|
||
var touchBarItems = [] | ||
|
||
|
||
export default class TimecopView { | ||
constructor ({uri}) { | ||
this.uri = uri | ||
etch.initialize(this) | ||
if (atom.packages.getActivePackages().length > 0) { | ||
this.populateViews() | ||
} else { | ||
// Render on next tick so packages have been activated | ||
setImmediate(() => { this.populateViews() }) | ||
} | ||
} | ||
|
||
update () {} | ||
|
||
destroy () { | ||
return etch.destroy(this) | ||
} | ||
|
||
render () { | ||
return ( | ||
<div> | ||
<div> | ||
<div> | ||
<b>Current objects in TouchBar:</b> | ||
<ul ref="activeObjects"></ul> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
populateViews() { | ||
if(BrowserWindow.getFocusedWindow()._touchBar !== null) { | ||
touchBarItems = Object.values(BrowserWindow.getFocusedWindow()._touchBar.items) | ||
console.log(touchBarItems) | ||
touchBarItems.map((obj) => { | ||
const li = document.createElement('div') | ||
|
||
const a = document.createElement('a') | ||
a.textContent = `${obj.type} ${obj.label}` | ||
li.appendChild(a) | ||
|
||
this.refs.activeObjects.appendChild(li) | ||
}) | ||
} | ||
} | ||
|
||
|
||
serialize () { | ||
return { | ||
deserializer: this.constructor.name, | ||
uri: this.getURI() | ||
} | ||
} | ||
|
||
getURI () { | ||
return this.uri | ||
} | ||
|
||
getTitle () { | ||
return 'Touchbar Editor' | ||
} | ||
|
||
getIconName () { | ||
return 'dashboard' | ||
} | ||
|
||
onDidChangeTitle () { | ||
return new Disposable(function () {}) | ||
} | ||
|
||
onDidChangeModified () { | ||
return new Disposable(function () {}) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,7 @@ | |
"engines": { | ||
"atom": ">=1.0.0 <2.0.0" | ||
}, | ||
"dependencies": {} | ||
"dependencies": { | ||
"etch": "^0.12.4" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
etch@^0.12.4: | ||
version "0.12.4" | ||
resolved "https://registry.yarnpkg.com/etch/-/etch-0.12.4.tgz#6c8b9500eeeda22a1e0962f58f94e2cf9573ac92" |