added player status and worked on getting the integrations working with i3: 9714b2fa1d

This commit is contained in:
2019-10-30 23:42:08 +01:00
parent d7dab07845
commit bb49c112db
6 changed files with 57 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ const { settings } = require("./scripts/settings");
const { ipcRenderer } = require("electron");
const { app } = require("electron").remote;
const { downloadFile } = require("./scripts/download");
const statuses = require("./constants/statuses");
const hotkeys = require("./scripts/hotkeys");
const globalEvents = require("./constants/globalEvents");
const notifier = require("node-notifier");
@@ -210,6 +211,19 @@ function addIPCEventListeners() {
});
}
/**
* Update the current status of tidal (e.g playing or paused)
*/
function updateStatus() {
const play = elements.get("play");
let status = statuses.paused;
// if play button is NOT visible tidal is playing
if (!play) {
status = statuses.playing;
}
ipcRenderer.send("update-status", status);
}
/**
* Watch for song changes and update title + notify
*/
@@ -218,6 +232,8 @@ setInterval(function() {
const artists = elements.getText("artists");
const songDashArtistTitle = `${title} - ${artists}`;
updateStatus();
if (getTitle() !== songDashArtistTitle) {
setTitle(songDashArtistTitle);