Skip to content

Commit

Permalink
✨ New features!
Browse files Browse the repository at this point in the history
  • Loading branch information
rxri committed Apr 24, 2021
1 parent b7c82c1 commit 7f56cc8
Show file tree
Hide file tree
Showing 10 changed files with 273 additions and 31 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Cross-platform (Windows, macOS).
- Super fast.
- Tray that shows you actually playing song and option to close program!
- Settings
- Coded in TypeScript.

## Supported OS
Expand All @@ -15,12 +16,35 @@

## Screenshots

<details>
<summary>Open screenshots</summary>

![image](https://user-images.githubusercontent.com/9348108/114874300-7e3a4700-9dfc-11eb-82ea-49c5cf1b25c4.png)
![image](https://user-images.githubusercontent.com/9348108/114874365-901bea00-9dfc-11eb-9ba4-8c6c7aa8b14c.png)
![image](https://user-images.githubusercontent.com/9348108/114874433-9dd16f80-9dfc-11eb-8dbc-f01774950b81.png)

![image](https://user-images.githubusercontent.com/9348108/114874447-a32eba00-9dfc-11eb-9081-544f2781be2b.png)

![image](https://user-images.githubusercontent.com/9348108/115956057-fdb1cf80-a4fa-11eb-9777-c32c64875773.png)

</details>

## App settings

App has implemented settings that you can use to disable/enable some features.

**_All changes are applied on new song!_**

- You can disable showing `Rich Presence` on discord.
- You can disable showing `App Name` (tidalRPC) on discord.
- You can disable showing `Buttons` on discord.

_Warning: macOS users need to have app in `Applications` folder to have config working properly._

### How to access it?

It's super easy! Just click on `tidalRPC` tray icon and go to `Settings` submenu!

---

This project is not affiliated with Tidal/Aspiro. It's only fan-made project.
13 changes: 9 additions & 4 deletions builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@
},
"asar": true,
"dmg": {
"background": "src/assets/background.png",
"window": {
"width": 660,
"height": 400
},
"contents": [
{
"x": 110,
"y": 150
"x": 180,
"y": 170
},
{
"x": 410,
"y": 150,
"x": 480,
"y": 170,
"type": "link",
"path": "/Applications"
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tidalRPC",
"version": "1.0.0",
"version": "1.1.0",
"description": "Unofficial Discord Rich Presence for Tidal Desktop app.",
"repository": {
"type": "git",
Expand All @@ -19,6 +19,7 @@
"axios": "^0.21.1",
"debug": "^4.3.1",
"discord-rpc": "^3.2.0",
"electron-store": "^8.0.0",
"electron-updater": "^4.3.8",
"figlet": "^1.5.0",
"node-mac-permissions": "mmaietta/node-mac-permissions#misc/conditional-binding",
Expand Down
Binary file added src/assets/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ if (!singleInstanceLock) app.quit();
app.setAppUserModelId("ririxidev.TidalRPC");
app.whenReady().then(async () => {
trayManager = new TrayManager();
trayManager.start();

if (platform() === "darwin") app.dock.hide();

Expand Down
16 changes: 13 additions & 3 deletions src/managers/discord.manager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Client, Presence } from "discord-rpc";
import { app } from "electron";

import Song from "@classes/song.class";
import { store } from "@util/config";
import { formatTime } from "@util/formatTime";

import { clientID, logger } from "../config";
Expand Down Expand Up @@ -66,8 +68,16 @@ export const setActivity = (data: Song) => {
largeImageKey: data.quality === "HI_RES" ? "logo_mqa" : "logo",
largeImageText:
data.quality === "HI_RES"
? `Tidal [MQA] ${String.fromCharCode(8226)} tidalRPC ${app.version}`
: `Tidal ${String.fromCharCode(8226)} tidalRPC ${app.version}`
? `Tidal [MQA] ${
store.get("showAppName")
? `${String.fromCharCode(8226)} tidalRPC ${app.getVersion()}`
: ""
}`
: `Tidal ${
store.get("showAppName")
? `${String.fromCharCode(8226)} tidalRPC ${app.getVersion()}`
: ""
}`
};

if (!data.duration) presenceData.startTimestamp = data.startTime;
Expand All @@ -80,7 +90,7 @@ export const setActivity = (data: Song) => {
presenceData.smallImageKey = data.paused ? "pause" : "play";
presenceData.smallImageText = data.paused ? "Paused" : "Playing";

if (data.buttons && data.buttons.length !== 0)
if (data.buttons && data.buttons.length !== 0 && store.get("showButtons"))
presenceData.buttons = data.buttons;

if (data.paused && presenceData.endTimestamp)
Expand Down
10 changes: 6 additions & 4 deletions src/managers/tidal.manager.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { clearActivity, setActivity } from "@managers/discord.manager";

import Process from "@classes/process.class";
import Song from "@classes/song.class";
import { compareTitle } from "@util/compareTitle";
import tidalAPI from "@classes/tidalAPI.class";
import { clearActivity, setActivity } from "@managers/discord.manager";
import { compareTitle } from "@util/compareTitle";
import { store } from "@util/config";

import { trayManager } from "../";

export default class TidalManager {
Expand Down Expand Up @@ -96,7 +97,8 @@ export default class TidalManager {
console.log(this.currentSong);

trayManager.update(this.currentSong);
return setActivity(this.currentSong);
if (store.get("showPresence")) return setActivity(this.currentSong);
else return clearActivity();
}
break;
}
Expand Down
85 changes: 70 additions & 15 deletions src/managers/tray.manager.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Menu, Tray, app } from "electron";

import Song from "@classes/song.class";
import debug from "debug";
import { join } from "path";
import { logger } from "../config";
import { app, Menu, Tray } from "electron";
import { platform } from "os";
import { join } from "path";

import Song from "@classes/song.class";
import { store } from "@util/config";

import { trayManager } from "../";
import { logger } from "../config";

let trayIcon: string;

Expand All @@ -16,9 +18,6 @@ switch (platform()) {
case "win32":
trayIcon = join(__dirname, "../assets/windows.ico");
break;
default:
trayIcon = join(__dirname, "../assets/macos.png");
break;
}

export default class TrayManager {
Expand All @@ -28,31 +27,58 @@ export default class TrayManager {
this.systray = new Tray(trayIcon);
this.logger = logger.extend("TrayManager");

this.systray.setToolTip("tidalRPC");
}

start() {
this.systray.setContextMenu(
Menu.buildFromTemplate([
{
label: "TidalRPC",
label: `TidalRPC ${app.getVersion()}`,
enabled: false
},
{
type: "separator"
},
{
label: "Settings",
submenu: [
{
label: "Show Rich Presence",
type: "checkbox",
checked: store.get("showPresence"),
click: () => {
store.set("showPresence", !store.get("showPresence"));
}
},
{
label: "Show AppName in Rich Presence",
type: "checkbox",
checked: store.get("showAppName"),
click: () => {
store.set("showAppName", !store.get("showAppName"));
}
},
{
label: "Show Buttons in Rich Presence",
type: "checkbox",
checked: store.get("showButtons"),
click: () => {
store.set("showButtons", !store.get("showButtons"));
}
}
]
},
{
label: "Exit",
role: "quit"
}
])
);

this.systray.setToolTip("tidalRPC");
}

update(song?: Song) {
let menu = Menu.buildFromTemplate([
const menu = Menu.buildFromTemplate([
{
label: "TidalRPC",
label: `TidalRPC ${app.getVersion()}`,
enabled: false
},
{
Expand All @@ -63,6 +89,35 @@ export default class TrayManager {
{
type: "separator"
},
{
label: "Settings",
submenu: [
{
label: "Show Rich Presence",
type: "checkbox",
checked: store.get("showPresence"),
click: () => {
store.set("showPresence", !store.get("showPresence"));
}
},
{
label: "Show AppName in Rich Presence",
type: "checkbox",
checked: store.get("showAppName"),
click: () => {
store.set("showAppName", !store.get("showAppName"));
}
},
{
label: "Show Buttons in Rich Presence",
type: "checkbox",
checked: store.get("showButtons"),
click: () => {
store.set("showButtons", !store.get("showButtons"));
}
}
]
},
{
label: "Exit",
role: "quit"
Expand Down
15 changes: 15 additions & 0 deletions src/util/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Store from "electron-store";

interface configType {
showPresence: boolean;
showAppName: boolean;
showButtons: boolean;
}

export const store = new Store<configType>({
defaults: {
showPresence: true,
showAppName: true,
showButtons: true
}
});
Loading

0 comments on commit 7f56cc8

Please sign in to comment.