1
0
Fork 0
forked from wry/wry

feat: implement scratchpad window toggling

This commit is contained in:
atagen 2026-05-31 17:23:56 +10:00
parent 5c2f631fdb
commit d756c8a6a2
17 changed files with 515 additions and 3 deletions

View file

@ -640,6 +640,18 @@ impl ConfigClient {
self.send(&ClientMessage::SetWindowWorkspace { window, workspace });
}
pub fn seat_send_to_scratchpad(&self, seat: Seat, name: &str) {
self.send(&ClientMessage::SeatSendToScratchpad { seat, name });
}
pub fn seat_toggle_scratchpad(&self, seat: Seat, name: &str) {
self.send(&ClientMessage::SeatToggleScratchpad { seat, name });
}
pub fn window_send_to_scratchpad(&self, window: Window, name: &str) {
self.send(&ClientMessage::WindowSendToScratchpad { window, name });
}
pub fn seat_split(&self, seat: Seat) -> Axis {
let res = self.send_with_response(&ClientMessage::GetSeatSplit { seat });
get_response!(res, Axis::Horizontal, GetSplit { axis });

View file

@ -286,6 +286,14 @@ pub enum ClientMessage<'a> {
seat: Seat,
workspace: Workspace,
},
SeatSendToScratchpad {
seat: Seat,
name: &'a str,
},
SeatToggleScratchpad {
seat: Seat,
name: &'a str,
},
GetTimer {
name: &'a str,
},
@ -687,6 +695,10 @@ pub enum ClientMessage<'a> {
window: Window,
workspace: Workspace,
},
WindowSendToScratchpad {
window: Window,
name: &'a str,
},
SetWindowFullscreen {
window: Window,
fullscreen: bool,

View file

@ -466,6 +466,22 @@ impl Seat {
get!().set_seat_workspace(self, workspace)
}
/// Sends the currently focused window to a scratchpad.
///
/// Use an empty string for the default scratchpad.
pub fn send_to_scratchpad(self, name: &str) {
get!().seat_send_to_scratchpad(self, name)
}
/// Toggles a scratchpad.
///
/// If the scratchpad has a visible window, that window is hidden. Otherwise, the
/// most recently hidden window in the scratchpad is shown on the current workspace.
/// Use an empty string for the default scratchpad.
pub fn toggle_scratchpad(self, name: &str) {
get!().seat_toggle_scratchpad(self, name)
}
/// Toggles whether the currently focused window is fullscreen.
pub fn toggle_fullscreen(self) {
let c = get!();

View file

@ -205,6 +205,13 @@ impl Window {
get!().set_window_workspace(self, workspace)
}
/// Sends the window to a scratchpad.
///
/// Use an empty string for the default scratchpad.
pub fn send_to_scratchpad(self, name: &str) {
get!().window_send_to_scratchpad(self, name)
}
/// Toggles whether the currently focused window is fullscreen.
pub fn toggle_fullscreen(self) {
self.set_fullscreen(!self.fullscreen())