ssd: Add minimize button to header bar
This commit is contained in:
parent
e008437f59
commit
b1a4e1682c
1 changed files with 13 additions and 0 deletions
|
|
@ -254,6 +254,7 @@ impl CosmicWindow {
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub enum Message {
|
pub enum Message {
|
||||||
DragStart,
|
DragStart,
|
||||||
|
Minimize,
|
||||||
Maximize,
|
Maximize,
|
||||||
Close,
|
Close,
|
||||||
Menu,
|
Menu,
|
||||||
|
|
@ -284,6 +285,17 @@ impl Program for CosmicWindowInternal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Message::Minimize => {
|
||||||
|
if let Some(surface) = self.window.wl_surface() {
|
||||||
|
loop_handle.insert_idle(move |state| {
|
||||||
|
if let Some(mapped) =
|
||||||
|
state.common.shell.element_for_wl_surface(&surface).cloned()
|
||||||
|
{
|
||||||
|
state.common.shell.minimize_request(&mapped)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Message::Maximize => {
|
Message::Maximize => {
|
||||||
if let Some(surface) = self.window.wl_surface() {
|
if let Some(surface) = self.window.wl_surface() {
|
||||||
loop_handle.insert_idle(move |state| {
|
loop_handle.insert_idle(move |state| {
|
||||||
|
|
@ -412,6 +424,7 @@ impl Program for CosmicWindowInternal {
|
||||||
cosmic::widget::header_bar()
|
cosmic::widget::header_bar()
|
||||||
.title(self.last_title.lock().unwrap().clone())
|
.title(self.last_title.lock().unwrap().clone())
|
||||||
.on_drag(Message::DragStart)
|
.on_drag(Message::DragStart)
|
||||||
|
.on_minimize(Message::Minimize)
|
||||||
.on_maximize(Message::Maximize)
|
.on_maximize(Message::Maximize)
|
||||||
.on_close(Message::Close)
|
.on_close(Message::Close)
|
||||||
.apply(mouse_area)
|
.apply(mouse_area)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue