This commit is contained in:
Diego Rodríguez Baquero
2021-10-11 18:27:41 -05:00
parent e42a515199
commit 7e8078ed92
70 changed files with 862 additions and 1136 deletions

View File

@@ -1,21 +1,6 @@
module.exports = {
disable,
enable,
onPlayerPause,
onPlayerPlay,
onPlayerUpdate
}
/**
* On Windows, add a "thumbnail toolbar" with a play/pause button in the taskbar.
* This provides users a way to access play/pause functionality without restoring
* or activating the window.
*/
const path = require('path')
const config = require('../config')
const windows = require('./windows')
import path from 'path'
import config from '../config.js'
import * as windows from './windows'
const PREV_ICON = path.join(config.STATIC_PATH, 'PreviousTrackThumbnailBarButton.png')
const PLAY_ICON = path.join(config.STATIC_PATH, 'PlayThumbnailBarButton.png')
@@ -32,7 +17,7 @@ let buttons = []
/**
* Show the Windows thumbnail toolbar buttons.
*/
function enable () {
export function enable () {
buttons = [
{
tooltip: 'Previous Track',
@@ -56,26 +41,26 @@ function enable () {
/**
* Hide the Windows thumbnail toolbar buttons.
*/
function disable () {
export function disable () {
buttons = []
update()
}
function onPlayerPause () {
export function onPlayerPause () {
if (!isEnabled()) return
buttons[PLAY_PAUSE].tooltip = 'Play'
buttons[PLAY_PAUSE].icon = PLAY_ICON
update()
}
function onPlayerPlay () {
export function onPlayerPlay () {
if (!isEnabled()) return
buttons[PLAY_PAUSE].tooltip = 'Pause'
buttons[PLAY_PAUSE].icon = PAUSE_ICON
update()
}
function onPlayerUpdate (state) {
export function onPlayerUpdate (state) {
if (!isEnabled()) return
buttons[PREV].flags = [state.hasPrevious ? 'enabled' : 'disabled']
buttons[NEXT].flags = [state.hasNext ? 'enabled' : 'disabled']