2024-01-30 11:29:07 -05:00
|
|
|
const Mpris = await Service.import('mpris');
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2024-01-30 11:29:07 -05:00
|
|
|
const { Button, Icon, Label, Stack, Slider, CenterBox, Box } = Widget;
|
|
|
|
const { execAsync, lookUpIcon, readFileAsync } = Utils;
|
2023-10-02 12:06:35 -04:00
|
|
|
|
2024-01-13 23:38:31 -05:00
|
|
|
import Separator from '../misc/separator.ts';
|
|
|
|
import CursorBox from '../misc/cursorbox.ts';
|
2023-09-15 23:22:16 -04:00
|
|
|
|
2023-11-28 12:24:58 -05:00
|
|
|
const ICON_SIZE = 32;
|
|
|
|
|
2023-09-15 23:22:16 -04:00
|
|
|
const icons = {
|
2023-10-20 23:11:21 -04:00
|
|
|
mpris: {
|
|
|
|
fallback: 'audio-x-generic-symbolic',
|
|
|
|
shuffle: {
|
|
|
|
enabled: '',
|
|
|
|
disabled: '',
|
|
|
|
},
|
|
|
|
loop: {
|
|
|
|
none: '',
|
|
|
|
track: '',
|
|
|
|
playlist: '',
|
|
|
|
},
|
|
|
|
playing: ' ',
|
|
|
|
paused: ' ',
|
|
|
|
stopped: ' ',
|
|
|
|
prev: '',
|
|
|
|
next: '',
|
2023-09-15 23:22:16 -04:00
|
|
|
},
|
2023-10-20 23:11:21 -04:00
|
|
|
};
|
2023-09-15 23:22:16 -04:00
|
|
|
|
2024-01-13 11:15:08 -05:00
|
|
|
// Types
|
2024-01-13 23:38:31 -05:00
|
|
|
import { MprisPlayer } from 'types/service/mpris.ts';
|
2024-01-13 11:15:08 -05:00
|
|
|
import { Variable as Var } from 'types/variable';
|
2024-01-29 18:54:07 -05:00
|
|
|
|
|
|
|
import {
|
|
|
|
AgsWidget,
|
|
|
|
CenterBoxPropsGeneric,
|
|
|
|
Colors,
|
|
|
|
PlayerBox,
|
|
|
|
PlayerButtonType,
|
|
|
|
PlayerDrag,
|
|
|
|
PlayerOverlay,
|
|
|
|
} from 'global-types';
|
2024-01-13 11:15:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
export const CoverArt = (
|
|
|
|
player: MprisPlayer,
|
2024-01-29 18:54:07 -05:00
|
|
|
colors: Var<Colors>,
|
|
|
|
props: CenterBoxPropsGeneric,
|
2024-01-13 11:15:08 -05:00
|
|
|
) => CenterBox({
|
2023-10-20 23:11:21 -04:00
|
|
|
...props,
|
|
|
|
vertical: true,
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-18 18:00:30 -05:00
|
|
|
attribute: {
|
|
|
|
bgStyle: '',
|
|
|
|
player,
|
|
|
|
},
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2024-01-29 18:54:07 -05:00
|
|
|
setup: (self: PlayerBox) => {
|
2023-11-01 13:13:30 -04:00
|
|
|
// Give temp cover art
|
2023-12-18 18:00:30 -05:00
|
|
|
readFileAsync(player.cover_path).catch(() => {
|
|
|
|
if (!colors.value && !player.track_cover_url) {
|
2024-02-11 02:18:59 -05:00
|
|
|
colors.setValue({
|
2023-11-21 01:29:46 -05:00
|
|
|
imageAccent: '#6b4fa2',
|
|
|
|
buttonAccent: '#ecdcff',
|
|
|
|
buttonText: '#25005a',
|
|
|
|
hoverAccent: '#d4baff',
|
2024-02-11 02:18:59 -05:00
|
|
|
});
|
2023-10-31 12:27:59 -04:00
|
|
|
|
2023-12-18 18:00:30 -05:00
|
|
|
self.attribute.bgStyle = `
|
2023-11-01 13:13:30 -04:00
|
|
|
background: radial-gradient(circle,
|
|
|
|
rgba(0, 0, 0, 0.4) 30%,
|
2024-02-11 02:18:59 -05:00
|
|
|
${(colors as Var<Colors>).value.imageAccent}),
|
2023-11-01 13:13:30 -04:00
|
|
|
rgb(0, 0, 0);
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;
|
|
|
|
`;
|
2023-12-18 18:00:30 -05:00
|
|
|
self.setCss(self.attribute.bgStyle);
|
2023-11-01 13:13:30 -04:00
|
|
|
}
|
|
|
|
});
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-17 00:01:58 -05:00
|
|
|
self.hook(player, () => {
|
2023-12-18 18:00:30 -05:00
|
|
|
execAsync(['bash', '-c', `[[ -f "${player.cover_path}" ]] &&
|
|
|
|
coloryou "${player.cover_path}" | grep -v Warning`])
|
2023-12-17 00:01:58 -05:00
|
|
|
.then((out) => {
|
|
|
|
if (!Mpris.players.find((p) => player === p)) {
|
|
|
|
return;
|
|
|
|
}
|
2023-09-26 14:17:13 -04:00
|
|
|
|
2024-02-11 02:18:59 -05:00
|
|
|
colors.setValue(JSON.parse(out));
|
2023-10-17 13:47:02 -04:00
|
|
|
|
2023-12-18 18:00:30 -05:00
|
|
|
self.attribute.bgStyle = `
|
|
|
|
background: radial-gradient(circle,
|
|
|
|
rgba(0, 0, 0, 0.4) 30%,
|
|
|
|
${colors.value.imageAccent}),
|
|
|
|
url("${player.cover_path}");
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;
|
|
|
|
`;
|
2023-10-17 13:47:02 -04:00
|
|
|
|
2024-01-29 18:54:07 -05:00
|
|
|
if (!(self.get_parent() as PlayerDrag)
|
2024-01-13 11:15:08 -05:00
|
|
|
.attribute.dragging) {
|
2023-12-18 18:00:30 -05:00
|
|
|
self.setCss(self.attribute.bgStyle);
|
2023-12-17 00:01:58 -05:00
|
|
|
}
|
|
|
|
}).catch((err) => {
|
|
|
|
if (err !== '') {
|
|
|
|
print(err);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
2023-09-15 23:22:16 -04:00
|
|
|
});
|
|
|
|
|
2024-01-13 11:15:08 -05:00
|
|
|
export const TitleLabel = (player: MprisPlayer) => Label({
|
2023-10-20 23:11:21 -04:00
|
|
|
xalign: 0,
|
2023-12-18 18:00:30 -05:00
|
|
|
max_width_chars: 40,
|
2023-10-20 23:11:21 -04:00
|
|
|
truncate: 'end',
|
|
|
|
justification: 'left',
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'title',
|
|
|
|
label: player.bind('track_title'),
|
2023-09-15 23:22:16 -04:00
|
|
|
});
|
|
|
|
|
2024-01-13 11:15:08 -05:00
|
|
|
export const ArtistLabel = (player: MprisPlayer) => Label({
|
2023-10-20 23:11:21 -04:00
|
|
|
xalign: 0,
|
2023-12-18 18:00:30 -05:00
|
|
|
max_width_chars: 40,
|
2023-10-20 23:11:21 -04:00
|
|
|
truncate: 'end',
|
|
|
|
justification: 'left',
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'artist',
|
|
|
|
label: player.bind('track_artists')
|
|
|
|
.transform((a) => a.join(', ') || ''),
|
2023-09-15 23:22:16 -04:00
|
|
|
});
|
|
|
|
|
2023-12-18 18:00:30 -05:00
|
|
|
|
2024-01-29 18:54:07 -05:00
|
|
|
export const PlayerIcon = (player: MprisPlayer, overlay: PlayerOverlay) => {
|
2024-01-13 11:15:08 -05:00
|
|
|
const playerIcon = (
|
|
|
|
p: MprisPlayer,
|
2024-01-29 18:54:07 -05:00
|
|
|
widget?: PlayerOverlay,
|
|
|
|
playerBox?: PlayerBox,
|
2024-01-13 11:15:08 -05:00
|
|
|
) => CursorBox({
|
2023-12-18 18:00:30 -05:00
|
|
|
tooltip_text: p.identity || '',
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-18 23:20:32 -05:00
|
|
|
on_primary_click_release: () => {
|
2024-01-29 18:54:07 -05:00
|
|
|
if (widget && playerBox) {
|
|
|
|
widget.attribute.moveToTop(playerBox);
|
|
|
|
}
|
2023-11-28 12:24:58 -05:00
|
|
|
},
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-11-28 12:24:58 -05:00
|
|
|
child: Icon({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: widget ? 'position-indicator' : 'player-icon',
|
|
|
|
size: widget ? 0 : ICON_SIZE,
|
2023-11-28 12:24:58 -05:00
|
|
|
|
2023-12-17 00:01:58 -05:00
|
|
|
setup: (self) => {
|
|
|
|
self.hook(p, () => {
|
|
|
|
self.icon = lookUpIcon(p.entry) ?
|
|
|
|
p.entry :
|
|
|
|
icons.mpris.fallback;
|
|
|
|
});
|
|
|
|
},
|
2023-11-28 12:24:58 -05:00
|
|
|
}),
|
2023-10-20 23:11:21 -04:00
|
|
|
});
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-18 18:00:30 -05:00
|
|
|
return Box().hook(Mpris, (self) => {
|
2024-01-29 18:54:07 -05:00
|
|
|
const grandPa = self.get_parent()?.get_parent() as AgsWidget;
|
2024-01-13 11:15:08 -05:00
|
|
|
|
|
|
|
if (!grandPa) {
|
|
|
|
return;
|
|
|
|
}
|
2023-12-17 00:01:58 -05:00
|
|
|
|
2024-01-13 11:15:08 -05:00
|
|
|
const thisIndex = overlay.overlays
|
|
|
|
.indexOf(grandPa);
|
|
|
|
|
2024-01-29 18:54:07 -05:00
|
|
|
self.children = (overlay.overlays as PlayerBox[])
|
|
|
|
.map((playerBox, i) => {
|
2023-12-18 18:00:30 -05:00
|
|
|
self.children.push(Separator(2));
|
2023-12-17 00:01:58 -05:00
|
|
|
|
2023-12-18 18:00:30 -05:00
|
|
|
return i === thisIndex ?
|
|
|
|
playerIcon(player) :
|
2024-01-29 18:54:07 -05:00
|
|
|
playerIcon(playerBox.attribute.player, overlay, playerBox);
|
2023-12-18 18:00:30 -05:00
|
|
|
})
|
|
|
|
.reverse();
|
2023-11-01 14:33:06 -04:00
|
|
|
});
|
2023-10-20 23:11:21 -04:00
|
|
|
};
|
2023-09-15 23:22:16 -04:00
|
|
|
|
2024-01-11 10:25:53 -05:00
|
|
|
const { Gdk } = imports.gi;
|
|
|
|
const display = Gdk.Display.get_default();
|
|
|
|
|
2024-01-13 11:15:08 -05:00
|
|
|
export const PositionSlider = (
|
|
|
|
player: MprisPlayer,
|
2024-01-29 18:54:07 -05:00
|
|
|
colors: Var<Colors>,
|
2024-01-13 11:15:08 -05:00
|
|
|
) => Slider({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'position-slider',
|
2023-11-16 15:02:00 -05:00
|
|
|
vpack: 'center',
|
|
|
|
hexpand: true,
|
2023-12-18 18:00:30 -05:00
|
|
|
draw_value: false,
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-18 18:00:30 -05:00
|
|
|
on_change: ({ value }) => {
|
2023-11-16 15:02:00 -05:00
|
|
|
player.position = player.length * value;
|
|
|
|
},
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-17 00:01:58 -05:00
|
|
|
setup: (self) => {
|
|
|
|
const update = () => {
|
|
|
|
if (!self.dragging) {
|
|
|
|
self.visible = player.length > 0;
|
|
|
|
if (player.length > 0) {
|
|
|
|
self.value = player.position / player.length;
|
|
|
|
}
|
2023-11-21 01:29:46 -05:00
|
|
|
}
|
2023-12-17 00:01:58 -05:00
|
|
|
};
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-17 00:01:58 -05:00
|
|
|
self
|
|
|
|
.poll(1000, () => update())
|
|
|
|
.hook(player, () => update(), 'position')
|
2023-12-18 18:00:30 -05:00
|
|
|
.hook(colors, () => {
|
|
|
|
if (colors.value) {
|
|
|
|
const c = colors.value;
|
2023-12-17 00:01:58 -05:00
|
|
|
|
|
|
|
self.setCss(`
|
|
|
|
highlight { background-color: ${c.buttonAccent}; }
|
|
|
|
slider { background-color: ${c.buttonAccent}; }
|
|
|
|
slider:hover { background-color: ${c.hoverAccent}; }
|
|
|
|
trough { background-color: ${c.buttonText}; }
|
|
|
|
`);
|
|
|
|
}
|
|
|
|
})
|
2024-01-11 10:25:53 -05:00
|
|
|
|
|
|
|
// OnClick
|
2023-12-18 18:00:30 -05:00
|
|
|
.on('button-press-event', () => {
|
2024-01-22 10:23:32 -05:00
|
|
|
if (!display) {
|
|
|
|
return;
|
|
|
|
}
|
2024-01-11 10:25:53 -05:00
|
|
|
self.window.set_cursor(Gdk.Cursor.new_from_name(
|
|
|
|
display,
|
|
|
|
'grabbing',
|
|
|
|
));
|
2023-12-17 00:01:58 -05:00
|
|
|
})
|
2024-01-11 10:25:53 -05:00
|
|
|
|
|
|
|
// OnRelease
|
2023-12-18 18:00:30 -05:00
|
|
|
.on('button-release-event', () => {
|
2024-01-22 10:23:32 -05:00
|
|
|
if (!display) {
|
|
|
|
return;
|
|
|
|
}
|
2024-01-11 10:25:53 -05:00
|
|
|
self.window.set_cursor(Gdk.Cursor.new_from_name(
|
|
|
|
display,
|
|
|
|
'pointer',
|
|
|
|
));
|
|
|
|
})
|
|
|
|
|
|
|
|
// OnHover
|
|
|
|
.on('enter-notify-event', () => {
|
2024-01-22 10:23:32 -05:00
|
|
|
if (!display) {
|
|
|
|
return;
|
|
|
|
}
|
2024-01-11 10:25:53 -05:00
|
|
|
self.window.set_cursor(Gdk.Cursor.new_from_name(
|
|
|
|
display,
|
|
|
|
'pointer',
|
|
|
|
));
|
|
|
|
self.toggleClassName('hover', true);
|
|
|
|
})
|
|
|
|
|
|
|
|
// OnHoverLost
|
|
|
|
.on('leave-notify-event', () => {
|
|
|
|
self.window.set_cursor(null);
|
|
|
|
self.toggleClassName('hover', false);
|
2023-12-17 00:01:58 -05:00
|
|
|
});
|
|
|
|
},
|
2023-09-15 23:22:16 -04:00
|
|
|
});
|
|
|
|
|
2023-12-18 23:20:32 -05:00
|
|
|
const PlayerButton = ({
|
|
|
|
player,
|
|
|
|
colors,
|
2024-02-03 14:25:47 -05:00
|
|
|
children = {},
|
2023-12-18 23:20:32 -05:00
|
|
|
onClick,
|
|
|
|
prop,
|
2024-01-13 11:15:08 -05:00
|
|
|
}: PlayerButtonType) => CursorBox({
|
2023-11-16 15:02:00 -05:00
|
|
|
child: Button({
|
2023-12-18 18:00:30 -05:00
|
|
|
attribute: { hovered: false },
|
2024-02-03 14:25:47 -05:00
|
|
|
child: Stack({ children }),
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-18 18:00:30 -05:00
|
|
|
on_primary_click_release: () => player[onClick](),
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-18 18:00:30 -05:00
|
|
|
on_hover: (self) => {
|
|
|
|
self.attribute.hovered = true;
|
2023-10-20 23:11:21 -04:00
|
|
|
|
2023-12-18 18:00:30 -05:00
|
|
|
if (prop === 'playBackStatus' && colors.value) {
|
|
|
|
const c = colors.value;
|
2023-11-28 12:24:58 -05:00
|
|
|
|
2024-02-03 14:25:47 -05:00
|
|
|
Object.values(children).forEach((ch: AgsWidget) => {
|
|
|
|
ch.setCss(`
|
2023-12-17 00:01:58 -05:00
|
|
|
background-color: ${c.hoverAccent};
|
|
|
|
color: ${c.buttonText};
|
|
|
|
min-height: 40px;
|
|
|
|
min-width: 36px;
|
|
|
|
margin-bottom: 1px;
|
|
|
|
margin-right: 1px;
|
|
|
|
`);
|
2023-11-16 15:02:00 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-18 18:00:30 -05:00
|
|
|
on_hover_lost: (self) => {
|
|
|
|
self.attribute.hovered = false;
|
|
|
|
if (prop === 'playBackStatus' && colors.value) {
|
|
|
|
const c = colors.value;
|
2023-11-28 12:24:58 -05:00
|
|
|
|
2024-02-03 14:25:47 -05:00
|
|
|
Object.values(children).forEach((ch: AgsWidget) => {
|
|
|
|
ch.setCss(`
|
2023-12-17 00:01:58 -05:00
|
|
|
background-color: ${c.buttonAccent};
|
|
|
|
color: ${c.buttonText};
|
|
|
|
min-height: 42px;
|
|
|
|
min-width: 38px;
|
|
|
|
`);
|
2023-11-16 15:02:00 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-17 00:01:58 -05:00
|
|
|
setup: (self) => {
|
|
|
|
self
|
|
|
|
.hook(player, () => {
|
2024-02-03 14:25:47 -05:00
|
|
|
self.child.shown = `${player[prop]}`;
|
2023-12-17 00:01:58 -05:00
|
|
|
})
|
2023-12-18 18:00:30 -05:00
|
|
|
.hook(colors, () => {
|
2023-12-17 00:01:58 -05:00
|
|
|
if (!Mpris.players.find((p) => player === p)) {
|
|
|
|
return;
|
|
|
|
}
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-18 18:00:30 -05:00
|
|
|
if (colors.value) {
|
|
|
|
const c = colors.value;
|
2023-12-17 00:01:58 -05:00
|
|
|
|
|
|
|
if (prop === 'playBackStatus') {
|
2023-12-18 18:00:30 -05:00
|
|
|
if (self.attribute.hovered) {
|
2024-02-03 14:25:47 -05:00
|
|
|
Object.values(children)
|
|
|
|
.forEach((ch: AgsWidget) => {
|
|
|
|
ch.setCss(`
|
|
|
|
background-color: ${c.hoverAccent};
|
|
|
|
color: ${c.buttonText};
|
|
|
|
min-height: 40px;
|
|
|
|
min-width: 36px;
|
|
|
|
margin-bottom: 1px;
|
|
|
|
margin-right: 1px;
|
|
|
|
`);
|
|
|
|
});
|
2023-12-17 00:01:58 -05:00
|
|
|
}
|
|
|
|
else {
|
2024-02-03 14:25:47 -05:00
|
|
|
Object.values(children)
|
|
|
|
.forEach((ch: AgsWidget) => {
|
|
|
|
ch.setCss(`
|
|
|
|
background-color: ${c.buttonAccent};
|
|
|
|
color: ${c.buttonText};
|
|
|
|
min-height: 42px;
|
|
|
|
min-width: 38px;
|
|
|
|
`);
|
|
|
|
});
|
2023-12-17 00:01:58 -05:00
|
|
|
}
|
2023-11-16 15:02:00 -05:00
|
|
|
}
|
|
|
|
else {
|
2023-12-17 00:01:58 -05:00
|
|
|
self.setCss(`
|
|
|
|
* { color: ${c.buttonAccent}; }
|
|
|
|
*:hover { color: ${c.hoverAccent}; }
|
|
|
|
`);
|
2023-11-16 15:02:00 -05:00
|
|
|
}
|
2023-10-20 23:11:21 -04:00
|
|
|
}
|
2023-12-17 00:01:58 -05:00
|
|
|
});
|
|
|
|
},
|
2023-11-16 15:02:00 -05:00
|
|
|
}),
|
2023-09-15 23:22:16 -04:00
|
|
|
});
|
|
|
|
|
2024-01-13 11:15:08 -05:00
|
|
|
export const ShuffleButton = (
|
|
|
|
player: MprisPlayer,
|
2024-01-29 18:54:07 -05:00
|
|
|
colors: Var<Colors>,
|
2024-01-13 11:15:08 -05:00
|
|
|
) => PlayerButton({
|
2023-10-20 23:11:21 -04:00
|
|
|
player,
|
2023-12-18 18:00:30 -05:00
|
|
|
colors,
|
2024-02-03 14:25:47 -05:00
|
|
|
children: {
|
|
|
|
true: Label({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'shuffle enabled',
|
2023-10-20 23:11:21 -04:00
|
|
|
label: icons.mpris.shuffle.enabled,
|
2024-02-03 14:25:47 -05:00
|
|
|
}),
|
|
|
|
false: Label({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'shuffle disabled',
|
2023-10-20 23:11:21 -04:00
|
|
|
label: icons.mpris.shuffle.disabled,
|
2024-02-03 14:25:47 -05:00
|
|
|
}),
|
|
|
|
},
|
2023-10-20 23:11:21 -04:00
|
|
|
onClick: 'shuffle',
|
|
|
|
prop: 'shuffleStatus',
|
2023-09-15 23:22:16 -04:00
|
|
|
});
|
|
|
|
|
2024-01-13 11:15:08 -05:00
|
|
|
export const LoopButton = (
|
|
|
|
player: MprisPlayer,
|
2024-01-29 18:54:07 -05:00
|
|
|
colors: Var<Colors>,
|
2024-01-13 11:15:08 -05:00
|
|
|
) => PlayerButton({
|
2023-10-20 23:11:21 -04:00
|
|
|
player,
|
2023-12-18 18:00:30 -05:00
|
|
|
colors,
|
2024-02-03 14:25:47 -05:00
|
|
|
children: {
|
|
|
|
None: Label({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'loop none',
|
2023-10-20 23:11:21 -04:00
|
|
|
label: icons.mpris.loop.none,
|
2024-02-03 14:25:47 -05:00
|
|
|
}),
|
|
|
|
Track: Label({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'loop track',
|
2023-10-20 23:11:21 -04:00
|
|
|
label: icons.mpris.loop.track,
|
2024-02-03 14:25:47 -05:00
|
|
|
}),
|
|
|
|
Playlist: Label({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'loop playlist',
|
2023-10-20 23:11:21 -04:00
|
|
|
label: icons.mpris.loop.playlist,
|
2024-02-03 14:25:47 -05:00
|
|
|
}),
|
|
|
|
},
|
2023-10-20 23:11:21 -04:00
|
|
|
onClick: 'loop',
|
|
|
|
prop: 'loopStatus',
|
2023-09-15 23:22:16 -04:00
|
|
|
});
|
|
|
|
|
2024-01-13 11:15:08 -05:00
|
|
|
export const PlayPauseButton = (
|
|
|
|
player: MprisPlayer,
|
2024-01-29 18:54:07 -05:00
|
|
|
colors: Var<Colors>,
|
2024-01-13 11:15:08 -05:00
|
|
|
) => PlayerButton({
|
2023-10-20 23:11:21 -04:00
|
|
|
player,
|
2023-12-18 18:00:30 -05:00
|
|
|
colors,
|
2024-02-03 14:25:47 -05:00
|
|
|
children: {
|
|
|
|
Playing: Label({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'pausebutton playing',
|
2023-10-20 23:11:21 -04:00
|
|
|
label: icons.mpris.playing,
|
2024-02-03 14:25:47 -05:00
|
|
|
}),
|
|
|
|
Paused: Label({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'pausebutton paused',
|
2023-10-20 23:11:21 -04:00
|
|
|
label: icons.mpris.paused,
|
2024-02-03 14:25:47 -05:00
|
|
|
}),
|
|
|
|
Stopped: Label({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'pausebutton stopped paused',
|
2023-10-20 23:11:21 -04:00
|
|
|
label: icons.mpris.stopped,
|
2024-02-03 14:25:47 -05:00
|
|
|
}),
|
|
|
|
},
|
2023-10-20 23:11:21 -04:00
|
|
|
onClick: 'playPause',
|
|
|
|
prop: 'playBackStatus',
|
2023-09-15 23:22:16 -04:00
|
|
|
});
|
|
|
|
|
2024-01-13 11:15:08 -05:00
|
|
|
export const PreviousButton = (
|
|
|
|
player: MprisPlayer,
|
2024-01-29 18:54:07 -05:00
|
|
|
colors: Var<Colors>,
|
2024-01-13 11:15:08 -05:00
|
|
|
) => PlayerButton({
|
2023-10-20 23:11:21 -04:00
|
|
|
player,
|
2023-12-18 18:00:30 -05:00
|
|
|
colors,
|
2024-02-03 14:25:47 -05:00
|
|
|
children: {
|
|
|
|
true: Label({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'previous',
|
2023-10-20 23:11:21 -04:00
|
|
|
label: icons.mpris.prev,
|
2024-02-03 14:25:47 -05:00
|
|
|
}),
|
|
|
|
false: Label({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'previous',
|
2023-10-20 23:11:21 -04:00
|
|
|
label: icons.mpris.prev,
|
2024-02-03 14:25:47 -05:00
|
|
|
}),
|
|
|
|
},
|
2023-10-20 23:11:21 -04:00
|
|
|
onClick: 'previous',
|
|
|
|
prop: 'canGoPrev',
|
2023-09-15 23:22:16 -04:00
|
|
|
});
|
|
|
|
|
2024-01-13 11:15:08 -05:00
|
|
|
export const NextButton = (
|
|
|
|
player: MprisPlayer,
|
2024-01-29 18:54:07 -05:00
|
|
|
colors: Var<Colors>,
|
2024-01-13 11:15:08 -05:00
|
|
|
) => PlayerButton({
|
2023-10-20 23:11:21 -04:00
|
|
|
player,
|
2023-12-18 18:00:30 -05:00
|
|
|
colors,
|
2024-02-03 14:25:47 -05:00
|
|
|
children: {
|
|
|
|
true: Label({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'next',
|
2023-10-20 23:11:21 -04:00
|
|
|
label: icons.mpris.next,
|
2024-02-03 14:25:47 -05:00
|
|
|
}),
|
|
|
|
false: Label({
|
2023-12-18 18:00:30 -05:00
|
|
|
class_name: 'next',
|
2023-10-20 23:11:21 -04:00
|
|
|
label: icons.mpris.next,
|
2024-02-03 14:25:47 -05:00
|
|
|
}),
|
|
|
|
},
|
2023-10-20 23:11:21 -04:00
|
|
|
onClick: 'next',
|
|
|
|
prop: 'canGoNext',
|
2023-09-15 23:22:16 -04:00
|
|
|
});
|