mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 08:35:28 +00:00
add left window controls placement support
This commit is contained in:
parent
6fb7e70213
commit
81b57f92ac
2 changed files with 24 additions and 7 deletions
|
|
@ -27,10 +27,20 @@ impl Bar for Box {
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
.spacing(8)
|
.spacing(8)
|
||||||
.build();
|
.build();
|
||||||
|
// left controls placement
|
||||||
g_box.append(&TabBar::tab(window_action, view));
|
if gtk::Settings::default().is_some_and(|s| {
|
||||||
g_box.append(&MenuButton::menu((browser_action, window_action)));
|
s.gtk_decoration_layout()
|
||||||
g_box.append(&Control::new().window_controls);
|
.is_some_and(|l| l.starts_with("close"))
|
||||||
|
}) {
|
||||||
|
g_box.append(&Control::left().window_controls);
|
||||||
|
g_box.append(&MenuButton::menu((browser_action, window_action)));
|
||||||
|
g_box.append(&TabBar::tab(window_action, view))
|
||||||
|
// default layout
|
||||||
|
} else {
|
||||||
|
g_box.append(&TabBar::tab(window_action, view));
|
||||||
|
g_box.append(&MenuButton::menu((browser_action, window_action)));
|
||||||
|
g_box.append(&Control::right().window_controls)
|
||||||
|
}
|
||||||
g_box
|
g_box
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,12 @@ pub struct Control {
|
||||||
|
|
||||||
impl Default for Control {
|
impl Default for Control {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new()
|
Self::right()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Control {
|
impl Control {
|
||||||
// Construct
|
pub fn right() -> Self {
|
||||||
pub fn new() -> Self {
|
|
||||||
Self {
|
Self {
|
||||||
window_controls: WindowControls::builder()
|
window_controls: WindowControls::builder()
|
||||||
.margin_end(MARGIN)
|
.margin_end(MARGIN)
|
||||||
|
|
@ -22,4 +21,12 @@ impl Control {
|
||||||
.build(),
|
.build(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub fn left() -> Self {
|
||||||
|
Self {
|
||||||
|
window_controls: WindowControls::builder()
|
||||||
|
.margin_end(MARGIN)
|
||||||
|
.side(PackType::Start)
|
||||||
|
.build(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue