1
0
Fork 0
forked from wry/wry

config: allow disabling the built-in bar

This commit is contained in:
Julian Orth 2025-07-17 22:31:16 +02:00
parent 224f5380fe
commit 08e7e01d0e
16 changed files with 156 additions and 14 deletions

View file

@ -950,6 +950,16 @@ impl ConfigClient {
above
}
pub fn set_show_bar(&self, show: bool) {
self.send(&ClientMessage::SetShowBar { show });
}
pub fn get_show_bar(&self) -> bool {
let res = self.send_with_response(&ClientMessage::GetShowBar);
get_response!(res, true, GetShowBar { show });
show
}
pub fn set_show_float_pin_icon(&self, show: bool) {
self.send(&ClientMessage::SetShowFloatPinIcon { show });
}

View file

@ -721,6 +721,10 @@ pub enum ClientMessage<'a> {
GetContentType {
window: Window,
},
SetShowBar {
show: bool,
},
GetShowBar,
}
#[derive(Serialize, Deserialize, Debug)]
@ -950,6 +954,9 @@ pub enum Response {
GetContentType {
kind: ContentType,
},
GetShowBar {
show: bool,
},
}
#[derive(Serialize, Deserialize, Debug)]

View file

@ -316,6 +316,24 @@ pub fn set_show_float_pin_icon(show: bool) {
get!().set_show_float_pin_icon(show);
}
/// Sets whether the built-in bar is shown.
///
/// The default is `true`.
pub fn set_show_bar(show: bool) {
get!().set_show_bar(show)
}
/// Returns whether the built-in bar is shown.
pub fn get_show_bar() -> bool {
get!(true).get_show_bar()
}
/// Toggles whether the built-in bar is shown.
pub fn toggle_show_bar() {
let get = get!();
get.set_show_bar(!get.get_show_bar());
}
/// Sets a callback to run when this config is unloaded.
///
/// Only one callback can be set at a time. If another callback is already set, it will be