Skip to content

Commit

Permalink
✨ Improve to implement custom keys
Browse files Browse the repository at this point in the history
  • Loading branch information
adlerluiz committed May 29, 2020
1 parent 0eb9848 commit f268a59
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 193 deletions.
29 changes: 12 additions & 17 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ const { calcYTViewSize } = require('./utils/calcYTViewSize')
const { isWindows, isMac } = require('./utils/systemInfo')
const isDev = require('electron-is-dev')
const ClipboardWatcher = require('electron-clipboard-watcher')
const {
companionUrl,
companionWindowTitle,
companionWindowSettings,
} = require('./server.config')
const settingsProvider = require('./providers/settingsProvider')
const infoPlayerProvider = require('./providers/infoPlayerProvider')
const rainmeterNowPlaying = require('./providers/rainmeterNowPlaying')
Expand Down Expand Up @@ -507,12 +502,20 @@ function createWindow() {
mediaControl.playPauseTrack(view)
})

globalShortcut.register('CmdOrCtrl+Shift+PageUp', function() {
mediaControl.nextTrack(view)
})

globalShortcut.register('CmdOrCtrl+Shift+PageDown', function() {
mediaControl.previousTrack(view)
})

globalShortcut.register('CmdOrCtrl+Shift+PageUp', function() {
mediaControl.nextTrack(view)
globalShortcut.register('CmdOrCtrl+Shift+numadd', function() {
mediaControl.upVote(view)
})

globalShortcut.register('CmdOrCtrl+Shift+numsub', function() {
mediaControl.downVote(view)
})

ipcMain.on('restore-main-window', function() {
Expand Down Expand Up @@ -702,7 +705,6 @@ function createWindow() {
},
})

// settings.loadFile(path.join(app.getAppPath(), "/pages/settings/settings.html"));
settings.loadFile(
path.join(
__dirname,
Expand All @@ -713,7 +715,6 @@ function createWindow() {
'page=settings/settings&icon=settings&hide=btn-minimize,btn-maximize',
}
)
// settings.webContents.openDevTools();
}

settings.on('closed', function() {
Expand Down Expand Up @@ -799,8 +800,6 @@ function createWindow() {
miniplayer.hide()
mainWindow.show()
})

// miniplayer.webContents.openDevTools();
})

ipcMain.on('show-last-fm-login', function() {
Expand All @@ -825,7 +824,6 @@ function createWindow() {
},
})

// lastfm.loadFile(path.join(app.getAppPath(), "/pages/settings/last-fm-login.html"));
lastfm.loadFile(
path.join(
__dirname,
Expand All @@ -836,7 +834,6 @@ function createWindow() {
'page=settings/last-fm-login&icon=music_note&hide=btn-minimize,btn-maximize',
}
)
// lastfm.webContents.openDevTools();
})

ipcMain.on('switch-clipboard-watcher', () => {
Expand Down Expand Up @@ -872,7 +869,6 @@ function createWindow() {
},
})

// editor.loadFile(path.join(app.getAppPath(), "/pages/editor/editor.html"));
editor.loadFile(
path.join(
__dirname,
Expand All @@ -883,7 +879,6 @@ function createWindow() {
'page=editor/editor&icon=color_lens&hide=btn-minimize,btn-maximize',
}
)
// editor.webContents.openDevTools();
})

ipcMain.on('update-custom-theme', function() {
Expand Down Expand Up @@ -1164,14 +1159,14 @@ ipcMain.on('show-companion', function() {
resizable: false,
backgroundColor: '#232323',
width: 800,
title: companionWindowTitle,
title: 'companionWindowTitle',
webPreferences: {
nodeIntegration: false,
},
icon: path.join(__dirname, icon),
autoHideMenuBar: true,
})
settings.loadURL(companionUrl)
settings.loadURL('companionUrl')
})

