renderer: add support for floating-titlebars (#4)
Reviewed-on: https://git.kosslan.dev/wry/jay/pulls/4
This commit is contained in:
parent
4d803360dd
commit
6dba659978
13 changed files with 316 additions and 158 deletions
|
|
@ -1057,6 +1057,16 @@ impl ConfigClient {
|
|||
show
|
||||
}
|
||||
|
||||
pub fn set_floating_titles(&self, floating: bool) {
|
||||
self.send(&ClientMessage::SetFloatingTitles { floating });
|
||||
}
|
||||
|
||||
pub fn get_floating_titles(&self) -> bool {
|
||||
let res = self.send_with_response(&ClientMessage::GetFloatingTitles);
|
||||
get_response!(res, false, GetFloatingTitles { floating });
|
||||
floating
|
||||
}
|
||||
|
||||
pub fn set_bar_position(&self, position: BarPosition) {
|
||||
self.send(&ClientMessage::SetBarPosition { position });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -812,6 +812,10 @@ pub enum ClientMessage<'a> {
|
|||
show: bool,
|
||||
},
|
||||
GetShowTitles,
|
||||
SetFloatingTitles {
|
||||
floating: bool,
|
||||
},
|
||||
GetFloatingTitles,
|
||||
GetWorkspaceConnector {
|
||||
workspace: Workspace,
|
||||
},
|
||||
|
|
@ -1114,6 +1118,9 @@ pub enum Response {
|
|||
GetShowTitles {
|
||||
show: bool,
|
||||
},
|
||||
GetFloatingTitles {
|
||||
floating: bool,
|
||||
},
|
||||
GetWorkspaceConnector {
|
||||
connector: Connector,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -361,6 +361,27 @@ pub fn toggle_show_titles() {
|
|||
get.set_show_titles(!get.get_show_titles());
|
||||
}
|
||||
|
||||
/// Sets whether title bars float above window content instead of being attached.
|
||||
///
|
||||
/// When enabled, title bars are rendered on top of window content without consuming
|
||||
/// layout space. Window borders do not extend to include the title bar area.
|
||||
///
|
||||
/// The default is `false`.
|
||||
pub fn set_floating_titles(floating: bool) {
|
||||
get!().set_floating_titles(floating)
|
||||
}
|
||||
|
||||
/// Returns whether title bars float above window content.
|
||||
pub fn get_floating_titles() -> bool {
|
||||
get!(false).get_floating_titles()
|
||||
}
|
||||
|
||||
/// Toggles whether title bars float above window content.
|
||||
pub fn toggle_floating_titles() {
|
||||
let get = get!();
|
||||
get.set_floating_titles(!get.get_floating_titles());
|
||||
}
|
||||
|
||||
/// 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
|
||||
|
|
|
|||
|
|
@ -370,5 +370,9 @@ pub mod sized {
|
|||
///
|
||||
/// Default: 0
|
||||
const 05 => GAP,
|
||||
/// The gap between the titlebar and the window content in pixels.
|
||||
///
|
||||
/// Default: 0
|
||||
const 06 => TITLE_GAP,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue