1
0
Fork 0
forked from wry/wry

config: add create-mark, jump-to-mark, and copy-mark actions

This commit is contained in:
Julian Orth 2025-07-20 15:44:50 +02:00
parent e30e2595a1
commit eb625b34cc
19 changed files with 1193 additions and 9 deletions

View file

@ -987,6 +987,18 @@ impl ConfigClient {
self.send(&ClientMessage::SetMiddleClickPasteEnabled { enabled });
}
pub fn seat_create_mark(&self, seat: Seat, kc: Option<u32>) {
self.send(&ClientMessage::SeatCreateMark { seat, kc });
}
pub fn seat_jump_to_mark(&self, seat: Seat, kc: Option<u32>) {
self.send(&ClientMessage::SeatJumpToMark { seat, kc });
}
pub fn seat_copy_mark(&self, seat: Seat, src: u32, dst: u32) {
self.send(&ClientMessage::SeatCopyMark { seat, src, dst });
}
pub fn set_show_float_pin_icon(&self, show: bool) {
self.send(&ClientMessage::SetShowFloatPinIcon { show });
}

View file

@ -747,6 +747,19 @@ pub enum ClientMessage<'a> {
SetMiddleClickPasteEnabled {
enabled: bool,
},
SeatCreateMark {
seat: Seat,
kc: Option<u32>,
},
SeatJumpToMark {
seat: Seat,
kc: Option<u32>,
},
SeatCopyMark {
seat: Seat,
src: u32,
dst: u32,
},
}
#[derive(Serialize, Deserialize, Debug)]

View file

@ -566,6 +566,34 @@ impl Seat {
pub fn set_pointer_revert_key(self, sym: KeySym) {
get!().set_pointer_revert_key(self, sym);
}
/// Creates a mark for the currently focused window.
///
/// `kc` should be an evdev keycode. If `kc` is none, then the keycode will be
/// inferred from the next key press. Pressing escape during this interactive
/// selection aborts the process.
///
/// Currently very few `u32` are valid keycodes. Large numbers can therefore be used
/// to create marks that do not correspond to a key. However, `kc` should always be
/// less than `u32::MAX - 8`.
pub fn create_mark(self, kc: Option<u32>) {
get!().seat_create_mark(self, kc);
}
/// Moves the keyboard focus to a window identified by a mark.
///
/// See [`Seat::create_mark`] for information about the `kc` parameter.
pub fn jump_to_mark(self, kc: Option<u32>) {
get!().seat_jump_to_mark(self, kc);
}
/// Copies a mark from one keycode to another.
///
/// If the `src` keycode identifies a mark before this function is called, the `dst`
/// keycode will identify the same mark afterwards.
pub fn copy_mark(self, src: u32, dst: u32) {
get!().seat_copy_mark(self, src, dst);
}
}
/// A focus-follows-mouse mode.