function logDebug(data) {
Expand Down
159 changes: 26 additions & 133 deletions pages/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@
<td class="right">
<div class="switch">
<span
class="blue-text"
id="label-settings-companion-server-token"
></span>
<label>
Expand Down Expand Up @@ -620,18 +621,8 @@

<div id="tab-shortcut" class="tab-content">
<div class="row">
<div class="col s6">
<div class="col s12">
<table class="table">
<thead>
<tr>
<td>
<span
i18n="i18n_LABEL_SETTINGS_TAB_SHORTCUTS_LOCAL"
></span>
</td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td>
Expand All @@ -640,11 +631,17 @@
></span>
</td>
<th>
Space
<i
class="material-icons media-icons"
>play_arrow</i
>/<i
class="material-icons media-icons"
>pause</i
>
<span class="shortcut-or"
>or</span
>
;
CmdOrCtrl + Shift + Space
</th>
</tr>
<tr>
Expand All @@ -654,11 +651,14 @@
></span>
</td>
<th>
J
<i
class="material-icons media-icons"
>skip_next</i
>
<span class="shortcut-or"
>or</span
>
SHIFT + N
CmdOrCtrl + Shift + PageUp
</th>
</tr>
<tr>
Expand All @@ -668,148 +668,52 @@
></span>
</td>
<th>
K
<i
class="material-icons media-icons"
>skip_previous</i
>
<span class="shortcut-or"
>or</span
>
SHIFT + P
CmdOrCtrl + Shift + PageDown
</th>
</tr>
<tr>
<td>
<span
i18n="i18n_MEDIA_CONTROL_MUTE_UNMUTE"
></span>
</td>
<th>M</th>
</tr>
<tr>
<td>
<span
i18n="i18n_MEDIA_CONTROL_THUMBS_UP"
></span>
</td>
<th>+</th>
<th>
CmdOrCtrl + Shift + numadd
</th>
</tr>
<tr>
<td>
<span
i18n="i18n_MEDIA_CONTROL_THUMBS_DOWN"
></span>
</td>
<th>-</th>
</tr>
<tr>
<td>
<span
i18n="i18n_MEDIA_CONTROL_REPEAT"
></span>
</td>
<th>R</th>
</tr>
<tr>
<td>
<span
i18n="i18n_MEDIA_CONTROL_SHUFFLE"
></span>
</td>
<th>S</th>
</tr>
<tr>
<td>
<span
i18n="i18n_MEDIA_CONTROL_SEARCH"
></span>
</td>
<th>K</th>
</tr>
<tr>
<td>
<span
i18n="i18n_MEDIA_CONTROL_QUEUE_OPEN_CLOSE"
></span>
</td>
<th>
Q
<span class="shortcut-or"
>or</span
>
ESC
CmdOrCtrl + Shift + numsub
</th>
</tr>
</tbody>
</table>
</div>

<div class="col s6">
<table class="table">
<thead>
<tr>
<td>
<span
i18n="i18n_LABEL_SETTINGS_TAB_SHORTCUTS_GLOBAL"
></span>
</td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td>
<span
i18n="i18n_MEDIA_CONTROL_PLAY_PAUSE"
i18n="i18n_LABEL_SETTINGS_SHOW_HIDE_WINDOW"
></span>
</td>
<th>
CmdOrCtrl + Shift + Space
<span class="shortcut-or"
>or</span
>2x</span
><i
class="material-icons media-icons"
>play_arrow</i
>/<i
class="material-icons media-icons"
>pause</i
>
</th>
</tr>
<tr>
<td>
<span
i18n="i18n_MEDIA_CONTROL_NEXT"
></span>
</td>
<th>
CmdOrCtrl + Shift + PageUp
<span class="shortcut-or"
>or</span
><i
class="material-icons media-icons"
>skip_next</i
>
</th>
</tr>
<tr>
<td>
<span
i18n="i18n_MEDIA_CONTROL_PREVIOUS"
></span>
</td>
<th>
CmdOrCtrl + Shift + PageDown
<span class="shortcut-or"
>or</span
><i
class="material-icons media-icons"
>skip_previous</i
>
</th>
</tr>
<tr>
<td>
<span
i18n="i18n_LABEL_SETTINGS_SHOW_HIDE_WINDOW"
></span>
<div
class="switch"
style="display: inline;"
Expand All @@ -824,17 +728,6 @@
></span>
</label>
</div>
</td>
<th>
<span class="shortcut-or"
>TWICE</span
><i
class="material-icons media-icons"
>play_arrow</i
>/<i
class="material-icons media-icons"
>pause</i
>
</th>
</tr>
</tbody>
Expand Down
10 changes: 2 additions & 8 deletions pages/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ const __ = require('../../providers/translateProvider')
const { isLinux } = require('../../utils/systemInfo')
const fs = require('fs')

const {
companionUrl,
companionWindowTitle,
companionWindowSettings,
} = require('../../server.config')

const elementSettingsCompanionApp = document.getElementById(
'COMPANION_SERVER_INFO'
)
Expand Down Expand Up @@ -113,11 +107,11 @@ document.addEventListener('DOMContentLoaded', function() {
document.getElementById('content').classList.remove('hide')
})

if (elementSettingsCompanionApp) {
/*if (elementSettingsCompanionApp) {
elementSettingsCompanionApp.addEventListener('click', function() {
window.open(companionUrl, companionWindowTitle, companionWindowSettings)
})
}
}*/

if (elementRangeZoom) {
elementRangeZoom.addEventListener('input', function() {
Expand Down
Loading

0 comments on commit f268a59

Please sign in to comment.