diff --git a/modules/bar/media/index.ts b/modules/bar/media/index.ts index 7bffc74..1f1a647 100644 --- a/modules/bar/media/index.ts +++ b/modules/bar/media/index.ts @@ -4,7 +4,7 @@ import { openMenu } from "../utils.js"; import options from "options"; import { getCurrentPlayer } from 'lib/shared/media.js'; -const { show_artist, truncation, truncation_size } = options.bar.media; +const { show_artist, truncation, truncation_size, show_label } = options.bar.media; const Media = () => { const activePlayer = Variable(mpris.players[0]); @@ -33,8 +33,8 @@ const Media = () => { const songIcon = Variable(""); - const mediaLabel = Utils.watch("󰎇 Media 󰎇", [mpris, show_artist, truncation, truncation_size], () => { - if (activePlayer.value) { + const mediaLabel = Utils.watch("Media", [mpris, show_artist, truncation, truncation_size, show_label], () => { + if (activePlayer.value && show_label.value) { const { track_title, identity, track_artists } = activePlayer.value; songIcon.value = getIconForPlayer(identity); const trackArtist = show_artist.value @@ -50,8 +50,8 @@ const Media = () => { ? `${truncatedLabel}` : `${truncatedLabel.substring(0, truncatedLabel.length - 3)}...`; } else { - songIcon.value = ""; - return "󰎇 Media 󰎇"; + songIcon.value = getIconForPlayer(activePlayer.value?.identity || ""); + return `Media`; } }); @@ -64,7 +64,7 @@ const Media = () => { children: [ Widget.Label({ class_name: "bar-button-icon media", - label: songIcon.bind("value"), + label: songIcon.bind("value").as(v => v || "󰝚"), }), Widget.Label({ class_name: "bar-button-label media", diff --git a/options.ts b/options.ts index c9db1ce..bb74e78 100644 --- a/options.ts +++ b/options.ts @@ -697,6 +697,7 @@ const options = mkOptions(OPTIONS, { media: { show_artist: opt(false), truncation: opt(true), + show_label: opt(true), truncation_size: opt(30) }, notifications: { diff --git a/widget/settings/pages/config/bar/index.ts b/widget/settings/pages/config/bar/index.ts index be50fda..b72fabf 100644 --- a/widget/settings/pages/config/bar/index.ts +++ b/widget/settings/pages/config/bar/index.ts @@ -73,8 +73,9 @@ export const BarSettings = () => { Header('Media'), Option({ opt: options.theme.bar.buttons.media.spacing, title: 'Inner Spacing', subtitle: 'Spacing between the icon and the label inside the buttons.', type: 'string' }), Option({ opt: options.bar.media.show_artist, title: 'Show Track Artist', type: 'boolean' }), - Option({ opt: options.bar.media.truncation, title: 'Truncate Media Label', type: 'boolean' }), - Option({ opt: options.bar.media.truncation_size, title: 'Truncation Size', type: 'number', min: 10 }), + Option({ opt: options.bar.media.show_label, title: 'Toggle Media Label', type: 'boolean' }), + Option({ opt: options.bar.media.truncation, title: 'Truncate Media Label', subtitle: 'Only applicable if Toggle Media Label is enabled', type: 'boolean' }), + Option({ opt: options.bar.media.truncation_size, title: 'Truncation Size', subtitle: 'Only applicable if Toggle Media Label is enabled', type: 'number', min: 10 }), Header('Notifications'), Option({ opt: options.bar.notifications.show_total, title: 'Show Total # of notifications', type: 'boolean' }), @@ -82,4 +83,4 @@ export const BarSettings = () => { ] }) }) -} \ No newline at end of file +}