Add custom layout creation.
This commit is contained in:
@@ -39,6 +39,7 @@ pub fn main() u8 {
|
||||
}
|
||||
|
||||
fn onActivate(app: *adw.Application, _: ?*anyopaque) callconv(.c) void {
|
||||
forceDark();
|
||||
loadCss();
|
||||
|
||||
const window = Window.create(gpa.allocator(), app) catch |err| {
|
||||
@@ -48,6 +49,15 @@ fn onActivate(app: *adw.Application, _: ?*anyopaque) callconv(.c) void {
|
||||
window.present();
|
||||
}
|
||||
|
||||
/// The window's own chrome is dark by hand in `style.css`, but stock widgets —
|
||||
/// popovers, dialogs, text entries — follow the desktop's colour scheme and
|
||||
/// would come up light against it. Layouts brought the first real dialogs into
|
||||
/// the app, which is where that mismatch became visible.
|
||||
fn forceDark() void {
|
||||
const manager = adw.StyleManager.getDefault();
|
||||
manager.setColorScheme(.force_dark);
|
||||
}
|
||||
|
||||
fn loadCss() void {
|
||||
const display = gdk.Display.getDefault() orelse return;
|
||||
const provider = gtk.CssProvider.new();
|
||||
|
||||
Reference in New Issue
Block a user