1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 14:51:04 +02:00

feat(launcher): add option to minimize window if focused

This commit is contained in:
pachliopta 2024-11-10 16:20:28 +11:00 committed by Jake Stanger
parent 9c13e534b7
commit 64b953ce5e
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
6 changed files with 58 additions and 7 deletions

View file

@ -76,6 +76,8 @@ pub enum Request {
ToplevelInfoAll,
#[cfg(feature = "launcher")]
ToplevelFocus(usize),
#[cfg(feature = "launcher")]
ToplevelMinimize(usize),
#[cfg(feature = "clipboard")]
CopyToClipboard(ClipboardItem),
@ -350,6 +352,19 @@ impl Environment {
send!(env.response_tx, Response::Ok);
}
#[cfg(feature = "launcher")]
Msg(Request::ToplevelMinimize(id)) => {
let handle = env
.handles
.iter()
.find(|handle| handle.info().map_or(false, |info| info.id == id));
if let Some(handle) = handle {
handle.minimize();
}
send!(env.response_tx, Response::Ok);
}
#[cfg(feature = "clipboard")]
Msg(Request::CopyToClipboard(item)) => {
env.copy_to_clipboard(item);