Cursor: revive 'always' focus-follows-cursor mode
This was removed a while back because it was buggy and I didn't know of anyone using it. Since refactoring it is now trivial to implement and I know of at least one person using it, so I don't mind reviving it.
This commit is contained in:
parent
2df2151afa
commit
50c9e3d81b
@ -59,7 +59,7 @@ function __riverctl_completion ()
|
|||||||
"map") OPTS="-release -repeat -layout" ;;
|
"map") OPTS="-release -repeat -layout" ;;
|
||||||
"unmap") OPTS="-release" ;;
|
"unmap") OPTS="-release" ;;
|
||||||
"attach-mode") OPTS="top bottom" ;;
|
"attach-mode") OPTS="top bottom" ;;
|
||||||
"focus-follows-cursor") OPTS="disabled normal" ;;
|
"focus-follows-cursor") OPTS="disabled normal always" ;;
|
||||||
"set-cursor-warp") OPTS="disabled on-output-change" ;;
|
"set-cursor-warp") OPTS="disabled on-output-change" ;;
|
||||||
"hide-cursor") OPTS="timeout when-typing" ;;
|
"hide-cursor") OPTS="timeout when-typing" ;;
|
||||||
*) return ;;
|
*) return ;;
|
||||||
|
@ -73,7 +73,7 @@ complete -c riverctl -x -n '__fish_seen_subcommand_from swap' -a
|
|||||||
complete -c riverctl -x -n '__fish_seen_subcommand_from map' -a '-release -repeat -layout'
|
complete -c riverctl -x -n '__fish_seen_subcommand_from map' -a '-release -repeat -layout'
|
||||||
complete -c riverctl -x -n '__fish_seen_subcommand_from unmap' -a '-release'
|
complete -c riverctl -x -n '__fish_seen_subcommand_from unmap' -a '-release'
|
||||||
complete -c riverctl -x -n '__fish_seen_subcommand_from attach-mode' -a 'top bottom'
|
complete -c riverctl -x -n '__fish_seen_subcommand_from attach-mode' -a 'top bottom'
|
||||||
complete -c riverctl -x -n '__fish_seen_subcommand_from focus-follows-cursor' -a 'disabled normal'
|
complete -c riverctl -x -n '__fish_seen_subcommand_from focus-follows-cursor' -a 'disabled normal always'
|
||||||
complete -c riverctl -x -n '__fish_seen_subcommand_from set-cursor-warp' -a 'disabled on-output-change'
|
complete -c riverctl -x -n '__fish_seen_subcommand_from set-cursor-warp' -a 'disabled on-output-change'
|
||||||
|
|
||||||
# Subcommands for 'input'
|
# Subcommands for 'input'
|
||||||
|
@ -172,7 +172,7 @@ _riverctl()
|
|||||||
map) _alternative 'arguments:optional:(-release -repeat -layout)' ;;
|
map) _alternative 'arguments:optional:(-release -repeat -layout)' ;;
|
||||||
unmap) _alternative 'arguments:optional:(-release)' ;;
|
unmap) _alternative 'arguments:optional:(-release)' ;;
|
||||||
attach-mode) _alternative 'arguments:args:(top bottom)' ;;
|
attach-mode) _alternative 'arguments:args:(top bottom)' ;;
|
||||||
focus-follows-cursor) _alternative 'arguments:args:(disabled normal)' ;;
|
focus-follows-cursor) _alternative 'arguments:args:(disabled normal always)' ;;
|
||||||
set-cursor-warp) _alternative 'arguments:args:(disabled on-output-change)' ;;
|
set-cursor-warp) _alternative 'arguments:args:(disabled on-output-change)' ;;
|
||||||
hide-cursor) _riverctl_hide_cursor ;;
|
hide-cursor) _riverctl_hide_cursor ;;
|
||||||
*) return 0 ;;
|
*) return 0 ;;
|
||||||
|
@ -282,14 +282,16 @@ A complete list may be found in _/usr/include/linux/input-event-codes.h_
|
|||||||
*border-width* _pixels_
|
*border-width* _pixels_
|
||||||
Set the border width to _pixels_.
|
Set the border width to _pixels_.
|
||||||
|
|
||||||
*focus-follows-cursor* *disabled*|*normal*
|
*focus-follows-cursor* *disabled*|*normal*|*always*
|
||||||
There are two available modes:
|
There are three available modes:
|
||||||
|
|
||||||
- _disabled_: Moving the cursor does not affect focus. This is
|
- _disabled_: Moving the cursor does not affect focus. This is
|
||||||
the default.
|
the default.
|
||||||
- _normal_: Moving the cursor over a view will focus that view.
|
- _normal_: Moving the cursor over a view will focus that view.
|
||||||
Moving the cursor within a view will not re-focus that view if
|
Moving the cursor within a view will not re-focus that view if
|
||||||
focus has moved elsewhere.
|
focus has moved elsewhere.
|
||||||
|
- _always_: Moving the cursor will always focus whatever view is
|
||||||
|
under the cursor.
|
||||||
|
|
||||||
If the view to be focused is on an output that does not have focus,
|
If the view to be focused is on an output that does not have focus,
|
||||||
focus is switched to that output.
|
focus is switched to that output.
|
||||||
|
@ -29,6 +29,8 @@ pub const FocusFollowsCursorMode = enum {
|
|||||||
disabled,
|
disabled,
|
||||||
/// Only change focus on entering a surface
|
/// Only change focus on entering a surface
|
||||||
normal,
|
normal,
|
||||||
|
/// Change focus on any cursor movement
|
||||||
|
always,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const WarpCursorMode = enum {
|
pub const WarpCursorMode = enum {
|
||||||
|
@ -902,7 +902,9 @@ pub fn checkFocusFollowsCursor(self: *Self) void {
|
|||||||
if (self.seat.pointer_drag) return;
|
if (self.seat.pointer_drag) return;
|
||||||
if (server.config.focus_follows_cursor == .disabled) return;
|
if (server.config.focus_follows_cursor == .disabled) return;
|
||||||
if (self.surfaceAt()) |result| {
|
if (self.surfaceAt()) |result| {
|
||||||
if (self.seat.wlr_seat.pointer_state.focused_surface != result.surface) {
|
if (server.config.focus_follows_cursor == .always or
|
||||||
|
self.seat.wlr_seat.pointer_state.focused_surface != result.surface)
|
||||||
|
{
|
||||||
switch (result.parent) {
|
switch (result.parent) {
|
||||||
.view => |view| {
|
.view => |view| {
|
||||||
if (self.seat.focused != .view or self.seat.focused.view != view) {
|
if (self.seat.focused != .view or self.seat.focused.view != view) {
|
||||||
|
Loading…
Reference in New Issue
Block a user