river: add focus-previous-tags command
This commit is contained in:
parent
604cf98047
commit
28fc8792d7
7 changed files with 30 additions and 0 deletions
|
@ -25,6 +25,7 @@ function __riverctl_completion ()
|
||||||
set-layout-value \
|
set-layout-value \
|
||||||
mod-layout-value \
|
mod-layout-value \
|
||||||
set-focused-tags \
|
set-focused-tags \
|
||||||
|
focus-previous-tags \
|
||||||
set-view-tags \
|
set-view-tags \
|
||||||
toggle-focused-tags \
|
toggle-focused-tags \
|
||||||
toggle-view-tags \
|
toggle-view-tags \
|
||||||
|
|
|
@ -64,6 +64,7 @@ complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a set-view-
|
||||||
complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a toggle-focused-tags -d 'Toggle visibility of views with tags corresponding to the set bits of tags'
|
complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a toggle-focused-tags -d 'Toggle visibility of views with tags corresponding to the set bits of tags'
|
||||||
complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a toggle-view-tags -d 'Toggle the tags of the currently focused view'
|
complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a toggle-view-tags -d 'Toggle the tags of the currently focused view'
|
||||||
complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a spawn-tagmask -d 'Set a tagmask to filter the tags assigned to newly spawned views on the focused output'
|
complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a spawn-tagmask -d 'Set a tagmask to filter the tags assigned to newly spawned views on the focused output'
|
||||||
|
complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a focus-previous-tags -d 'Sets tags to their previous value on the focused output'
|
||||||
# Mappings
|
# Mappings
|
||||||
complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a declare-mode -d 'Create a new mode'
|
complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a declare-mode -d 'Create a new mode'
|
||||||
complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a enter-mode -d 'Switch to given mode if it exists'
|
complete -c riverctl -x -n '__fish_riverctl_complete_no_subcommand' -a enter-mode -d 'Switch to given mode if it exists'
|
||||||
|
|
|
@ -33,6 +33,7 @@ _riverctl_subcommands()
|
||||||
'toggle-focused-tags:Toggle visibility of views with tags corresponding to the set bits of tags'
|
'toggle-focused-tags:Toggle visibility of views with tags corresponding to the set bits of tags'
|
||||||
'toggle-view-tags:Toggle the tags of the currently focused view'
|
'toggle-view-tags:Toggle the tags of the currently focused view'
|
||||||
'spawn-tagmask:Set a tagmask to filter the tags assigned to newly spawned views on the focused output'
|
'spawn-tagmask:Set a tagmask to filter the tags assigned to newly spawned views on the focused output'
|
||||||
|
'focus-previous-tags:Sets tags to their previous value on the focused output'
|
||||||
# Mappings
|
# Mappings
|
||||||
'declare-mode:Create a new mode'
|
'declare-mode:Create a new mode'
|
||||||
'enter-mode:Switch to given mode if it exists'
|
'enter-mode:Switch to given mode if it exists'
|
||||||
|
|
|
@ -139,6 +139,10 @@ are ignored by river.
|
||||||
will be assigned the tags 000010001. If no tags would remain after
|
will be assigned the tags 000010001. If no tags would remain after
|
||||||
filtering, the _tagmask_ is ignored.
|
filtering, the _tagmask_ is ignored.
|
||||||
|
|
||||||
|
*focus-previous-tags*
|
||||||
|
Sets tags to their previous value on the currently focused output,
|
||||||
|
allowing jumping back and forth between 2 tag setups.
|
||||||
|
|
||||||
## MAPPINGS
|
## MAPPINGS
|
||||||
|
|
||||||
Mappings are modal in river. Each mapping is associated with a mode and is
|
Mappings are modal in river. Each mapping is associated with a mode and is
|
||||||
|
|
|
@ -72,6 +72,9 @@ views: ViewStack(View) = .{},
|
||||||
current: State = State{ .tags = 1 << 0 },
|
current: State = State{ .tags = 1 << 0 },
|
||||||
pending: State = State{ .tags = 1 << 0 },
|
pending: State = State{ .tags = 1 << 0 },
|
||||||
|
|
||||||
|
/// Remembered version of tags (from last run)
|
||||||
|
previous_tags: u32 = 1 << 0,
|
||||||
|
|
||||||
/// The currently active LayoutDemand
|
/// The currently active LayoutDemand
|
||||||
layout_demand: ?LayoutDemand = null,
|
layout_demand: ?LayoutDemand = null,
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,7 @@ const str_to_impl_fn = [_]struct {
|
||||||
.{ .name = "toggle-focused-tags", .impl = @import("command/tags.zig").toggleFocusedTags },
|
.{ .name = "toggle-focused-tags", .impl = @import("command/tags.zig").toggleFocusedTags },
|
||||||
.{ .name = "toggle-fullscreen", .impl = @import("command/toggle_fullscreen.zig").toggleFullscreen },
|
.{ .name = "toggle-fullscreen", .impl = @import("command/toggle_fullscreen.zig").toggleFullscreen },
|
||||||
.{ .name = "toggle-view-tags", .impl = @import("command/tags.zig").toggleViewTags },
|
.{ .name = "toggle-view-tags", .impl = @import("command/tags.zig").toggleViewTags },
|
||||||
|
.{ .name = "focus-previous-tags", .impl = @import("command/tags.zig").focusPreviousTags },
|
||||||
.{ .name = "unmap", .impl = @import("command/map.zig").unmap },
|
.{ .name = "unmap", .impl = @import("command/map.zig").unmap },
|
||||||
.{ .name = "unmap-pointer", .impl = @import("command/map.zig").unmapPointer },
|
.{ .name = "unmap-pointer", .impl = @import("command/map.zig").unmapPointer },
|
||||||
.{ .name = "xcursor-theme", .impl = @import("command/xcursor_theme.zig").xcursorTheme },
|
.{ .name = "xcursor-theme", .impl = @import("command/xcursor_theme.zig").xcursorTheme },
|
||||||
|
|
|
@ -31,6 +31,7 @@ pub fn setFocusedTags(
|
||||||
) Error!void {
|
) Error!void {
|
||||||
const tags = try parseTags(allocator, args, out);
|
const tags = try parseTags(allocator, args, out);
|
||||||
if (seat.focused_output.pending.tags != tags) {
|
if (seat.focused_output.pending.tags != tags) {
|
||||||
|
seat.focused_output.previous_tags = seat.focused_output.pending.tags;
|
||||||
seat.focused_output.pending.tags = tags;
|
seat.focused_output.pending.tags = tags;
|
||||||
seat.focused_output.arrangeViews();
|
seat.focused_output.arrangeViews();
|
||||||
seat.focus(null);
|
seat.focus(null);
|
||||||
|
@ -76,6 +77,7 @@ pub fn toggleFocusedTags(
|
||||||
const output = seat.focused_output;
|
const output = seat.focused_output;
|
||||||
const new_focused_tags = output.pending.tags ^ tags;
|
const new_focused_tags = output.pending.tags ^ tags;
|
||||||
if (new_focused_tags != 0) {
|
if (new_focused_tags != 0) {
|
||||||
|
output.previous_tags = output.pending.tags;
|
||||||
output.pending.tags = new_focused_tags;
|
output.pending.tags = new_focused_tags;
|
||||||
output.arrangeViews();
|
output.arrangeViews();
|
||||||
seat.focus(null);
|
seat.focus(null);
|
||||||
|
@ -102,6 +104,23 @@ pub fn toggleViewTags(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Switch focus to tags that were selected previously
|
||||||
|
pub fn focusPreviousTags(
|
||||||
|
allocator: *std.mem.Allocator,
|
||||||
|
seat: *Seat,
|
||||||
|
args: []const []const u8,
|
||||||
|
out: *?[]const u8,
|
||||||
|
) Error!void {
|
||||||
|
const previous_tags = seat.focused_output.previous_tags;
|
||||||
|
if (seat.focused_output.pending.tags != previous_tags) {
|
||||||
|
seat.focused_output.previous_tags = seat.focused_output.pending.tags;
|
||||||
|
seat.focused_output.pending.tags = previous_tags;
|
||||||
|
seat.focused_output.arrangeViews();
|
||||||
|
seat.focus(null);
|
||||||
|
server.root.startTransaction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn parseTags(
|
fn parseTags(
|
||||||
allocator: *std.mem.Allocator,
|
allocator: *std.mem.Allocator,
|
||||||
args: []const [:0]const u8,
|
args: []const [:0]const u8,
|
||||||
|
|
Loading…
Reference in a new issue