mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
Merge pull request #17 from YGGverse/fix-left-window-buttons-placement
add left window controls placement support
This commit is contained in:
commit
df419181e6
2 changed files with 24 additions and 7 deletions
|
|
@ -27,10 +27,20 @@ impl Bar for Box {
|
|||
.orientation(Orientation::Horizontal)
|
||||
.spacing(8)
|
||||
.build();
|
||||
|
||||
g_box.append(&TabBar::tab(window_action, view));
|
||||
g_box.append(&MenuButton::menu((browser_action, window_action)));
|
||||
g_box.append(&Control::new().window_controls);
|
||||
// left controls placement
|
||||
if gtk::Settings::default().is_some_and(|s| {
|
||||
s.gtk_decoration_layout()
|
||||
.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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,12 @@ pub struct Control {
|
|||
|
||||
impl Default for Control {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
Self::right()
|
||||
}
|
||||
}
|
||||
|
||||
impl Control {
|
||||
// Construct
|
||||
pub fn new() -> Self {
|
||||
pub fn right() -> Self {
|
||||
Self {
|
||||
window_controls: WindowControls::builder()
|
||||
.margin_end(MARGIN)
|
||||
|
|
@ -22,4 +21,12 @@ impl Control {
|
|||
.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