Skip to content

Commit 073ea27

Browse files
authored
Merge pull request #802 from amsyarasyiq/master
proposal: Adding an option to hide duration before the song ends
2 parents 9441a6a + 927596d commit 073ea27

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

config/defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const defaultConfig = {
4949
activityTimoutEnabled: true, // if enabled, the discord rich presence gets cleared when music paused after the time specified below
5050
activityTimoutTime: 10 * 60 * 1000, // 10 minutes
5151
listenAlong: true, // add a "listen along" button to rich presence
52+
hideDurationLeft: false, // hides the start and end time of the song to rich presence
5253
},
5354
notifications: {
5455
enabled: false,

plugins/discord/back.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ let clearActivity;
7070
*/
7171
let updateActivity;
7272

73-
module.exports = (win, { activityTimoutEnabled, activityTimoutTime, listenAlong }) => {
73+
module.exports = (win, { activityTimoutEnabled, activityTimoutTime, listenAlong, hideDurationLeft }) => {
7474
window = win;
7575
// We get multiple events
7676
// Next song: PAUSE(n), PAUSE(n+1), PLAY(n+1)
@@ -117,7 +117,7 @@ module.exports = (win, { activityTimoutEnabled, activityTimoutTime, listenAlong
117117
// Set start the timer so the activity gets cleared after a while if enabled
118118
if (activityTimoutEnabled)
119119
clearActivity = setTimeout(() => info.rpc.clearActivity().catch(console.error), activityTimoutTime ?? 10000);
120-
} else {
120+
} else if (!hideDurationLeft) {
121121
// Add the start and end time of the song
122122
const songStartTime = Date.now() - songInfo.elapsedSeconds * 1000;
123123
activityInfo.startTimestamp = songStartTime;

plugins/discord/menu.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ module.exports = (win, options, refreshMenu) => {
4040
setMenuOptions('discord', options);
4141
},
4242
},
43+
{
44+
label: "Hide duration left",
45+
type: "checkbox",
46+
checked: options.hideDurationLeft,
47+
click: (item) => {
48+
options.hideDurationLeft = item.checked;
49+
setMenuOptions('discord', options);
50+
}
51+
},
4352
{
4453
label: "Set inactivity timeout",
4554
click: () => setInactivityTimeout(win, options),

0 commit comments

Comments
 (0)