mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
config: minor config changes
This commit is contained in:
@ -403,7 +403,7 @@ pub fn syncAppearance(self: *Window, config: *const configpkg.Config) !void {
|
|||||||
const blurred = switch (config.@"background-blur-radius") {
|
const blurred = switch (config.@"background-blur-radius") {
|
||||||
.false => false,
|
.false => false,
|
||||||
.true => true,
|
.true => true,
|
||||||
.value => |v| v > 0,
|
.radius => |v| v > 0,
|
||||||
};
|
};
|
||||||
try wl.setBlur(blurred);
|
try wl.setBlur(blurred);
|
||||||
}
|
}
|
||||||
|
@ -5666,7 +5666,7 @@ pub const AutoUpdate = enum {
|
|||||||
pub const BackgroundBlur = union(enum) {
|
pub const BackgroundBlur = union(enum) {
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
value: u8,
|
radius: u8,
|
||||||
|
|
||||||
pub fn parseCLI(self: *BackgroundBlur, input: ?[]const u8) !void {
|
pub fn parseCLI(self: *BackgroundBlur, input: ?[]const u8) !void {
|
||||||
const input_ = input orelse {
|
const input_ = input orelse {
|
||||||
@ -5675,19 +5675,21 @@ pub const BackgroundBlur = union(enum) {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (cli.args.parseBool(input_)) |b| {
|
self.* = if (cli.args.parseBool(input_)) |b|
|
||||||
self.* = if (b) .true else .false;
|
if (b) .true else .false
|
||||||
} else |_| {
|
else |_|
|
||||||
const value = std.fmt.parseInt(u8, input_, 0) catch return error.InvalidValue;
|
.{ .radius = std.fmt.parseInt(
|
||||||
self.* = .{ .value = value };
|
u8,
|
||||||
}
|
input_,
|
||||||
|
0,
|
||||||
|
) catch return error.InvalidValue };
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cval(self: BackgroundBlur) u8 {
|
pub fn cval(self: BackgroundBlur) u8 {
|
||||||
return switch (self) {
|
return switch (self) {
|
||||||
.false => 0,
|
.false => 0,
|
||||||
.true => 20,
|
.true => 20,
|
||||||
.value => |v| v,
|
.radius => |v| v,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5698,7 +5700,7 @@ pub const BackgroundBlur = union(enum) {
|
|||||||
switch (self) {
|
switch (self) {
|
||||||
.false => try formatter.formatEntry(bool, false),
|
.false => try formatter.formatEntry(bool, false),
|
||||||
.true => try formatter.formatEntry(bool, true),
|
.true => try formatter.formatEntry(bool, true),
|
||||||
.value => |v| try formatter.formatEntry(u8, v),
|
.radius => |v| try formatter.formatEntry(u8, v),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5716,7 +5718,7 @@ pub const BackgroundBlur = union(enum) {
|
|||||||
try testing.expectEqual(.false, v);
|
try testing.expectEqual(.false, v);
|
||||||
|
|
||||||
try v.parseCLI("42");
|
try v.parseCLI("42");
|
||||||
try testing.expectEqual(42, v.value);
|
try testing.expectEqual(42, v.radius);
|
||||||
|
|
||||||
try testing.expectError(error.InvalidValue, v.parseCLI(""));
|
try testing.expectError(error.InvalidValue, v.parseCLI(""));
|
||||||
try testing.expectError(error.InvalidValue, v.parseCLI("aaaa"));
|
try testing.expectError(error.InvalidValue, v.parseCLI("aaaa"));
|
||||||
|
Reference in New Issue
Block a user