Compare commits

..

8 Commits

Author SHA1 Message Date
02e2fb6a83 Bump version to 3.4.1 2024-07-15 00:18:37 +09:00
91bee4880e chore(i18n): Translated using Weblate (Spanish)
Currently translated at 100.0% (355 of 355 strings)

Translation: th-ch/youtube-music/i18n
Translate-URL: https://hosted.weblate.org/projects/youtube-music/i18n/es/
2024-07-14 17:15:57 +02:00
7de7303ebb fix(mpris): fix mpris position
- fix #2225
2024-07-15 00:14:49 +09:00
363d869cff fix(deb): fix depends
- fix #1983
2024-07-14 23:48:15 +09:00
2512af80af fix: fix touchbar icon
- fix #2183
2024-07-14 23:19:06 +09:00
887979932c fix: fix "Starting page"
- fix #1822
2024-07-14 22:59:05 +09:00
eeaaf2f158 fix: fix album actions
- fix #2202
2024-07-14 22:50:24 +09:00
e91e995b95 fix: fix playback slider
- fix #2045
2024-07-14 22:32:56 +09:00
12 changed files with 271 additions and 228 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "youtube-music", "name": "youtube-music",
"productName": "YouTube Music", "productName": "YouTube Music",
"version": "3.4.0", "version": "3.4.1",
"description": "YouTube Music Desktop App - including custom plugins", "description": "YouTube Music Desktop App - including custom plugins",
"main": "./dist/main/index.js", "main": "./dist/main/index.js",
"license": "MIT", "license": "MIT",
@ -77,6 +77,20 @@
"rpm" "rpm"
] ]
}, },
"deb": {
"depends": [
"libgtk-3-0",
"libnotify4",
"libnss3",
"libxss1",
"libxtst6",
"xdg-utils",
"libatspi2.0-0",
"libuuid1",
"libasound2",
"libgbm1"
]
},
"rpm": { "rpm": {
"depends": [ "depends": [
"/usr/lib64/libuuid.so.1" "/usr/lib64/libuuid.so.1"

View File

@ -410,6 +410,21 @@
"description": "Descarga MP3 / audio fuente directamente desde la interfaz", "description": "Descarga MP3 / audio fuente directamente desde la interfaz",
"menu": { "menu": {
"choose-download-folder": "Elija la carpeta de descarga", "choose-download-folder": "Elija la carpeta de descarga",
"download-finish-settings": {
"label": "Descargar al finalizar",
"prompt": {
"last-percent": "Después del x por ciento",
"last-seconds": "Últimos x segundos",
"title": "Configurar cuándo descargar"
},
"submenu": {
"advanced": "Avanzado",
"enabled": "Activado",
"mode": "Modo de tiempo",
"percent": "Porcentaje",
"seconds": "Segundos"
}
},
"download-playlist": "Descargar lista de reproducción", "download-playlist": "Descargar lista de reproducción",
"presets": "Preajustes", "presets": "Preajustes",
"skip-existing": "Saltar archivos existentes" "skip-existing": "Saltar archivos existentes"

View File

@ -112,8 +112,13 @@ export default createPlugin<
i++; i++;
} }
} }
const menu = document.querySelector('.detail-page-menu'); const menuParent = document.querySelector('#action-buttons')?.parentElement;
if (menu && !document.querySelector('.like-menu')) { if (menuParent && !document.querySelector('.like-menu')) {
const menu = document.createElement('div');
menu.id = 'ytmd-album-action-buttons';
menu.className = 'action-buttons style-scope ytmusic-responsive-header-renderer';
menuParent.insertBefore(menu, menuParent.children[menuParent.children.length - 1]);
for (const button of buttons) { for (const button of buttons) {
menu.appendChild(button); menu.appendChild(button);
button.addEventListener('click', this.loadFullList); button.addEventListener('click', this.loadFullList);

View File

@ -1,40 +1,58 @@
<button <div class="style-scope">
id="alldislike" <button
data-type="dislike" id="alldislike"
data-filled="false" data-type="dislike"
class="like-menu yt-spec-button-shape-next yt-spec-button-shape-next--text yt-spec-button-shape-next--mono yt-spec-button-shape-next--size-m yt-spec-button-shape-next--icon-button" data-filled="false"
aria-pressed="false" class="like-menu yt-spec-button-shape-next yt-spec-button-shape-next--text yt-spec-button-shape-next--mono yt-spec-button-shape-next--size-m yt-spec-button-shape-next--icon-button"
aria-label="Dislike all" aria-pressed="false"
> aria-label="Dislike all"
<div
class="yt-spec-button-shape-next__icon"
style="color: var(--ytmusic-setting-item-toggle-active)"
aria-hidden="true"
> >
<div <div
class="yt-spec-button-shape-next__icon" class="yt-spec-button-shape-next__icon"
style=" style="color: var(--ytmusic-setting-item-toggle-active)"
color: white;
-webkit-mask: linear-gradient(grey, grey);
-webkit-mask-size: 100% 50%;
-webkit-mask-repeat: no-repeat;
z-index: 1;
position: absolute;
"
aria-hidden="true" aria-hidden="true"
> >
<div
class="yt-spec-button-shape-next__icon"
style="
color: white;
-webkit-mask: linear-gradient(grey, grey);
-webkit-mask-size: 100% 50%;
-webkit-mask-repeat: no-repeat;
z-index: 1;
position: absolute;
"
aria-hidden="true"
>
<div style="width: 24px; height: 24px">
<svg
viewBox="0 0 24 24"
preserveAspectRatio="xMidYMid meet"
focusable="false"
class="style-scope yt-icon"
style="
pointer-events: none;
display: block;
width: 100%;
height: 100%;
"
>
<g class="style-scope yt-icon">
<path
d="M18,4h3v10h-3V4z M5.23,14h4.23l-1.52,4.94C7.62,19.97,8.46,21,9.62,21c0.58,0,1.14-0.24,1.52-0.65L17,14V4H6.57 C5.5,4,4.59,4.67,4.38,5.61l-1.34,6C2.77,12.85,3.82,14,5.23,14z"
class="style-scope yt-icon"
></path>
</g>
</svg>
</div>
</div>
<div style="width: 24px; height: 24px"> <div style="width: 24px; height: 24px">
<svg <svg
viewBox="0 0 24 24" viewBox="0 0 24 24"
preserveAspectRatio="xMidYMid meet" preserveAspectRatio="xMidYMid meet"
focusable="false" focusable="false"
class="style-scope yt-icon" class="style-scope yt-icon"
style=" style="pointer-events: none; display: block; width: 100%; height: 100%"
pointer-events: none;
display: block;
width: 100%;
height: 100%;
"
> >
<g class="style-scope yt-icon"> <g class="style-scope yt-icon">
<path <path
@ -45,30 +63,14 @@
</svg> </svg>
</div> </div>
</div> </div>
<div style="width: 24px; height: 24px"> <yt-touch-feedback-shape style="border-radius: inherit">
<svg <div
viewBox="0 0 24 24" class="yt-spec-touch-feedback-shape yt-spec-touch-feedback-shape--touch-response"
preserveAspectRatio="xMidYMid meet" aria-hidden="true"
focusable="false"
class="style-scope yt-icon"
style="pointer-events: none; display: block; width: 100%; height: 100%"
> >
<g class="style-scope yt-icon"> <div class="yt-spec-touch-feedback-shape__stroke"></div>
<path <div class="yt-spec-touch-feedback-shape__fill"></div>
d="M18,4h3v10h-3V4z M5.23,14h4.23l-1.52,4.94C7.62,19.97,8.46,21,9.62,21c0.58,0,1.14-0.24,1.52-0.65L17,14V4H6.57 C5.5,4,4.59,4.67,4.38,5.61l-1.34,6C2.77,12.85,3.82,14,5.23,14z" </div>
class="style-scope yt-icon" </yt-touch-feedback-shape>
></path> </button>
</g> </div>
</svg>
</div>
</div>
<yt-touch-feedback-shape style="border-radius: inherit">
<div
class="yt-spec-touch-feedback-shape yt-spec-touch-feedback-shape--touch-response"
aria-hidden="true"
>
<div class="yt-spec-touch-feedback-shape__stroke"></div>
<div class="yt-spec-touch-feedback-shape__fill"></div>
</div>
</yt-touch-feedback-shape>
</button>

View File

@ -1,40 +1,58 @@
<button <div class="style-scope">
id="alllike" <button
data-type="like" id="alllike"
data-filled="false" data-type="like"
class="like-menu yt-spec-button-shape-next yt-spec-button-shape-next--text yt-spec-button-shape-next--mono yt-spec-button-shape-next--size-m yt-spec-button-shape-next--icon-button" data-filled="false"
aria-pressed="false" class="like-menu yt-spec-button-shape-next yt-spec-button-shape-next--text yt-spec-button-shape-next--mono yt-spec-button-shape-next--size-m yt-spec-button-shape-next--icon-button"
aria-label="Like all" aria-pressed="false"
> aria-label="Like all"
<div
class="yt-spec-button-shape-next__icon"
style="color: var(--ytmusic-setting-item-toggle-active)"
aria-hidden="true"
> >
<div <div
class="yt-spec-button-shape-next__icon" class="yt-spec-button-shape-next__icon"
style=" style="color: var(--ytmusic-setting-item-toggle-active)"
color: white;
-webkit-mask: linear-gradient(grey, grey);
-webkit-mask-size: 100% 50%;
-webkit-mask-repeat: no-repeat;
z-index: 1;
position: absolute;
"
aria-hidden="true" aria-hidden="true"
> >
<div
class="yt-spec-button-shape-next__icon"
style="
color: white;
-webkit-mask: linear-gradient(grey, grey);
-webkit-mask-size: 100% 50%;
-webkit-mask-repeat: no-repeat;
z-index: 1;
position: absolute;
"
aria-hidden="true"
>
<div style="width: 24px; height: 24px">
<svg
viewBox="0 0 24 24"
preserveAspectRatio="xMidYMid meet"
focusable="false"
class="style-scope yt-icon"
style="
pointer-events: none;
display: block;
width: 100%;
height: 100%;
"
>
<g class="style-scope yt-icon">
<path
d="M3,11h3v10H3V11z M18.77,11h-4.23l1.52-4.94C16.38,5.03,15.54,4,14.38,4c-0.58,0-1.14,0.24-1.52,0.65L7,11v10h10.43 c1.06,0,1.98-0.67,2.19-1.61l1.34-6C21.23,12.15,20.18,11,18.77,11z"
class="style-scope yt-icon"
></path>
</g>
</svg>
</div>
</div>
<div style="width: 24px; height: 24px"> <div style="width: 24px; height: 24px">
<svg <svg
viewBox="0 0 24 24" viewBox="0 0 24 24"
preserveAspectRatio="xMidYMid meet" preserveAspectRatio="xMidYMid meet"
focusable="false" focusable="false"
class="style-scope yt-icon" class="style-scope yt-icon"
style=" style="pointer-events: none; display: block; width: 100%; height: 100%"
pointer-events: none;
display: block;
width: 100%;
height: 100%;
"
> >
<g class="style-scope yt-icon"> <g class="style-scope yt-icon">
<path <path
@ -45,30 +63,14 @@
</svg> </svg>
</div> </div>
</div> </div>
<div style="width: 24px; height: 24px"> <yt-touch-feedback-shape style="border-radius: inherit">
<svg <div
viewBox="0 0 24 24" class="yt-spec-touch-feedback-shape yt-spec-touch-feedback-shape--touch-response"
preserveAspectRatio="xMidYMid meet" aria-hidden="true"
focusable="false"
class="style-scope yt-icon"
style="pointer-events: none; display: block; width: 100%; height: 100%"
> >
<g class="style-scope yt-icon"> <div class="yt-spec-touch-feedback-shape__stroke"></div>
<path <div class="yt-spec-touch-feedback-shape__fill"></div>
d="M3,11h3v10H3V11z M18.77,11h-4.23l1.52-4.94C16.38,5.03,15.54,4,14.38,4c-0.58,0-1.14,0.24-1.52,0.65L7,11v10h10.43 c1.06,0,1.98-0.67,2.19-1.61l1.34-6C21.23,12.15,20.18,11,18.77,11z" </div>
class="style-scope yt-icon" </yt-touch-feedback-shape>
></path> </button>
</g> </div>
</svg>
</div>
</div>
<yt-touch-feedback-shape style="border-radius: inherit">
<div
class="yt-spec-touch-feedback-shape yt-spec-touch-feedback-shape--touch-response"
aria-hidden="true"
>
<div class="yt-spec-touch-feedback-shape__stroke"></div>
<div class="yt-spec-touch-feedback-shape__fill"></div>
</div>
</yt-touch-feedback-shape>
</button>

View File

@ -1,40 +1,58 @@
<button <div class="style-scope">
id="allundislike" <button
data-type="dislike" id="allundislike"
data-filled="true" data-type="dislike"
class="like-menu yt-spec-button-shape-next yt-spec-button-shape-next--text yt-spec-button-shape-next--mono yt-spec-button-shape-next--size-m yt-spec-button-shape-next--icon-button" data-filled="true"
aria-pressed="false" class="like-menu yt-spec-button-shape-next yt-spec-button-shape-next--text yt-spec-button-shape-next--mono yt-spec-button-shape-next--size-m yt-spec-button-shape-next--icon-button"
aria-label="Undislike all" aria-pressed="false"
> aria-label="Undislike all"
<div
class="yt-spec-button-shape-next__icon"
style="color: var(--ytmusic-setting-item-toggle-active)"
aria-hidden="true"
> >
<div <div
class="yt-spec-button-shape-next__icon" class="yt-spec-button-shape-next__icon"
style=" style="color: var(--ytmusic-setting-item-toggle-active)"
color: white;
-webkit-mask: linear-gradient(grey, grey);
-webkit-mask-size: 100% 50%;
-webkit-mask-repeat: no-repeat;
z-index: 1;
position: absolute;
"
aria-hidden="true" aria-hidden="true"
> >
<div
class="yt-spec-button-shape-next__icon"
style="
color: white;
-webkit-mask: linear-gradient(grey, grey);
-webkit-mask-size: 100% 50%;
-webkit-mask-repeat: no-repeat;
z-index: 1;
position: absolute;
"
aria-hidden="true"
>
<div style="width: 24px; height: 24px">
<svg
viewBox="0 0 24 24"
preserveAspectRatio="xMidYMid meet"
focusable="false"
class="style-scope yt-icon"
style="
pointer-events: none;
display: block;
width: 100%;
height: 100%;
"
>
<g class="style-scope yt-icon">
<path
d="M17,4h-1H6.57C5.5,4,4.59,4.67,4.38,5.61l-1.34,6C2.77,12.85,3.82,14,5.23,14h4.23l-1.52,4.94C7.62,19.97,8.46,21,9.62,21 c0.58,0,1.14-0.24,1.52-0.65L17,14h4V4H17z M10.4,19.67C10.21,19.88,9.92,20,9.62,20c-0.26,0-0.5-0.11-0.63-0.3 c-0.07-0.1-0.15-0.26-0.09-0.47l1.52-4.94l0.4-1.29H9.46H5.23c-0.41,0-0.8-0.17-1.03-0.46c-0.12-0.15-0.25-0.4-0.18-0.72l1.34-6 C5.46,5.35,5.97,5,6.57,5H16v8.61L10.4,19.67z M20,13h-3V5h3V13z"
class="style-scope yt-icon"
></path>
</g>
</svg>
</div>
</div>
<div style="width: 24px; height: 24px"> <div style="width: 24px; height: 24px">
<svg <svg
viewBox="0 0 24 24" viewBox="0 0 24 24"
preserveAspectRatio="xMidYMid meet" preserveAspectRatio="xMidYMid meet"
focusable="false" focusable="false"
class="style-scope yt-icon" class="style-scope yt-icon"
style=" style="pointer-events: none; display: block; width: 100%; height: 100%"
pointer-events: none;
display: block;
width: 100%;
height: 100%;
"
> >
<g class="style-scope yt-icon"> <g class="style-scope yt-icon">
<path <path
@ -45,30 +63,14 @@
</svg> </svg>
</div> </div>
</div> </div>
<div style="width: 24px; height: 24px"> <yt-touch-feedback-shape style="border-radius: inherit">
<svg <div
viewBox="0 0 24 24" class="yt-spec-touch-feedback-shape yt-spec-touch-feedback-shape--touch-response"
preserveAspectRatio="xMidYMid meet" aria-hidden="true"
focusable="false"
class="style-scope yt-icon"
style="pointer-events: none; display: block; width: 100%; height: 100%"
> >
<g class="style-scope yt-icon"> <div class="yt-spec-touch-feedback-shape__stroke"></div>
<path <div class="yt-spec-touch-feedback-shape__fill"></div>
d="M17,4h-1H6.57C5.5,4,4.59,4.67,4.38,5.61l-1.34,6C2.77,12.85,3.82,14,5.23,14h4.23l-1.52,4.94C7.62,19.97,8.46,21,9.62,21 c0.58,0,1.14-0.24,1.52-0.65L17,14h4V4H17z M10.4,19.67C10.21,19.88,9.92,20,9.62,20c-0.26,0-0.5-0.11-0.63-0.3 c-0.07-0.1-0.15-0.26-0.09-0.47l1.52-4.94l0.4-1.29H9.46H5.23c-0.41,0-0.8-0.17-1.03-0.46c-0.12-0.15-0.25-0.4-0.18-0.72l1.34-6 C5.46,5.35,5.97,5,6.57,5H16v8.61L10.4,19.67z M20,13h-3V5h3V13z" </div>
class="style-scope yt-icon" </yt-touch-feedback-shape>
></path> </button>
</g> </div>
</svg>
</div>
</div>
<yt-touch-feedback-shape style="border-radius: inherit">
<div
class="yt-spec-touch-feedback-shape yt-spec-touch-feedback-shape--touch-response"
aria-hidden="true"
>
<div class="yt-spec-touch-feedback-shape__stroke"></div>
<div class="yt-spec-touch-feedback-shape__fill"></div>
</div>
</yt-touch-feedback-shape>
</button>

View File

@ -1,40 +1,58 @@
<button <div class="style-scope">
id="allunlike" <button
data-type="like" id="allunlike"
data-filled="true" data-type="like"
class="like-menu yt-spec-button-shape-next yt-spec-button-shape-next--text yt-spec-button-shape-next--mono yt-spec-button-shape-next--size-m yt-spec-button-shape-next--icon-button" data-filled="true"
aria-pressed="false" class="like-menu yt-spec-button-shape-next yt-spec-button-shape-next--text yt-spec-button-shape-next--mono yt-spec-button-shape-next--size-m yt-spec-button-shape-next--icon-button"
aria-label="Unlike all" aria-pressed="false"
> aria-label="Unlike all"
<div
class="yt-spec-button-shape-next__icon"
style="color: var(--ytmusic-setting-item-toggle-active)"
aria-hidden="true"
> >
<div <div
class="yt-spec-button-shape-next__icon" class="yt-spec-button-shape-next__icon"
style=" style="color: var(--ytmusic-setting-item-toggle-active)"
color: white;
-webkit-mask: linear-gradient(grey, grey);
-webkit-mask-size: 100% 50%;
-webkit-mask-repeat: no-repeat;
z-index: 1;
position: absolute;
"
aria-hidden="true" aria-hidden="true"
> >
<div
class="yt-spec-button-shape-next__icon"
style="
color: white;
-webkit-mask: linear-gradient(grey, grey);
-webkit-mask-size: 100% 50%;
-webkit-mask-repeat: no-repeat;
z-index: 1;
position: absolute;
"
aria-hidden="true"
>
<div style="width: 24px; height: 24px">
<svg
viewBox="0 0 24 24"
preserveAspectRatio="xMidYMid meet"
focusable="false"
class="style-scope yt-icon"
style="
pointer-events: none;
display: block;
width: 100%;
height: 100%;
"
>
<g class="style-scope yt-icon">
<path
d="M18.77,11h-4.23l1.52-4.94C16.38,5.03,15.54,4,14.38,4c-0.58,0-1.14,0.24-1.52,0.65L7,11H3v10h4h1h9.43 c1.06,0,1.98-0.67,2.19-1.61l1.34-6C21.23,12.15,20.18,11,18.77,11z M7,20H4v-8h3V20z M19.98,13.17l-1.34,6 C18.54,19.65,18.03,20,17.43,20H8v-8.61l5.6-6.06C13.79,5.12,14.08,5,14.38,5c0.26,0,0.5,0.11,0.63,0.3 c0.07,0.1,0.15,0.26,0.09,0.47l-1.52,4.94L13.18,12h1.35h4.23c0.41,0,0.8,0.17,1.03,0.46C19.92,12.61,20.05,12.86,19.98,13.17z"
class="style-scope yt-icon"
></path>
</g>
</svg>
</div>
</div>
<div style="width: 24px; height: 24px"> <div style="width: 24px; height: 24px">
<svg <svg
viewBox="0 0 24 24" viewBox="0 0 24 24"
preserveAspectRatio="xMidYMid meet" preserveAspectRatio="xMidYMid meet"
focusable="false" focusable="false"
class="style-scope yt-icon" class="style-scope yt-icon"
style=" style="pointer-events: none; display: block; width: 100%; height: 100%"
pointer-events: none;
display: block;
width: 100%;
height: 100%;
"
> >
<g class="style-scope yt-icon"> <g class="style-scope yt-icon">
<path <path
@ -45,30 +63,14 @@
</svg> </svg>
</div> </div>
</div> </div>
<div style="width: 24px; height: 24px"> <yt-touch-feedback-shape style="border-radius: inherit">
<svg <div
viewBox="0 0 24 24" class="yt-spec-touch-feedback-shape yt-spec-touch-feedback-shape--touch-response"
preserveAspectRatio="xMidYMid meet" aria-hidden="true"
focusable="false"
class="style-scope yt-icon"
style="pointer-events: none; display: block; width: 100%; height: 100%"
> >
<g class="style-scope yt-icon"> <div class="yt-spec-touch-feedback-shape__stroke"></div>
<path <div class="yt-spec-touch-feedback-shape__fill"></div>
d="M18.77,11h-4.23l1.52-4.94C16.38,5.03,15.54,4,14.38,4c-0.58,0-1.14,0.24-1.52,0.65L7,11H3v10h4h1h9.43 c1.06,0,1.98-0.67,2.19-1.61l1.34-6C21.23,12.15,20.18,11,18.77,11z M7,20H4v-8h3V20z M19.98,13.17l-1.34,6 C18.54,19.65,18.03,20,17.43,20H8v-8.61l5.6-6.06C13.79,5.12,14.08,5,14.38,5c0.26,0,0.5,0.11,0.63,0.3 c0.07,0.1,0.15,0.26,0.09,0.47l-1.52,4.94L13.18,12h1.35h4.23c0.41,0,0.8,0.17,1.03,0.46C19.92,12.61,20.05,12.86,19.98,13.17z" </div>
class="style-scope yt-icon" </yt-touch-feedback-shape>
></path> </button>
</g> </div>
</svg>
</div>
</div>
<yt-touch-feedback-shape style="border-radius: inherit">
<div
class="yt-spec-touch-feedback-shape yt-spec-touch-feedback-shape--touch-response"
aria-hidden="true"
>
<div class="yt-spec-touch-feedback-shape__stroke"></div>
<div class="yt-spec-touch-feedback-shape__fill"></div>
</div>
</yt-touch-feedback-shape>
</button>

View File

@ -55,9 +55,6 @@ const observePopupContainer = () => {
if ( if (
menu && menu &&
(
menu.parentElement as HTMLElement & { eventSink_: Element | null }
)?.eventSink_?.matches('ytmusic-menu-renderer.ytmusic-player-bar') &&
!menu.contains(slider) !menu.contains(slider)
) { ) {
menu.prepend(slider); menu.prepend(slider);

View File

@ -102,18 +102,21 @@ function registerMPRIS(win: BrowserWindow) {
return videoId.replace(/-/g, '_MINUS_'); return videoId.replace(/-/g, '_MINUS_');
}; };
const player = setupMPRIS();
const seekTo = (event: Position) => { const seekTo = (event: Position) => {
if ( if (
currentSongInfo?.videoId && currentSongInfo?.videoId &&
event.trackId.endsWith(correctId(currentSongInfo.videoId)) event.trackId.endsWith(correctId(currentSongInfo.videoId))
) { ) {
win.webContents.send('ytmd:seek-to', microToSec(event.position ?? 0)); win.webContents.send('ytmd:seek-to', microToSec(event.position ?? 0));
player.setPosition(event.position ?? 0);
} }
}; };
const seekBy = (offset: number) => const seekBy = (offset: number) => {
win.webContents.send('ytmd:seek-by', microToSec(offset)); win.webContents.send('ytmd:seek-by', microToSec(offset));
player.setPosition(player.getPosition() + offset);
const player = setupMPRIS(); };
ipcMain.on('ytmd:player-api-loaded', () => { ipcMain.on('ytmd:player-api-loaded', () => {
win.webContents.send('ytmd:setup-seeked-listener', 'mpris'); win.webContents.send('ytmd:setup-seeked-listener', 'mpris');
@ -126,7 +129,10 @@ function registerMPRIS(win: BrowserWindow) {
requestQueueInformation(); requestQueueInformation();
}); });
ipcMain.on('ytmd:seeked', (_, t: number) => player.seeked(secToMicro(t))); ipcMain.on('ytmd:seeked', (_, t: number) => {
player.setPosition(secToMicro(t));
player.seeked(secToMicro(t));
});
ipcMain.on('ytmd:time-changed', (_, t: number) => { ipcMain.on('ytmd:time-changed', (_, t: number) => {
player.setPosition(secToMicro(t)); player.setPosition(secToMicro(t));

View File

@ -1,10 +1,12 @@
import { type NativeImage, TouchBar } from 'electron'; import { nativeImage, type NativeImage, TouchBar } from 'electron';
import { createPlugin } from '@/utils'; import { createPlugin } from '@/utils';
import getSongControls from '@/providers/song-controls'; import getSongControls from '@/providers/song-controls';
import registerCallback from '@/providers/song-info'; import registerCallback from '@/providers/song-info';
import { t } from '@/i18n'; import { t } from '@/i18n';
import youtubeMusicIcon from '@assets/youtube-music.png?asset&asarUnpack';
export default createPlugin({ export default createPlugin({
name: () => t('plugins.touchbar.name'), name: () => t('plugins.touchbar.name'),
description: () => t('plugins.touchbar.description'), description: () => t('plugins.touchbar.description'),
@ -89,9 +91,9 @@ export default createPlugin({
pausePlayButton.label = songInfo.isPaused ? '▶️' : '⏸'; pausePlayButton.label = songInfo.isPaused ? '▶️' : '⏸';
// Get image source // Get image source
songImage.icon = songInfo.image songImage.icon = (
? songInfo.image.resize({ height: 23 }) songInfo.image ? songInfo.image : nativeImage.createFromPath(youtubeMusicIcon)
: undefined; ).resize({ height: 23 });
window.setTouchBar(touchBar); window.setTouchBar(touchBar);
}); });

View File

@ -17,7 +17,3 @@ export const startingPages: Record<string, string> = {
'Uploaded Albums': 'FEmusic_library_privately_owned_releases', 'Uploaded Albums': 'FEmusic_library_privately_owned_releases',
'Uploaded Artists': 'FEmusic_library_privately_owned_artists', 'Uploaded Artists': 'FEmusic_library_privately_owned_artists',
}; };
export default {
startingPages,
};

View File

@ -35,7 +35,7 @@ async function listenForApiLoad() {
} }
interface YouTubeMusicAppElement extends HTMLElement { interface YouTubeMusicAppElement extends HTMLElement {
navigate_(page: string): void; navigate(page: string): void;
} }
async function onApiLoaded() { async function onApiLoaded() {
@ -167,7 +167,7 @@ async function onApiLoaded() {
if (startingPage && startingPages[startingPage]) { if (startingPage && startingPages[startingPage]) {
document document
.querySelector<YouTubeMusicAppElement>('ytmusic-app') .querySelector<YouTubeMusicAppElement>('ytmusic-app')
?.navigate_(startingPages[startingPage]); ?.navigate(startingPages[startingPage]);
} }
// Remove upgrade button // Remove upgrade button