styling
This commit is contained in:
parent
6195ab2db9
commit
9231d84dbf
5 changed files with 72 additions and 56 deletions
|
|
@ -117,8 +117,8 @@ impl DockItem {
|
||||||
}
|
}
|
||||||
if let Ok(popover_value) = dock_object.property("popover") {
|
if let Ok(popover_value) = dock_object.property("popover") {
|
||||||
if let Ok(popover) = popover_value.get::<bool>() {
|
if let Ok(popover) = popover_value.get::<bool>() {
|
||||||
dbg!(popover);
|
// dbg!(popover);
|
||||||
dbg!(dock_object);
|
// dbg!(dock_object);
|
||||||
if popover {
|
if popover {
|
||||||
self.add_popover(dock_object);
|
self.add_popover(dock_object);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,7 @@ impl DockList {
|
||||||
let list_view = cascade! {
|
let list_view = cascade! {
|
||||||
ListView::default();
|
ListView::default();
|
||||||
..set_orientation(Orientation::Horizontal);
|
..set_orientation(Orientation::Horizontal);
|
||||||
|
..add_css_class("docklist");
|
||||||
};
|
};
|
||||||
if imp.type_.get().unwrap() == &DockListType::Saved {
|
if imp.type_.get().unwrap() == &DockListType::Saved {
|
||||||
list_view.set_width_request(64);
|
list_view.set_width_request(64);
|
||||||
|
|
@ -210,20 +211,20 @@ impl DockList {
|
||||||
let window = list_view.root().unwrap().downcast::<Window>().unwrap();
|
let window = list_view.root().unwrap().downcast::<Window>().unwrap();
|
||||||
let max_x = list_view.allocated_width();
|
let max_x = list_view.allocated_width();
|
||||||
let max_y = list_view.allocated_height();
|
let max_y = list_view.allocated_height();
|
||||||
dbg!(max_y);
|
// dbg!(max_y);
|
||||||
dbg!(y);
|
// dbg!(y);
|
||||||
let n_buckets = model.n_items();
|
let n_buckets = model.n_items();
|
||||||
let index = (x * n_buckets as f64 / (max_x as f64 + 0.1)) as u32;
|
let index = (x * n_buckets as f64 / (max_x as f64 + 0.1)) as u32;
|
||||||
dbg!(self_.current_button());
|
// dbg!(self_.current_button());
|
||||||
dbg!(self_.last_event(self_.current_sequence().as_ref()));
|
// dbg!(self_.last_event(self_.current_sequence().as_ref()));
|
||||||
let click_modifier = if let Some(event) = self_.last_event(self_.current_sequence().as_ref()) {
|
let click_modifier = if let Some(event) = self_.last_event(self_.current_sequence().as_ref()) {
|
||||||
dbg!(&event);
|
// dbg!(&event);
|
||||||
Some(event.modifier_state())
|
Some(event.modifier_state())
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
dbg!(click_modifier);
|
// dbg!(click_modifier);
|
||||||
// Launch the application when an item of the list is activated
|
// Launch the application when an item of the list is activated
|
||||||
let focus_window = move |first_focused_item: &Item| {
|
let focus_window = move |first_focused_item: &Item| {
|
||||||
let entity = first_focused_item.entity.clone();
|
let entity = first_focused_item.entity.clone();
|
||||||
|
|
|
||||||
|
|
@ -65,33 +65,33 @@ impl DockPopover {
|
||||||
};
|
};
|
||||||
menu_handle.append(&all_windows_item_container);
|
menu_handle.append(&all_windows_item_container);
|
||||||
|
|
||||||
let all_windows_item_header = cascade! {
|
// let all_windows_item_header = cascade! {
|
||||||
Button::new();
|
// Button::new();
|
||||||
..set_hexpand(true);
|
// ..set_hexpand(true);
|
||||||
};
|
// };
|
||||||
all_windows_item_container.append(&all_windows_item_header);
|
// all_windows_item_container.append(&all_windows_item_header);
|
||||||
|
|
||||||
let all_windows_item_header_box = cascade! {
|
// let all_windows_item_header_box = cascade! {
|
||||||
Box::new(Orientation::Horizontal, 4);
|
// Box::new(Orientation::Horizontal, 4);
|
||||||
..set_hexpand(true);
|
// ..set_hexpand(true);
|
||||||
};
|
// };
|
||||||
all_windows_item_header.set_child(Some(&all_windows_item_header_box));
|
// all_windows_item_header.set_child(Some(&all_windows_item_header_box));
|
||||||
|
|
||||||
let all_windows_item_header_title = cascade! {
|
// let all_windows_item_header_title = cascade! {
|
||||||
Label::new(Some("All Windows"));
|
// Label::new(Some("All Windows"));
|
||||||
..add_css_class("header-5");
|
// ..add_css_class("header-5");
|
||||||
..set_halign(gtk4::Align::Start);
|
// ..set_halign(gtk4::Align::Start);
|
||||||
};
|
// };
|
||||||
all_windows_item_header_box.append(&all_windows_item_header_title);
|
// all_windows_item_header_box.append(&all_windows_item_header_title);
|
||||||
|
|
||||||
let all_windows_item_header_icon = cascade! {
|
// let all_windows_item_header_icon = cascade! {
|
||||||
Image::from_icon_name(Some("go-down"));
|
// Image::from_icon_name(Some("go-down"));
|
||||||
..set_halign(gtk4::Align::End);
|
// ..set_halign(gtk4::Align::End);
|
||||||
..set_hexpand(true);
|
// ..set_hexpand(true);
|
||||||
..set_pixel_size(16);
|
// ..set_pixel_size(16);
|
||||||
};
|
// };
|
||||||
all_windows_item_header_box.append(&all_windows_item_header_icon);
|
// all_windows_item_header_box.append(&all_windows_item_header_icon);
|
||||||
imp.all_windows_item_header.replace(all_windows_item_header);
|
// imp.all_windows_item_header.replace(all_windows_item_header);
|
||||||
|
|
||||||
if let Ok(window_list) = dock_object
|
if let Ok(window_list) = dock_object
|
||||||
.property("active")
|
.property("active")
|
||||||
|
|
@ -101,17 +101,17 @@ impl DockPopover {
|
||||||
if window_list.0.len() == 0 {
|
if window_list.0.len() == 0 {
|
||||||
all_windows_item_container.hide();
|
all_windows_item_container.hide();
|
||||||
} else {
|
} else {
|
||||||
let window_list_revealer = cascade! {
|
// let window_list_revealer = cascade! {
|
||||||
Revealer::new();
|
// Revealer::new();
|
||||||
..set_reveal_child(false);
|
// ..set_reveal_child(false);
|
||||||
..set_transition_type(gtk4::RevealerTransitionType::SlideDown);
|
// ..set_transition_type(gtk4::RevealerTransitionType::SlideDown);
|
||||||
};
|
// };
|
||||||
all_windows_item_container.append(&window_list_revealer);
|
// all_windows_item_container.append(&window_list_revealer);
|
||||||
let window_listbox = cascade! {
|
let window_listbox = cascade! {
|
||||||
ListBox::new();
|
ListBox::new();
|
||||||
..set_activate_on_single_click(true);
|
..set_activate_on_single_click(true);
|
||||||
};
|
};
|
||||||
window_list_revealer.set_child(Some(&window_listbox));
|
all_windows_item_container.append(&window_listbox);
|
||||||
for w in window_list.0 {
|
for w in window_list.0 {
|
||||||
let window_box = cascade! {
|
let window_box = cascade! {
|
||||||
Box::new(Orientation::Vertical, 4);
|
Box::new(Orientation::Vertical, 4);
|
||||||
|
|
@ -124,6 +124,8 @@ impl DockPopover {
|
||||||
..set_margin_end(4);
|
..set_margin_end(4);
|
||||||
..set_margin_top(4);
|
..set_margin_top(4);
|
||||||
..set_margin_bottom(4);
|
..set_margin_bottom(4);
|
||||||
|
..add_css_class("title-4");
|
||||||
|
..add_css_class("window_title");
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO investigate Xembed
|
// TODO investigate Xembed
|
||||||
|
|
@ -134,7 +136,7 @@ impl DockPopover {
|
||||||
window_box.append(&window_image);
|
window_box.append(&window_image);
|
||||||
window_box.append(&window_title);
|
window_box.append(&window_title);
|
||||||
}
|
}
|
||||||
imp.all_windows_item_revealer.replace(window_list_revealer);
|
// imp.all_windows_item_revealer.replace(window_list_revealer);
|
||||||
imp.window_list.replace(window_listbox);
|
imp.window_list.replace(window_listbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -257,13 +259,13 @@ impl DockPopover {
|
||||||
self_.emit_hide();
|
self_.emit_hide();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
all_windows_header.connect_clicked(
|
// all_windows_header.connect_clicked(
|
||||||
glib::clone!(@weak dock_object, @weak revealer => move |self_| {
|
// glib::clone!(@weak dock_object, @weak revealer => move |self_| {
|
||||||
dbg!(dock_object);
|
// // dbg!(dock_object);
|
||||||
let revealer = revealer.borrow();
|
// let revealer = revealer.borrow();
|
||||||
revealer.set_reveal_child(!revealer.reveals_child())
|
// revealer.set_reveal_child(!revealer.reveals_child())
|
||||||
}),
|
// }),
|
||||||
);
|
// );
|
||||||
|
|
||||||
let self_ = self.clone();
|
let self_ = self.clone();
|
||||||
window_listbox.connect_row_activated(glib::clone!(@weak dock_object => move |_, item| {
|
window_listbox.connect_row_activated(glib::clone!(@weak dock_object => move |_, item| {
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,17 @@ fn main() {
|
||||||
.call_method(Some(DEST), PATH, Some(DEST), "WindowFocus", &((e,)))
|
.call_method(Some(DEST), PATH, Some(DEST), "WindowFocus", &((e,)))
|
||||||
.await
|
.await
|
||||||
.expect("Failed to focus selected window");
|
.expect("Failed to focus selected window");
|
||||||
|
// let m = zbus_conn
|
||||||
|
// .call_method(Some(DEST), PATH, Some(DEST), "WindowId", &((e,)))
|
||||||
|
// .await;
|
||||||
|
// if let Ok(m) = m {
|
||||||
|
// if let Ok(reply) = m.body::<(u32, u32)>() {
|
||||||
|
// dbg!(reply);
|
||||||
|
// } else {
|
||||||
|
// dbg!(m);
|
||||||
|
// }
|
||||||
|
// // glib::timeout_future(Duration::from_millis(100)).await;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
Event::Close(e) => {
|
Event::Close(e) => {
|
||||||
let _activate_window = zbus_conn
|
let _activate_window = zbus_conn
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
listview {
|
listview.docklist {
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background: #333333;
|
background: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
listview row:hover {
|
listview.docklist row:hover {
|
||||||
transition: 100ms;
|
transition: 100ms;
|
||||||
background: #888888;
|
background: #888888;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
listview row {
|
listview.docklist row {
|
||||||
background: #333333;
|
background: #333333;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
|
|
@ -33,17 +33,19 @@ list {
|
||||||
background: #333333;
|
background: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
list row:hover {
|
label.window_title {
|
||||||
transition: 100ms;
|
color: white;
|
||||||
background: #888888;
|
margin: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
popover contents {
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
list row {
|
popover contents {
|
||||||
background: #333333;
|
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 0px;
|
padding: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
box.dock {
|
box.dock {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue