command: s/master/main/g (breaking change)
main is a better term to use here for several reasons: 1. It is more accurate: "master" implies that the designated views have some kind of control over the other views, which is not the case. "main" better expresses that the difference between the "main" view and others is one of importance/focus. 2. It is a shorter word. 2 whole characters saved! 3. It reduces the chance of future development time being lost to good-intentioned people complaining about usage of the word master as has recently happened with regards to the default git branch name.
This commit is contained in:
@ -59,11 +59,11 @@ views: ViewStack(View) = .{},
|
||||
current: State = State{ .tags = 1 << 0 },
|
||||
pending: State = State{ .tags = 1 << 0 },
|
||||
|
||||
/// Number of views in "master" section of the screen.
|
||||
master_count: u32 = 1,
|
||||
/// Number of views in "main" section of the screen.
|
||||
main_count: u32 = 1,
|
||||
|
||||
/// Percentage of the total screen that the master section takes up.
|
||||
master_factor: f64 = 0.6,
|
||||
/// Percentage of the total screen that the "main" section takes up.
|
||||
main_factor: f64 = 0.6,
|
||||
|
||||
/// Current layout of the output. If it is "full", river will use the full
|
||||
/// layout. Otherwise river assumes it contains a string which, when executed
|
||||
@ -221,8 +221,8 @@ fn layoutExternal(self: *Self, visible_count: u32) !void {
|
||||
const layout_command = try std.fmt.allocPrint0(&arena.allocator, "{} {} {} {d} {} {}", .{
|
||||
self.layout,
|
||||
visible_count,
|
||||
self.master_count,
|
||||
self.master_factor,
|
||||
self.main_count,
|
||||
self.main_factor,
|
||||
layout_width,
|
||||
layout_height,
|
||||
});
|
||||
|
@ -59,8 +59,8 @@ const str_to_impl_fn = [_]struct {
|
||||
.{ .name = "layout", .impl = @import("command/layout.zig").layout },
|
||||
.{ .name = "map", .impl = @import("command/map.zig").map },
|
||||
.{ .name = "map-pointer", .impl = @import("command/map.zig").mapPointer },
|
||||
.{ .name = "mod-master-count", .impl = @import("command/mod_master_count.zig").modMasterCount },
|
||||
.{ .name = "mod-master-factor", .impl = @import("command/mod_master_factor.zig").modMasterFactor },
|
||||
.{ .name = "mod-main-count", .impl = @import("command/mod_main_count.zig").modMainCount },
|
||||
.{ .name = "mod-main-factor", .impl = @import("command/mod_main_factor.zig").modMainFactor },
|
||||
.{ .name = "move", .impl = @import("command/move.zig").move },
|
||||
.{ .name = "opacity", .impl = @import("command/opacity.zig").opacity },
|
||||
.{ .name = "outer-padding", .impl = @import("command/config.zig").outerPadding },
|
||||
|
@ -20,8 +20,8 @@ const std = @import("std");
|
||||
const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
/// Modify the number of master views
|
||||
pub fn modMasterCount(
|
||||
/// Modify the number of main views
|
||||
pub fn modMainCount(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const []const u8,
|
||||
@ -32,7 +32,7 @@ pub fn modMasterCount(
|
||||
|
||||
const delta = try std.fmt.parseInt(i32, args[1], 10);
|
||||
const output = seat.focused_output;
|
||||
output.master_count = @intCast(u32, std.math.max(0, @intCast(i32, output.master_count) + delta));
|
||||
output.main_count = @intCast(u32, std.math.max(0, @intCast(i32, output.main_count) + delta));
|
||||
output.arrangeViews();
|
||||
output.root.startTransaction();
|
||||
}
|
@ -20,8 +20,8 @@ const std = @import("std");
|
||||
const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
/// Modify the percent of the width of the screen that the master views occupy.
|
||||
pub fn modMasterFactor(
|
||||
/// Modify the percent of the width of the screen that the main views occupy.
|
||||
pub fn modMainFactor(
|
||||
allocator: *std.mem.Allocator,
|
||||
seat: *Seat,
|
||||
args: []const []const u8,
|
||||
@ -32,9 +32,9 @@ pub fn modMasterFactor(
|
||||
|
||||
const delta = try std.fmt.parseFloat(f64, args[1]);
|
||||
const output = seat.focused_output;
|
||||
const new_master_factor = std.math.min(std.math.max(output.master_factor + delta, 0.05), 0.95);
|
||||
if (new_master_factor != output.master_factor) {
|
||||
output.master_factor = new_master_factor;
|
||||
const new_main_factor = std.math.min(std.math.max(output.main_factor + delta, 0.05), 0.95);
|
||||
if (new_main_factor != output.main_factor) {
|
||||
output.main_factor = new_main_factor;
|
||||
output.arrangeViews();
|
||||
output.root.startTransaction();
|
||||
}
|
Reference in New Issue
Block a user