1
0
Fork 0
forked from wry/wry

config: add focus-below and focus-above actions

This commit is contained in:
Julian Orth 2025-07-19 22:01:50 +02:00
parent c034ea7604
commit bd85db5b59
12 changed files with 211 additions and 19 deletions

View file

@ -15,7 +15,7 @@ use {
client::{Client, ClientCriterion, ClientMatcher, MatchedClient},
exec::Command,
input::{
FocusFollowsMouseMode, InputDevice, Seat, SwitchEvent, Timeline,
FocusFollowsMouseMode, InputDevice, LayerDirection, Seat, SwitchEvent, Timeline,
acceleration::AccelProfile, capability::Capability, clickmethod::ClickMethod,
},
keyboard::{
@ -379,6 +379,10 @@ impl ConfigClient {
});
}
pub fn seat_focus_layer_rel(&self, seat: Seat, direction: LayerDirection) {
self.send(&ClientMessage::SeatFocusLayerRel { seat, direction });
}
pub fn seat_focus(&self, seat: Seat, direction: Direction) {
self.send(&ClientMessage::SeatFocus { seat, direction });
}

View file

@ -4,7 +4,7 @@ use {
Axis, Direction, PciId, Workspace,
client::{Client, ClientMatcher},
input::{
FocusFollowsMouseMode, InputDevice, Seat, SwitchEvent, Timeline,
FocusFollowsMouseMode, InputDevice, LayerDirection, Seat, SwitchEvent, Timeline,
acceleration::AccelProfile, capability::Capability, clickmethod::ClickMethod,
},
keyboard::{Keymap, mods::Modifiers, syms::KeySym},
@ -737,6 +737,10 @@ pub enum ClientMessage<'a> {
seat: Seat,
same_workspace: bool,
},
SeatFocusLayerRel {
seat: Seat,
direction: LayerDirection,
},
}
#[derive(Serialize, Deserialize, Debug)]

View file

@ -189,6 +189,13 @@ pub enum Timeline {
Newer,
}
/// A direction for layer traversal.
#[derive(Serialize, Deserialize, Copy, Clone, Debug, Hash, Eq, PartialEq)]
pub enum LayerDirection {
Below,
Above,
}
/// A seat.
#[derive(Serialize, Deserialize, Copy, Clone, Debug, Hash, Eq, PartialEq)]
pub struct Seat(pub u64);
@ -303,6 +310,12 @@ impl Seat {
get!().seat_focus_history_set_same_workspace(self, same_workspace)
}
/// Moves the keyboard focus of the seat to the layer above or below the current
/// layer.
pub fn focus_layer_rel(self, direction: LayerDirection) {
get!().seat_focus_layer_rel(self, direction)
}
/// Moves the keyboard focus of the seat in the specified direction.
pub fn focus(self, direction: Direction) {
get!().seat_focus(self, direction)