1
0
Fork 0
forked from wry/wry

config: add fallback output mode

This commit is contained in:
khyperia 2025-12-23 14:57:02 +01:00 committed by Julian Orth
parent a975e3b25a
commit dd3f8bad40
16 changed files with 215 additions and 19 deletions

View file

@ -15,8 +15,9 @@ use {
client::{Client, ClientCapabilities, ClientCriterion, ClientMatcher, MatchedClient},
exec::Command,
input::{
FocusFollowsMouseMode, InputDevice, LayerDirection, Seat, SwitchEvent, Timeline,
acceleration::AccelProfile, capability::Capability, clickmethod::ClickMethod,
FallbackOutputMode, FocusFollowsMouseMode, InputDevice, LayerDirection, Seat,
SwitchEvent, Timeline, acceleration::AccelProfile, capability::Capability,
clickmethod::ClickMethod,
},
keyboard::{
Group, Keymap,
@ -1364,6 +1365,10 @@ impl ConfigClient {
self.send(&ClientMessage::SetFocusFollowsMouseMode { seat, mode })
}
pub fn set_fallback_output_mode(&self, seat: Seat, mode: FallbackOutputMode) {
self.send(&ClientMessage::SetFallbackOutputMode { seat, mode })
}
pub fn set_window_management_enabled(&self, seat: Seat, enabled: bool) {
self.send(&ClientMessage::SetWindowManagementEnabled { seat, enabled })
}

View file

@ -4,8 +4,9 @@ use {
Axis, Direction, PciId, Workspace,
client::{Client, ClientCapabilities, ClientMatcher},
input::{
FocusFollowsMouseMode, InputDevice, LayerDirection, Seat, SwitchEvent, Timeline,
acceleration::AccelProfile, capability::Capability, clickmethod::ClickMethod,
FallbackOutputMode, FocusFollowsMouseMode, InputDevice, LayerDirection, Seat,
SwitchEvent, Timeline, acceleration::AccelProfile, capability::Capability,
clickmethod::ClickMethod,
},
keyboard::{Group, Keymap, mods::Modifiers, syms::KeySym},
logging::LogLevel,
@ -826,6 +827,10 @@ pub enum ClientMessage<'a> {
groups: Option<Vec<Group<'a>>>,
options: Option<Vec<&'a str>>,
},
SetFallbackOutputMode {
seat: Seat,
mode: FallbackOutputMode,
},
}
#[derive(Serialize, Deserialize, Debug)]

View file

@ -503,6 +503,13 @@ impl Seat {
get!().set_focus_follows_mouse_mode(self, mode);
}
/// Sets the fallback output mode.
///
/// The default is `Cursor`.
pub fn set_fallback_output_mode(self, mode: FallbackOutputMode) {
get!().set_fallback_output_mode(self, mode);
}
/// Enables or disable window management mode.
///
/// In window management mode, floating windows can be moved by pressing the left
@ -650,6 +657,19 @@ pub enum FocusFollowsMouseMode {
False,
}
/// Defines which output is used when no particular output is specified.
///
/// This configures where to place a newly opened window or workspace, what window to focus when a
/// window is closed, which workspace is moved with [`Seat::move_to_output`], and similar actions.
#[derive(Serialize, Deserialize, Copy, Clone, Debug, Hash, Eq, PartialEq)]
#[non_exhaustive]
pub enum FallbackOutputMode {
/// Use the output the cursor is on.
Cursor,
/// Use the output the focus is on (highlighted window).
Focus,
}
/// Returns all seats.
pub fn get_seats() -> Vec<Seat> {
get!().seats()