command: add background_color option
This is trivial to support and allows basic customization without running a layer-shell program such as swaybg. This is especially useful in low memory situations.
This commit is contained in:
parent
2ef8261493
commit
ebc661f4a7
4 changed files with 9 additions and 2 deletions
|
@ -114,6 +114,7 @@ that tag 1 through 9 are visible.
|
|||
*set-option* _option_ _value_
|
||||
Set _option_ to a specified _value_. List of valid options:
|
||||
|
||||
- *background_color* _RGB/RGBA_hex_code_
|
||||
- *border_width* _non-negative_integer_
|
||||
- *border_color_focused* _RGB/RGBA_hex_code_
|
||||
- *border_color_unfocused* _RGB/RGBA_hex_code_
|
||||
|
|
|
@ -25,6 +25,9 @@ const util = @import("util.zig");
|
|||
const Server = @import("Server.zig");
|
||||
const Mapping = @import("Mapping.zig");
|
||||
|
||||
/// Color of background in RGBA (alpha should only affect nested sessions)
|
||||
background_color: [4]f32,
|
||||
|
||||
/// Width of borders in pixels
|
||||
border_width: u32,
|
||||
|
||||
|
@ -50,6 +53,7 @@ modes: std.ArrayList(std.ArrayList(Mapping)),
|
|||
float_filter: std.ArrayList([*:0]const u8),
|
||||
|
||||
pub fn init(self: *Self) !void {
|
||||
self.background_color = [_]f32{ 0.0, 0.16862745, 0.21176471, 1.0 }; // Solarized base03
|
||||
self.border_width = 2;
|
||||
self.border_color_focused = [_]f32{ 0.57647059, 0.63137255, 0.63137255, 1.0 }; // Solarized base1
|
||||
self.border_color_unfocused = [_]f32{ 0.34509804, 0.43137255, 0.45882353, 1.0 }; // Solarized base0
|
||||
|
|
|
@ -22,6 +22,7 @@ const Error = @import("../command.zig").Error;
|
|||
const Seat = @import("../Seat.zig");
|
||||
|
||||
const Option = enum {
|
||||
background_color,
|
||||
border_width,
|
||||
border_color_focused,
|
||||
border_color_unfocused,
|
||||
|
@ -45,6 +46,7 @@ pub fn setOption(
|
|||
|
||||
// Assign value to option.
|
||||
switch (option) {
|
||||
.background_color => config.background_color = try parseRgba(args[2]),
|
||||
.border_width => config.border_width = try std.fmt.parseInt(u32, args[2], 10),
|
||||
.border_color_focused => config.border_color_focused = try parseRgba(args[2]),
|
||||
.border_color_unfocused => config.border_color_unfocused = try parseRgba(args[2]),
|
||||
|
|
|
@ -39,6 +39,7 @@ const SurfaceRenderData = struct {
|
|||
};
|
||||
|
||||
pub fn renderOutput(output: *Output) void {
|
||||
const config = &output.root.server.config;
|
||||
const wlr_renderer = output.getRenderer();
|
||||
|
||||
var now: c.timespec = undefined;
|
||||
|
@ -55,8 +56,7 @@ pub fn renderOutput(output: *Output) void {
|
|||
// Begin the renderer (calls glViewport and some other GL sanity checks)
|
||||
c.wlr_renderer_begin(wlr_renderer, width, height);
|
||||
|
||||
const color = [_]f32{ 0.0, 0.16862745, 0.21176471, 1.0 };
|
||||
c.wlr_renderer_clear(wlr_renderer, &color);
|
||||
c.wlr_renderer_clear(wlr_renderer, &config.background_color);
|
||||
|
||||
renderLayer(output.*, output.layers[c.ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &now);
|
||||
renderLayer(output.*, output.layers[c.ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &now);
|
||||
|
|
Loading…
Reference in a new issue