1
0
Fork 0
forked from wry/wry

seat: add focus history

This commit is contained in:
Julian Orth 2025-07-18 20:09:34 +02:00
parent 9941263a82
commit d12234b38b
21 changed files with 546 additions and 22 deletions

View file

@ -15,8 +15,8 @@ use {
client::{Client, ClientCriterion, ClientMatcher, MatchedClient},
exec::Command,
input::{
FocusFollowsMouseMode, InputDevice, Seat, SwitchEvent, acceleration::AccelProfile,
capability::Capability, clickmethod::ClickMethod,
FocusFollowsMouseMode, InputDevice, Seat, SwitchEvent, Timeline,
acceleration::AccelProfile, capability::Capability, clickmethod::ClickMethod,
},
keyboard::{
Keymap,
@ -364,6 +364,21 @@ impl ConfigClient {
self.send(&ClientMessage::GrabKb { kb, grab });
}
pub fn seat_focus_history(&self, seat: Seat, timeline: Timeline) {
self.send(&ClientMessage::SeatFocusHistory { seat, timeline });
}
pub fn seat_focus_history_set_only_visible(&self, seat: Seat, only_visible: bool) {
self.send(&ClientMessage::SeatFocusHistorySetOnlyVisible { seat, only_visible });
}
pub fn seat_focus_history_set_same_workspace(&self, seat: Seat, same_workspace: bool) {
self.send(&ClientMessage::SeatFocusHistorySetSameWorkspace {
seat,
same_workspace,
});
}
pub fn seat_focus(&self, seat: Seat, direction: Direction) {
self.send(&ClientMessage::SeatFocus { seat, direction });
}

View file

@ -4,8 +4,8 @@ use {
Axis, Direction, PciId, Workspace,
client::{Client, ClientMatcher},
input::{
FocusFollowsMouseMode, InputDevice, Seat, SwitchEvent, acceleration::AccelProfile,
capability::Capability, clickmethod::ClickMethod,
FocusFollowsMouseMode, InputDevice, Seat, SwitchEvent, Timeline,
acceleration::AccelProfile, capability::Capability, clickmethod::ClickMethod,
},
keyboard::{Keymap, mods::Modifiers, syms::KeySym},
logging::LogLevel,
@ -725,6 +725,18 @@ pub enum ClientMessage<'a> {
show: bool,
},
GetShowBar,
SeatFocusHistory {
seat: Seat,
timeline: Timeline,
},
SeatFocusHistorySetOnlyVisible {
seat: Seat,
only_visible: bool,
},
SeatFocusHistorySetSameWorkspace {
seat: Seat,
same_workspace: bool,
},
}
#[derive(Serialize, Deserialize, Debug)]

View file

@ -182,6 +182,13 @@ impl InputDevice {
}
}
/// A direction in a timeline.
#[derive(Serialize, Deserialize, Copy, Clone, Debug, Hash, Eq, PartialEq)]
pub enum Timeline {
Older,
Newer,
}
/// A seat.
#[derive(Serialize, Deserialize, Copy, Clone, Debug, Hash, Eq, PartialEq)]
pub struct Seat(pub u64);
@ -273,6 +280,29 @@ impl Seat {
get!().unbind(self, mod_sym.into())
}
/// Moves the focus in the focus history.
pub fn focus_history(self, timeline: Timeline) {
get!().seat_focus_history(self, timeline)
}
/// Configures whether the focus history only includes visible windows.
///
/// If this is `false`, then hidden windows will be made visible before moving the
/// focus to them.
///
/// The default is `false`.
pub fn focus_history_set_only_visible(self, only_visible: bool) {
get!().seat_focus_history_set_only_visible(self, only_visible)
}
/// Configures whether the focus history only includes windows on the same workspace
/// as the currently focused window.
///
/// The default is `false`.
pub fn focus_history_set_same_workspace(self, same_workspace: bool) {
get!().seat_focus_history_set_same_workspace(self, same_workspace)
}
/// Moves the keyboard focus of the seat in the specified direction.
pub fn focus(self, direction: Direction) {
get!().seat_focus(self, direction)