1
0
Fork 0
forked from wry/wry

config: add seat to seat-based window management messages

This commit is contained in:
Julian Orth 2025-04-29 12:52:33 +02:00
parent bc6a9ad94d
commit 52994c085a
5 changed files with 127 additions and 123 deletions

View file

@ -333,12 +333,12 @@ impl Client {
self.send(&ClientMessage::GrabKb { kb, grab });
}
pub fn focus(&self, seat: Seat, direction: Direction) {
self.send(&ClientMessage::Focus { seat, direction });
pub fn seat_focus(&self, seat: Seat, direction: Direction) {
self.send(&ClientMessage::SeatFocus { seat, direction });
}
pub fn move_(&self, seat: Seat, direction: Direction) {
self.send(&ClientMessage::Move { seat, direction });
pub fn seat_move(&self, seat: Seat, direction: Direction) {
self.send(&ClientMessage::SeatMove { seat, direction });
}
pub fn unbind<T: Into<ModifiedKeySym>>(&self, seat: Seat, mod_sym: T) {
@ -367,8 +367,8 @@ impl Client {
seats
}
pub fn mono(&self, seat: Seat) -> bool {
let res = self.send_with_response(&ClientMessage::GetMono { seat });
pub fn seat_mono(&self, seat: Seat) -> bool {
let res = self.send_with_response(&ClientMessage::GetSeatMono { seat });
get_response!(res, false, GetMono { mono });
mono
}
@ -450,12 +450,12 @@ impl Client {
self.send(&ClientMessage::ShowWorkspace { seat, workspace });
}
pub fn set_workspace(&self, seat: Seat, workspace: Workspace) {
self.send(&ClientMessage::SetWorkspace { seat, workspace });
pub fn set_seat_workspace(&self, seat: Seat, workspace: Workspace) {
self.send(&ClientMessage::SetSeatWorkspace { seat, workspace });
}
pub fn split(&self, seat: Seat) -> Axis {
let res = self.send_with_response(&ClientMessage::GetSplit { seat });
pub fn seat_split(&self, seat: Seat) -> Axis {
let res = self.send_with_response(&ClientMessage::GetSeatSplit { seat });
get_response!(res, Axis::Horizontal, GetSplit { axis });
axis
}
@ -471,12 +471,12 @@ impl Client {
});
}
pub fn set_fullscreen(&self, seat: Seat, fullscreen: bool) {
self.send(&ClientMessage::SetFullscreen { seat, fullscreen });
pub fn set_seat_fullscreen(&self, seat: Seat, fullscreen: bool) {
self.send(&ClientMessage::SetSeatFullscreen { seat, fullscreen });
}
pub fn get_fullscreen(&self, seat: Seat) -> bool {
let res = self.send_with_response(&ClientMessage::GetFullscreen { seat });
pub fn get_seat_fullscreen(&self, seat: Seat) -> bool {
let res = self.send_with_response(&ClientMessage::GetSeatFullscreen { seat });
get_response!(res, false, GetFullscreen { fullscreen });
fullscreen
}
@ -495,18 +495,18 @@ impl Client {
font
}
pub fn get_floating(&self, seat: Seat) -> bool {
let res = self.send_with_response(&ClientMessage::GetFloating { seat });
pub fn get_seat_floating(&self, seat: Seat) -> bool {
let res = self.send_with_response(&ClientMessage::GetSeatFloating { seat });
get_response!(res, false, GetFloating { floating });
floating
}
pub fn set_floating(&self, seat: Seat, floating: bool) {
self.send(&ClientMessage::SetFloating { seat, floating });
pub fn set_seat_floating(&self, seat: Seat, floating: bool) {
self.send(&ClientMessage::SetSeatFloating { seat, floating });
}
pub fn toggle_floating(&self, seat: Seat) {
self.set_floating(seat, !self.get_floating(seat));
pub fn toggle_seat_floating(&self, seat: Seat) {
self.set_seat_floating(seat, !self.get_seat_floating(seat));
}
pub fn reset_colors(&self) {
@ -548,8 +548,8 @@ impl Client {
self.send(&ClientMessage::SetSize { sized, size })
}
pub fn set_mono(&self, seat: Seat, mono: bool) {
self.send(&ClientMessage::SetMono { seat, mono });
pub fn set_seat_mono(&self, seat: Seat, mono: bool) {
self.send(&ClientMessage::SetSeatMono { seat, mono });
}
pub fn set_env(&self, key: &str, val: &str) {
@ -582,20 +582,20 @@ impl Client {
self.i3bar_separator.borrow().clone()
}
pub fn set_split(&self, seat: Seat, axis: Axis) {
self.send(&ClientMessage::SetSplit { seat, axis });
pub fn set_seat_split(&self, seat: Seat, axis: Axis) {
self.send(&ClientMessage::SetSeatSplit { seat, axis });
}
pub fn create_split(&self, seat: Seat, axis: Axis) {
self.send(&ClientMessage::CreateSplit { seat, axis });
pub fn create_seat_split(&self, seat: Seat, axis: Axis) {
self.send(&ClientMessage::CreateSeatSplit { seat, axis });
}
pub fn close(&self, seat: Seat) {
self.send(&ClientMessage::Close { seat });
pub fn seat_close(&self, seat: Seat) {
self.send(&ClientMessage::SeatClose { seat });
}
pub fn focus_parent(&self, seat: Seat) {
self.send(&ClientMessage::FocusParent { seat });
pub fn focus_seat_parent(&self, seat: Seat) {
self.send(&ClientMessage::FocusSeatParent { seat });
}
pub fn get_seat(&self, name: &str) -> Seat {
@ -792,13 +792,13 @@ impl Client {
}
pub fn get_pinned(&self, seat: Seat) -> bool {
let res = self.send_with_response(&ClientMessage::GetFloatPinned { seat });
let res = self.send_with_response(&ClientMessage::GetSeatFloatPinned { seat });
get_response!(res, false, GetFloatPinned { pinned });
pinned
}
pub fn set_pinned(&self, seat: Seat, pinned: bool) {
self.send(&ClientMessage::SetFloatPinned { seat, pinned });
self.send(&ClientMessage::SetSeatFloatPinned { seat, pinned });
}
pub fn connector_connected(&self, connector: Connector) -> bool {

View file

@ -129,20 +129,20 @@ pub enum ClientMessage<'a> {
rate: i32,
delay: i32,
},
GetSplit {
GetSeatSplit {
seat: Seat,
},
SetStatus {
status: &'a str,
},
SetSplit {
SetSeatSplit {
seat: Seat,
axis: Axis,
},
GetMono {
GetSeatMono {
seat: Seat,
},
SetMono {
SetSeatMono {
seat: Seat,
mono: bool,
},
@ -168,11 +168,11 @@ pub enum ClientMessage<'a> {
args: Vec<String>,
env: Vec<(String, String)>,
},
Focus {
SeatFocus {
seat: Seat,
direction: Direction,
},
Move {
SeatMove {
seat: Seat,
direction: Direction,
},
@ -196,20 +196,20 @@ pub enum ClientMessage<'a> {
colorable: Colorable,
color: Color,
},
CreateSplit {
CreateSeatSplit {
seat: Seat,
axis: Axis,
},
Close {
SeatClose {
seat: Seat,
},
FocusParent {
FocusSeatParent {
seat: Seat,
},
GetFloating {
GetSeatFloating {
seat: Seat,
},
SetFloating {
SetSeatFloating {
seat: Seat,
floating: bool,
},
@ -261,7 +261,7 @@ pub enum ClientMessage<'a> {
seat: Seat,
workspace: Workspace,
},
SetWorkspace {
SetSeatWorkspace {
seat: Seat,
workspace: Workspace,
},
@ -280,11 +280,11 @@ pub enum ClientMessage<'a> {
key: &'a str,
val: &'a str,
},
SetFullscreen {
SetSeatFullscreen {
seat: Seat,
fullscreen: bool,
},
GetFullscreen {
GetSeatFullscreen {
seat: Seat,
},
GetDeviceConnectors {
@ -546,10 +546,10 @@ pub enum ClientMessage<'a> {
above: bool,
},
GetFloatAboveFullscreen,
GetFloatPinned {
GetSeatFloatPinned {
seat: Seat,
},
SetFloatPinned {
SetSeatFloatPinned {
seat: Seat,
pinned: bool,
},

View file

@ -259,12 +259,12 @@ impl Seat {
/// Moves the keyboard focus of the seat in the specified direction.
pub fn focus(self, direction: Direction) {
get!().focus(self, direction)
get!().seat_focus(self, direction)
}
/// Moves the focused window in the specified direction.
pub fn move_(self, direction: Direction) {
get!().move_(self, direction)
get!().seat_move(self, direction)
}
/// Sets the keymap of the seat.
@ -287,12 +287,12 @@ impl Seat {
/// Returns whether the parent-container of the currently focused window is in mono-mode.
pub fn mono(self) -> bool {
get!(false).mono(self)
get!(false).seat_mono(self)
}
/// Sets whether the parent-container of the currently focused window is in mono-mode.
pub fn set_mono(self, mono: bool) {
get!().set_mono(self, mono)
get!().set_seat_mono(self, mono)
}
/// Toggles whether the parent-container of the currently focused window is in mono-mode.
@ -302,12 +302,12 @@ impl Seat {
/// Returns the split axis of the parent-container of the currently focused window.
pub fn split(self) -> Axis {
get!(Axis::Horizontal).split(self)
get!(Axis::Horizontal).seat_split(self)
}
/// Sets the split axis of the parent-container of the currently focused window.
pub fn set_split(self, axis: Axis) {
get!().set_split(self, axis)
get!().set_seat_split(self, axis)
}
/// Toggles the split axis of the parent-container of the currently focused window.
@ -322,33 +322,33 @@ impl Seat {
/// Creates a new container with the specified split in place of the currently focused window.
pub fn create_split(self, axis: Axis) {
get!().create_split(self, axis);
get!().create_seat_split(self, axis);
}
/// Focuses the parent node of the currently focused window.
pub fn focus_parent(self) {
get!().focus_parent(self);
get!().focus_seat_parent(self);
}
/// Requests the currently focused window to be closed.
pub fn close(self) {
get!().close(self);
get!().seat_close(self);
}
/// Returns whether the currently focused window is floating.
pub fn get_floating(self) -> bool {
get!().get_floating(self)
get!().get_seat_floating(self)
}
/// Sets whether the currently focused window is floating.
pub fn set_floating(self, floating: bool) {
get!().set_floating(self, floating);
get!().set_seat_floating(self, floating);
}
/// Toggles whether the currently focused window is floating.
///
/// You can do the same by double-clicking on the header.
pub fn toggle_floating(self) {
get!().toggle_floating(self);
get!().toggle_seat_floating(self);
}
/// Returns the workspace that is currently active on the output that contains the seat's
@ -377,22 +377,22 @@ impl Seat {
/// Moves the currently focused window to the workspace.
pub fn set_workspace(self, workspace: Workspace) {
get!().set_workspace(self, workspace)
get!().set_seat_workspace(self, workspace)
}
/// Toggles whether the currently focused window is fullscreen.
pub fn toggle_fullscreen(self) {
let c = get!();
c.set_fullscreen(self, !c.get_fullscreen(self));
c.set_seat_fullscreen(self, !c.get_seat_fullscreen(self));
}
/// Returns whether the currently focused window is fullscreen.
pub fn fullscreen(self) -> bool {
get!(false).get_fullscreen(self)
get!(false).get_seat_fullscreen(self)
}
/// Sets whether the currently focused window is fullscreen.
pub fn set_fullscreen(self, fullscreen: bool) {
get!().set_fullscreen(self, fullscreen)
get!().set_seat_fullscreen(self, fullscreen)
}
/// Disables the currently active pointer constraint on this seat.