Merge pull request #153 from aunetx/feature/fix-thumbar-actions. Fixes #4

feat(patch): make thumbar actions actually work
This commit is contained in:
josselinonduty 2025-08-19 10:43:38 +02:00 committed by GitHub
commit ec0f1aab45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 76 additions and 0 deletions

View File

@ -51,6 +51,7 @@ prepare: clean install_build_deps
@echo "11 - Hide Application is offline banner (https://github.com/aunetx/deezer-linux/pull/124)"
@echo "12 - Disable animations (https://github.com/aunetx/deezer-linux/pull/133)"
@echo "13 - Disable notifications (https://github.com/aunetx/deezer-linux/pull/151)"
@echo "14 - Make thumbar actions work (https://github.com/aunetx/deezer-linux/pull/153)"
@$(foreach p, $(wildcard ./patches/*), patch -p 1 -d $(APP_DIR) < $(p);)

View File

@ -0,0 +1,75 @@
From 7eb249657ab10516c7dff5d3f3be93b262a8d749 Mon Sep 17 00:00:00 2001
From: josselinonduty <contact@josselinonduty.fr>
Date: Fri, 15 Aug 2025 01:13:08 +0200
Subject: [PATCH] feat: make thumbar actions actually work
---
build/main.js | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/build/main.js b/build/main.js
index 315cab4..241dd72 100644
--- a/build/main.js
+++ b/build/main.js
@@ -1598,6 +1598,8 @@
return this.getPasteOptions();
case MenuItemType.PlayerPlay:
return this.getPlayerPlayOptions();
+ case MenuItemType.PlayerPlayThumbar:
+ return this.getPlayerPlayOptionsThumbar();
case MenuItemType.PlayerNext:
return this.getPlayerNextOptions();
case MenuItemType.PlayerPrev:
@@ -1738,15 +1740,26 @@
}),
};
}
+ getPlayerPlayOptionsThumbar() {
+ const { state } = this.media.getPlayerInfo(),
+ isPlaying = state === MediaPlayerState.Playing;
+ return {
+ label: i18n_t(isPlaying ? "menu_pause_label" : "menu_play_label"),
+ enabled: this.user.isLoggedIn(),
+ click: () => {
+ isPlaying ? this.media.pause() : this.media.play();
+ },
+ };
+ }
getPlayerNextOptions() {
const { canNext } = this.media.getPlayerInfo();
return {
label: i18n_t("menu_next_label"),
enabled: this.user.isLoggedIn() && canNext,
accelerator: "Shift+Right",
- click: noAcceleratorTrigger(() => {
+ click: () => {
this.media.next();
- }),
+ },
};
}
getPlayerPrevOptions() {
@@ -1755,9 +1768,9 @@
label: i18n_t("menu_previous_label"),
enabled: this.user.isLoggedIn() && canPrev,
accelerator: "Shift+Left",
- click: noAcceleratorTrigger(() => {
+ click: () => {
this.media.prev();
- }),
+ },
};
}
getPlayerShuffleOptions() {
@@ -2410,7 +2423,7 @@
external_electron_namespaceObject.Menu.buildFromTemplate([
this.menu.getItem(MenuItemType.Open),
this.menu.getItem(MenuItemType.Separator),
- this.menu.getItem(MenuItemType.PlayerPlay),
+ this.menu.getItem(MenuItemType.PlayerPlayThumbar),
this.menu.getItem(MenuItemType.PlayerNext),
this.menu.getItem(MenuItemType.PlayerPrev),
this.menu.getItem(MenuItemType.Separator),
--
2.48.1