tree: allow floats to be pinned
This commit is contained in:
parent
3e6640f0ca
commit
65a66c2e26
28 changed files with 528 additions and 36 deletions
|
|
@ -778,6 +778,20 @@ impl Client {
|
|||
above
|
||||
}
|
||||
|
||||
pub fn set_show_float_pin_icon(&self, show: bool) {
|
||||
self.send(&ClientMessage::SetShowFloatPinIcon { show });
|
||||
}
|
||||
|
||||
pub fn get_pinned(&self, seat: Seat) -> bool {
|
||||
let res = self.send_with_response(&ClientMessage::GetFloatPinned { seat });
|
||||
get_response!(res, false, GetFloatPinned { pinned });
|
||||
pinned
|
||||
}
|
||||
|
||||
pub fn set_pinned(&self, seat: Seat, pinned: bool) {
|
||||
self.send(&ClientMessage::SetFloatPinned { seat, pinned });
|
||||
}
|
||||
|
||||
pub fn connector_connected(&self, connector: Connector) -> bool {
|
||||
let res = self.send_with_response(&ClientMessage::ConnectorConnected { connector });
|
||||
get_response!(res, false, ConnectorConnected { connected });
|
||||
|
|
|
|||
|
|
@ -546,6 +546,16 @@ pub enum ClientMessage<'a> {
|
|||
above: bool,
|
||||
},
|
||||
GetFloatAboveFullscreen,
|
||||
GetFloatPinned {
|
||||
seat: Seat,
|
||||
},
|
||||
SetFloatPinned {
|
||||
seat: Seat,
|
||||
pinned: bool,
|
||||
},
|
||||
SetShowFloatPinIcon {
|
||||
show: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
@ -697,6 +707,9 @@ pub enum Response {
|
|||
GetFloatAboveFullscreen {
|
||||
above: bool,
|
||||
},
|
||||
GetFloatPinned {
|
||||
pinned: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
|
|||
|
|
@ -452,6 +452,24 @@ impl Seat {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
/// Gets whether the currently focused window is pinned.
|
||||
///
|
||||
/// If a floating window is pinned, it will stay visible even when switching to a
|
||||
/// different workspace.
|
||||
pub fn float_pinned(self) -> bool {
|
||||
get!().get_pinned(self)
|
||||
}
|
||||
|
||||
/// Sets whether the currently focused window is pinned.
|
||||
pub fn set_float_pinned(self, pinned: bool) {
|
||||
get!().set_pinned(self, pinned);
|
||||
}
|
||||
|
||||
/// Toggles whether the currently focused window is pinned.
|
||||
pub fn toggle_float_pinned(self) {
|
||||
self.set_float_pinned(!self.float_pinned());
|
||||
}
|
||||
}
|
||||
|
||||
/// A focus-follows-mouse mode.
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@
|
|||
)]
|
||||
#![warn(unsafe_op_in_unsafe_fn)]
|
||||
|
||||
#[expect(unused_imports)]
|
||||
use crate::input::Seat;
|
||||
use {
|
||||
crate::{_private::ipc::WorkspaceSource, keyboard::ModifiedKeySym, video::Connector},
|
||||
serde::{Deserialize, Serialize},
|
||||
|
|
@ -292,3 +294,13 @@ pub fn get_float_above_fullscreen() -> bool {
|
|||
pub fn toggle_float_above_fullscreen() {
|
||||
set_float_above_fullscreen(!get_float_above_fullscreen())
|
||||
}
|
||||
|
||||
/// Sets whether floating windows always show a pin icon.
|
||||
///
|
||||
/// Clicking on the pin icon toggles the pin mode. See [`Seat::toggle_float_pinned`].
|
||||
///
|
||||
/// The icon is always shown if the window is pinned. This setting only affects unpinned
|
||||
/// windows.
|
||||
pub fn set_show_float_pin_icon(show: bool) {
|
||||
get!().set_show_float_pin_icon(show);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue