Implement configuration for the Bar
This adds a few new options for the bar (instead of hardcoding all of them). fonts, text_color, background_color, positoon, and margins. Also fixed a couple of bugs when reloading the config and destroying layer shell and wl surfaces in the wrong order.
This commit is contained in:
parent
ce9a972b60
commit
5922107579
9 changed files with 371 additions and 84 deletions
|
|
@ -92,13 +92,15 @@ pub fn create(context: *Context, river_output_v1: *river.OutputV1) !*Output {
|
|||
var output = try utils.gpa.create(Output);
|
||||
errdefer utils.gpa.destroy(output);
|
||||
|
||||
var bar = Bar.init(context, output) catch |e| blk: {
|
||||
log.err("Failed to create a bar: {}", .{e});
|
||||
break :blk null;
|
||||
};
|
||||
var bar = if (context.config.bar_config) |bar_config| blk: {
|
||||
break :blk Bar.init(context, output, bar_config.toBarOptions()) catch |e| {
|
||||
log.err("Failed to create a bar: {}", .{e});
|
||||
break :blk null;
|
||||
};
|
||||
} else null;
|
||||
errdefer if (bar) |*b| b.deinit();
|
||||
|
||||
var tag_overlay = if (context.config.tag_overlay) |tag_overlay_config| blk: {
|
||||
var tag_overlay = if (context.config.tag_overlay_config) |tag_overlay_config| blk: {
|
||||
break :blk TagOverlay.init(context, output, tag_overlay_config.toTagOverlayOptions()) catch |e| {
|
||||
log.err("Failed to create a tag overlay: {}", .{e});
|
||||
break :blk null;
|
||||
|
|
@ -377,8 +379,8 @@ pub fn initWallpaperLayerSurface(output: *Output) !void {
|
|||
|
||||
pub fn deinitWallpaperLayerSurface(output: *Output) void {
|
||||
if (output.surfaces) |surfaces| {
|
||||
surfaces.wl_surface.destroy();
|
||||
surfaces.layer_surface.destroy();
|
||||
surfaces.wl_surface.destroy();
|
||||
output.context.buffer_pool.surface_count -= 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue