Compare commits

...

2 commits

Author SHA1 Message Date
8d57d942e8 make these lists transparent 2024-11-13 18:10:45 +01:00
2f510c55ac shitty g4 like background blur 2024-11-13 18:06:24 +01:00
4 changed files with 47 additions and 6 deletions

View file

@ -21,11 +21,9 @@ template $AudreyUiPlayQueue: Adw.Bin {
child: ScrolledWindow {
hexpand: true;
vscrollbar-policy: always;
hscrollbar-policy: never;
ListView view {
show-separators: true;
single-click-activate: true;
activate => $on_row_activated() swapped;

View file

@ -19,6 +19,10 @@
min-height: 15px;
}
#play-queue listview {
background-color: rgba(0,0,0,0);
}
/* make drag and drop indicator take up entire perimeter */
#play-queue listview row {
padding: 0;
@ -28,6 +32,10 @@
font-weight: bold;
}
gridview.albums {
background-color: rgba(0,0,0,0);
}
gridview.albums child {
margin: 10px;
}

View file

@ -7,8 +7,6 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
default-height: 600;
Adw.ToolbarView {
top-bar-style: raised;
bottom-bar-style: raised;
[top]
Adw.HeaderBar {

View file

@ -38,6 +38,8 @@ mod imp {
#[property(get, set, nullable)]
playing_cover_art: RefCell<Option<gdk::Paintable>>,
#[property(get, set, nullable)]
background: RefCell<Option<gdk::Paintable>>,
#[property(type = Option<Song>, get = Self::song, nullable)]
_song: (),
@ -112,6 +114,7 @@ mod imp {
play_queue: Default::default(),
can_click_shuffle_all: Cell::new(false),
playing_cover_art: Default::default(),
background: Default::default(),
_song: (),
setup: Default::default(),
api: Default::default(),
@ -273,7 +276,18 @@ mod imp {
}
}
impl WidgetImpl for Window {}
impl WidgetImpl for Window {
fn snapshot(&self, snapshot: &gtk::Snapshot) {
if let Some(background) = self.background.borrow().as_ref() {
background.snapshot(
snapshot,
self.obj().width() as f64,
self.obj().height() as f64,
);
}
self.parent_snapshot(snapshot);
}
}
impl WindowImpl for Window {}
@ -533,7 +547,30 @@ mod imp {
Some(song) if song.id() == song_id => {
let texture = gdk::Texture::from_bytes(&glib::Bytes::from_owned(bytes))
.expect("could not create texture from cover art for {song_id}");
window.set_playing_cover_art(Some(texture));
window.set_playing_cover_art(Some(&texture.clone().into()));
// from g4music
let snapshot = gtk::Snapshot::new();
snapshot.push_blur(512.0 * 0.2);
snapshot.push_opacity(0.5);
texture.snapshot(&snapshot, 512.0, 512.0);
snapshot.pop();
snapshot.pop();
use gtk::graphene;
let rect = graphene::Rect::new(0.0, 0.0, 512.0, 512.0);
if let Some(node) = snapshot.clone().to_node() {
window.set_background(Some(
window
.native()
.unwrap()
.renderer()
.unwrap()
.render_texture(node, Some(&rect)),
));
} else {
todo!();
}
}
_ => {
event!(