Log out / lock screen buttons

This commit is contained in:
Lucy 2022-02-21 13:02:50 -05:00
parent 329c6006c3
commit 1f65d44998
No known key found for this signature in database
GPG key ID: EBC517FAD666BBF1
3 changed files with 51 additions and 1 deletions

View file

@ -28,6 +28,7 @@ fn build_ui(application: &gtk4::Application) {
.default_height(300)
.build();
let session_section = ui::session::build();
let system_section = ui::system::build();
view! {
main_box = gtk4::Box {
@ -38,6 +39,7 @@ fn build_ui(application: &gtk4::Application) {
set_margin_start: 24,
set_margin_end: 24,
append: first_separator = &Separator {},
append: &session_section,
append: second_separator = &Separator {},
append: &system_section
}

View file

@ -1 +1,49 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
use gtk4::{prelude::*, Align, Button, Image, Label, Orientation};
pub fn build() -> gtk4::Box {
view! {
inner_box = gtk4::Box {
set_orientation: Orientation::Vertical,
set_spacing: 5,
append: lock_screen_button = &Button {
set_child: lock_screen_box = Some(&gtk4::Box) {
set_orientation: Orientation::Horizontal,
set_spacing: 10,
append: lock_screen_icon = &Image {
set_icon_name: Some("system-lock-screen-symbolic"),
},
append: lock_screen_label = &Label {
set_label: "Lock Screen",
set_halign: Align::Start,
set_hexpand: true
},
append: lock_screen_hotkey_label = &Label {
set_label: "Super + Escape",
set_halign: Align::End
}
}
},
append: log_out_button = &Button {
set_child: log_out_box = Some(&gtk4::Box) {
set_orientation: Orientation::Horizontal,
set_spacing: 10,
append: log_out_icon = &Image {
set_icon_name: Some("system-log-out-symbolic"),
},
append: log_out_label = &Label {
set_label: "Log Out",
set_halign: Align::Start,
set_hexpand: true
},
append: log_out_hotkey_label = &Label {
set_label: "Ctrl + Alt + Delete",
set_halign: Align::End
}
}
}
}
}
inner_box
}

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
use crate::RT;
use gtk4::{prelude::*, Align, Button, IconSize, Image, Label, Orientation};
use gtk4::{prelude::*, Button, IconSize, Image, Label, Orientation};
use logind_zbus::manager::ManagerProxy;
use zbus::Connection;