2024-10-19 15:04:56 +00:00
using Gtk 4.0;
2024-10-28 08:52:50 +00:00
using Adw 1;
2024-10-19 15:04:56 +00:00
2024-10-29 14:46:33 +00:00
template $AudreyUiPlaybar: Adw.Bin {
2024-10-28 08:52:50 +00:00
child: CenterBox {
2024-10-20 10:03:24 +00:00
hexpand: true;
2024-10-28 08:52:50 +00:00
styles [
"toolbar",
]
2024-10-20 10:03:24 +00:00
2024-10-19 15:04:56 +00:00
[start]
Box {
2024-10-20 16:25:40 +00:00
AspectFrame {
visible: false; // FIXME annoying annoying annoying annoying
//visible: bind template.show_cover_art;
vexpand: true;
ratio: 1.0;
obey-child: false;
child: Picture {
content-fit: scale_down;
paintable: bind template.playing_cover_art;
};
2024-10-19 15:04:56 +00:00
}
2024-10-20 15:28:47 +00:00
Box {
margin-start: 6;
orientation: vertical;
valign: center;
Label {
styles [ "heading" ]
xalign: 0;
halign: start;
label: bind $song_title (template.song) as <string>;
ellipsize: end;
}
Label {
styles [ "caption" ]
xalign: 0;
label: bind $song_artist (template.song) as <string>;
ellipsize: end;
}
2024-10-19 15:04:56 +00:00
2024-10-20 15:28:47 +00:00
Label {
styles [ "caption" ]
xalign: 0;
label: bind $song_album (template.song) as <string>;
ellipsize: end;
}
2024-10-19 15:04:56 +00:00
}
}
[center]
Box {
orientation: vertical;
2024-10-20 16:25:40 +00:00
valign: center;
2024-10-19 15:04:56 +00:00
CenterBox {
[start]
Label play_position_label {
styles [
"caption",
"numeric",
]
2024-11-03 18:25:32 +00:00
label: bind $format_timestamp (template.position) as <string>;
2024-10-19 15:04:56 +00:00
}
[center]
Scale play_position {
name: "seek-scale";
orientation: horizontal;
width-request: 400;
2024-11-03 18:25:32 +00:00
//sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
2024-10-19 15:04:56 +00:00
adjustment: Adjustment {
lower: 0;
2024-11-03 18:25:32 +00:00
value: bind template.position;
upper: bind template.duration;
2024-10-19 15:04:56 +00:00
};
2024-10-31 07:17:32 +00:00
change-value => $on_play_position_seek () swapped;
2024-10-19 15:04:56 +00:00
}
[end]
Label play_duration {
styles [
"caption",
"numeric",
]
2024-11-03 18:25:32 +00:00
label: bind $format_timestamp (template.duration) as <string>;
2024-10-19 15:04:56 +00:00
}
}
Box {
halign: center;
orientation: horizontal;
Button {
icon-name: "media-skip-backward";
valign: center;
2024-11-03 18:25:32 +00:00
//sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
2024-10-19 15:04:56 +00:00
2024-10-31 07:17:32 +00:00
clicked => $on_skip_backward_clicked () swapped;
2024-10-19 15:04:56 +00:00
}
Button {
icon-name: "media-seek-backward";
valign: center;
2024-11-03 18:25:32 +00:00
//sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
2024-10-19 15:04:56 +00:00
2024-10-31 07:17:32 +00:00
clicked => $seek_backward () swapped;
2024-10-19 15:04:56 +00:00
}
Button {
2024-11-04 12:43:30 +00:00
icon-name: bind $play_pause_icon_name (template.idle-active, template.pause) as <string>;
2024-10-19 15:04:56 +00:00
valign: center;
2024-11-03 18:25:32 +00:00
//sensitive: bind $can_press_play (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>, template.playbin as <$AudreyPlaybin>.play-queue-length) as <bool>;
2024-10-19 15:04:56 +00:00
2024-10-31 07:17:32 +00:00
clicked => $on_play_pause_clicked () swapped;
2024-10-19 15:04:56 +00:00
}
Button {
icon-name: "media-seek-forward";
valign: center;
2024-11-03 18:25:32 +00:00
//sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
2024-10-19 15:04:56 +00:00
2024-10-31 07:17:32 +00:00
clicked => $seek_forward () swapped;
2024-10-19 15:04:56 +00:00
}
Button {
icon-name: "media-skip-forward";
valign: center;
2024-11-03 18:25:32 +00:00
//sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
2024-10-19 15:04:56 +00:00
2024-10-31 07:17:32 +00:00
clicked => $on_skip_forward_clicked () swapped;
2024-10-19 15:04:56 +00:00
}
}
}
[end]
Box {
Button {
icon-name: "non-starred";
valign: center;
}
Button {
2024-11-03 15:17:54 +00:00
icon-name: bind $mute_button_icon_name (template.mute) as <string>;
2024-10-19 15:04:56 +00:00
valign: center;
2024-10-31 07:17:32 +00:00
clicked => $on_mute_toggle () swapped;
2024-10-19 15:04:56 +00:00
}
Scale {
name: "volume-scale";
orientation: horizontal;
width-request: 130;
adjustment: Adjustment {
lower: 0;
value: bind template.volume bidirectional;
upper: 100;
};
}
}
2024-10-28 08:52:50 +00:00
};
2024-10-19 15:04:56 +00:00
}