Skip to content

Commit

Permalink
Highlight tray, save window's positon and size
Browse files Browse the repository at this point in the history
  • Loading branch information
edanchenkov committed Dec 9, 2017
1 parent 893d2f4 commit 6d7c1cd
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 26 deletions.
3 changes: 2 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ var userPreferences = {
windowDraggable : true,
windowPosition : 'trayCenter',
globalShortcuts : true,
PIPModeByDefault: false
PIPModeByDefault : false,
highlightTray : true
};

var defaults = {
Expand Down
15 changes: 13 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ var accelerators = [
'Cmd+Alt+Y'
];


var defaultMenu = [
{
label : 'Edit',
Expand Down Expand Up @@ -161,15 +160,27 @@ mb.on('ready', function ready() {

});

var bounds;

mb.on('after-create-window', function () {
mb.window.setResizable(config.windowResize);
mb.window.setMinimumSize(400, 400);

});

mb.on('after-show', function () {
mb.tray.setImage(AppConfig.store.defaults.iconPressed);
/* Skip first show */
if (typeof bounds !== "undefined") {
mb.window.setBounds(bounds);
}
if (config.highlightTray) {
mb.tray.setImage(AppConfig.store.defaults.iconPressed);
} else {
mb.tray.setHighlightMode('never');
}
});

mb.on('after-hide', function () {
bounds = mb.window.getBounds();
mb.tray.setImage(AppConfig.store.defaults.icon);
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MenuTube",
"version": "1.3.0",
"version": "1.3.2",
"description": "Catch YouTube into your macOS menu bar!",
"main": "main.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
'windowPosition',
'externalLinks',
'globalShortcuts',
'PIPModeByDefault'
'PIPModeByDefault',
'highlightTray'
];

var translateValue = function (value) {
Expand Down
66 changes: 45 additions & 21 deletions views/preferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ <h1 class="title is-1">
</div>
<p class="control">
<label class="radio">
<input value="yes" type="radio" name="windowDraggable"
<input value="yes" type="radio"
name="windowDraggable"
checked>
Yes
</label>
<label class="radio">
<input value="no" type="radio" name="windowDraggable">
<input value="no" type="radio"
name="windowDraggable">
No
</label>
</p>
Expand Down Expand Up @@ -126,16 +128,38 @@ <h1 class="title is-1">
</div>
<div class="container">
<div class="heading">
<p class="title is-3">Use PIP (Picture in Picture) mode by default</p>
<p class="title is-3">Use PIP (Picture in Picture) mode
by default</p>
<p class="subtitle is-6">Hide all UI elements</p>
</div>
<p class="control">
<label class="radio">
<input value="yes" type="radio" name="PIPModeByDefault" checked>
<input value="yes" type="radio"
name="PIPModeByDefault" checked>
Yes
</label>
<label class="radio">
<input value="no" type="radio" name="PIPModeByDefault">
<input value="no" type="radio"
name="PIPModeByDefault">
No
</label>
</p>
</div>
<div class="container">
<div class="heading">
<p class="title is-3">Highlight tray icon<span
class="tag is-danger is-small">Require a restart</span>
</p>
</div>
<p class="control">
<label class="radio">
<input value="yes" type="radio"
name="highlightTray" checked>
Yes
</label>
<label class="radio">
<input value="no" type="radio"
name="highlightTray">
No
</label>
</p>
Expand Down Expand Up @@ -185,22 +209,22 @@ <h1 class="title is-1">
</p>
</div>
<!--<div class="container">-->
<!--<div class="heading">-->
<!--<p class="title is-3">Active device<span-->
<!--class="tag is-danger is-small">Require a restart</span>-->
<!--</p>-->
<!--<p class="subtitle is-6">Choose what device MenuTube emulates to open YouTube</p>-->
<!--</div>-->
<!--<p class="control">-->
<!--<span class="select">-->
<!--<select id="user-agent">-->
<!--<option value="ipad">iPad</option>-->
<!--<option value="iphone">iPhone</option>-->
<!--<option value="android">Android</option>-->
<!--<option value="desktop">Desktop</option>-->
<!--</select>-->
<!--</span>-->
<!--</p>-->
<!--<div class="heading">-->
<!--<p class="title is-3">Active device<span-->
<!--class="tag is-danger is-small">Require a restart</span>-->
<!--</p>-->
<!--<p class="subtitle is-6">Choose what device MenuTube emulates to open YouTube</p>-->
<!--</div>-->
<!--<p class="control">-->
<!--<span class="select">-->
<!--<select id="user-agent">-->
<!--<option value="ipad">iPad</option>-->
<!--<option value="iphone">iPhone</option>-->
<!--<option value="android">Android</option>-->
<!--<option value="desktop">Desktop</option>-->
<!--</select>-->
<!--</span>-->
<!--</p>-->
<!--</div>-->
</section>
<div class="container">
Expand Down

0 comments on commit 6d7c1cd

Please sign in to comment.