Make media label togglable (#122)
* make it possible to truncate media title to 0 * undo oopsie * apply @painerp change * make the label togglable * Update widget/settings/pages/config/bar/index.ts Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com> * Update modules/bar/media/index.ts Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com> * Update modules/bar/media/index.ts Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com> * Update modules/bar/media/index.ts Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com> --------- Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user