docs: improve explanation of tags

"tagmask" is a misleading term as the arguments are used much more like
a set of tags than a mask.
This commit is contained in:
Isaac Freund 2020-12-30 14:25:37 +01:00
parent ac20f5aa1d
commit 5f4ba06566
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
3 changed files with 32 additions and 23 deletions

View File

@ -68,26 +68,26 @@ riverctl map-pointer normal $mod BTN_RIGHT resize-view
for i in $(seq 1 9) for i in $(seq 1 9)
do do
tagmask=$((1 << ($i - 1))) tags=$((1 << ($i - 1)))
# Mod+[1-9] to focus tag [0-8] # Mod+[1-9] to focus tag [0-8]
riverctl map normal $mod $i set-focused-tags $tagmask riverctl map normal $mod $i set-focused-tags $tags
# Mod+Shift+[1-9] to tag focused view with tag [0-8] # Mod+Shift+[1-9] to tag focused view with tag [0-8]
riverctl map normal $mod+Shift $i set-view-tags $tagmask riverctl map normal $mod+Shift $i set-view-tags $tags
# Mod+Ctrl+[1-9] to toggle focus of tag [0-8] # Mod+Ctrl+[1-9] to toggle focus of tag [0-8]
riverctl map normal $mod+Control $i toggle-focused-tags $tagmask riverctl map normal $mod+Control $i toggle-focused-tags $tags
# Mod+Shift+Ctrl+[1-9] to toggle tag [0-8] of focused view # Mod+Shift+Ctrl+[1-9] to toggle tag [0-8] of focused view
riverctl map normal $mod+Shift+Control $i toggle-view-tags $tagmask riverctl map normal $mod+Shift+Control $i toggle-view-tags $tags
done done
# Mod+0 to focus all tags # Mod+0 to focus all tags
# Mod+Shift+0 to tag focused view with all tags # Mod+Shift+0 to tag focused view with all tags
all_tags_mask=$(((1 << 32) - 1)) all_tags=$(((1 << 32) - 1))
riverctl map normal $mod 0 set-focused-tags $all_tags_mask riverctl map normal $mod 0 set-focused-tags $all_tags
riverctl map normal $mod+Shift 0 set-view-tags $all_tags_mask riverctl map normal $mod+Shift 0 set-view-tags $all_tags
# Mod+Space to toggle float # Mod+Space to toggle float
riverctl map normal $mod Space toggle-float riverctl map normal $mod Space toggle-float

View File

@ -92,25 +92,34 @@ control and configure river.
Bump the focused view to the top of the layout stack to make it the new Bump the focused view to the top of the layout stack to make it the new
master. master.
## ACTIONS ON TAGS ## TAG MANAGEMENT
Tags are like workspaces but more flexible: You can assign views to multiple Tags are similar to workspaces but more flexible. You can assign views multiple
tags and look at multiple tags at once. A _tagmask_ is used to represent which tags and focus multiple tags simultaneously. Bitfields are used to describe
tags are visible. The following commands take a _tagmask_ in base 10 as sets of tags when interfacing with river. As such, the following commands
argument but _tagmasks_ are best understood in binary: 000000001 means that the take a normal base 10 number as their argument but the semantics are best
first tag is visible; 111111111 means that tag 1 through 9 are visible. understood in binary. The binary number 000000001 represents a set containing
only tag 1 while 100001101 represents a set containing tags 1, 3, 4, and 9.
*set-focused-tags* _tagmask_ At least one tag must always be focused and each view must be assigned at
Show the tags specified with _tagmask_. least one tag. Operations that would violate either of these requirements
are ignored by river.
*set-view-tags* _tagmask_ *set-focused-tags* _tags_
Assign focused view to tags specified with _tagmask_. Show views with tags corresponding to the set bits of _tags_ on the
currently focused output.
*toggle-focused-tags* _tagmask_ *set-view-tags* _tags_
Toggle visibility of tags specified with _tagmask_. Assign the currently focused view the tags corresponding to the set
bits of _tags_.
*toggle-view-tags* _tagmask_ *toggle-focused-tags* _tags_
Toggle tags of focused view as specified with _tagmask_. Toggle visibility of views with tags corresponding to the set bits
of _tags_ on the currently focused output.
*toggle-view-tags* _tags_
Toggle the tags of the currently focused view corresponding to the
set bits of _tags_.
## CONFIGURATION COMMANDS ## CONFIGURATION COMMANDS

View File

@ -100,7 +100,7 @@ fn parseTags(
const tags = try std.fmt.parseInt(u32, args[1], 10); const tags = try std.fmt.parseInt(u32, args[1], 10);
if (tags == 0) { if (tags == 0) {
out.* = try std.fmt.allocPrint(allocator, "tagmask may not be 0", .{}); out.* = try std.fmt.allocPrint(allocator, "tags may not be 0", .{});
return Error.Other; return Error.Other;
} }